Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions addons/purchase/migrations/9.0.1.2/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ purchase / product.template / property_account_creditor_price_differ
purchase / product.template / purchase_method (selection) : NEW selection_keys: ['purchase', 'receive']
#Nothing To Do : New Functionality added, default is receive (which will be automatically set to all products)

purchase / purchase.order / bid_date (date) : DEL
purchase / purchase.order / bid_validity (date) : DEL
purchase / purchase.order / bid_date (date) : DEL
purchase / purchase.order / bid_validity (date) : DEL
#Nothing To Do : Functionality removed now no longer needed.

purchase / purchase.order / fiscal_position (many2one) : was renamed to fiscal_position_id [nothing to to]
Expand All @@ -35,14 +35,14 @@ purchase / purchase.order / message_follower_ids (many2many): type
# TODO : ??? # Concerns module Mail (has to be done in another migration script specifically for that module) ---> Nothing to do

purchase / purchase.order / pricelist_id (many2one) : DEL relation: product.pricelist, required: required, req_default: function
#Nothing To Do : Functionality removed now no longer needed.
#Nothing To Do : Functionality removed now no longer needed.

purchase / purchase.order / shipped (boolean) : DEL
purchase / purchase.order / shipped (boolean) : DEL
#Nothing To Do : Functionality removed now no longer needed.

purchase / purchase.order / state (selection) : selection_keys is now '['cancel', 'done', 'draft', 'purchase', 'sent', 'to approve']' ('['approved', 'bid', 'cancel', 'confirmed', 'done', 'draft', 'except_invoice', 'except_picking', 'sent']')
TODO : To map the state values as per new values.
#Done : Mapped the values as per new state values
TODO : To map the state values as per new values.
#Done : Mapped the values as per new state values

purchase / purchase.order / validator (many2one) : DEL relation: res.users
#Nothing To Do : Functionality removed now no longer needed.
Expand All @@ -53,21 +53,20 @@ purchase / purchase.order.line / date_planned (date) : type i
purchase / purchase.order.line / invoice_lines (many2many) : type is now 'one2many' ('many2many')
#Done: migrated Many2many table to Many2one field on the invoice line (purchase_line_id)

purchase / purchase.order.line / invoiced (boolean) : DEL
purchase / purchase.order.line / invoiced (boolean) : DEL
#Nothing To Do : Functionality removed now no longer needed.

purchase / purchase.order.line / product_id (many2one) : now required
#TODO : Maybe To create product from description. (need more analysis on this)
#Done : Created Service type product and assigned purchase.order.line where product_id is null.
#Done : Created Service type product and assigned purchase.order.line where product_id is null.

purchase / purchase.order.line / state (selection) : DEL required: required, selection_keys: ['cancel', 'confirmed', 'done', 'draft'], req_default: function
TODO : To map the state values as per new values.
TODO : To map the state values as per new values.
#Done : Mapped the values as per new state values, done in pre-migration script.

purchase / res.company / po_double_validation (selection): NEW selection_keys: ['one_step', 'two_step']
purchase / res.company / po_double_validation_amount (float): NEW
#TODO : Saved it for later use (moved to purchase module in v9 from purchase_double_validation module in v8).
#Done : need some help (the value is retrieved but need to delete the workflow at the same time)
purchase / res.company / po_double_validation_amount (float): NEW
#Done : Filled from purchase_double_validation old logic

purchase / res.partner / property_product_pricelist_purchase (many2one): DEL relation: product.pricelist
purchase / res.partner / property_purchase_currency_id (many2one): NEW relation: res.currency
Expand Down
29 changes: 28 additions & 1 deletion addons/purchase/migrations/9.0.1.2/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2015 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# Copyright 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# Copyright 2017 Tecnativa - Pedro M. Baeza
# Copyright 2017-2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade
Expand Down Expand Up @@ -63,6 +63,32 @@ def purchase_invoice_lines(cr):
WHERE rel.invoice_id = ail.id """)


def migrate_purchase_double_validation(env):
"""Check if the module is installed and if so, set limit + 2 step."""
if not openupgrade.column_exists(
env.cr, 'purchase_config_settings', 'limit_amount'):
return
openupgrade.add_fields(
env, [
('po_double_validation_amount', 'res.company', 'res_company',
'monetary', False, 'purchase'),
('po_double_validation', 'res.company', 'res_company',
'selection', False, 'purchase'),
],
)
words = env.ref('purchase.trans_confirmed_double_gt').condition.split()
try:
limit = float(words[-1])
except ValueError:
limit = 5000.0
openupgrade.logged_query(
env.cr, """
UPDATE res_company
SET po_double_validation = 'two_step',
po_double_validation_amount = %s""", (limit, ),
)


@openupgrade.logging()
def drop_workflows(env):
"""Drop purchase workflows, removed in v9."""
Expand All @@ -79,6 +105,7 @@ def migrate(env, version):
openupgrade.rename_tables(env.cr, table_renames)
map_order_state(cr)
purchase_invoice_lines(cr)
migrate_purchase_double_validation(env)
drop_workflows(env)
# For avoiding costly computations - It will be handled in post+end
openupgrade.logged_query(
Expand Down
1 change: 1 addition & 0 deletions openerp/addons/openupgrade_records/lib/apriori.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
('hr_applicant_document', 'hr_recruitment'),
('portal_project', 'project'),
('portal_project_issue', 'project_issue'),
('purchase_double_validation', 'purchase'),
('procurement_jit_stock', 'procurement_jit'),
('web_gantt', 'web'),
('web_graph', 'web'),
Expand Down
2 changes: 1 addition & 1 deletion openerp/openupgrade/doc/source/modules80-90.rst
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ missing in the new release are marked with |del|.
+----------------------------------------+------------------------------------------+
| |del| purchase_analytic_plans | Moved to OCA [#purchase_analytic_plans]_ |
+----------------------------------------+------------------------------------------+
| |del| purchase_double_validation | |
| |del| purchase_double_validation | Done (merged in purchase) |
+----------------------------------------+------------------------------------------+
|purchase_requisition | Done |
+----------------------------------------+------------------------------------------+
Expand Down