Skip to content

Commit

Permalink
[MIG] mrp_account: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernesto Tejeda committed Mar 23, 2023
1 parent 341ccd4 commit 7ac9ea4
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docsource/modules140-150.rst
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ Module coverage 14.0 -> 15.0
+-------------------------------------------------+----------------------+-------------------------------------------------+
| mrp | Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| mrp_account | | |
| mrp_account | Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| mrp_landed_costs | |No DB layout changes. |
+-------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
26 changes: 26 additions & 0 deletions openupgrade_scripts/scripts/mrp_account/15.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade

def pre_create_mrp_production_analytic_account_id(env):
""" Pre-create the column for avoiding computation on module upgrade """
if openupgrade.column_exists(env.cr, "mrp_production", "analytic_account_id"):
return
openupgrade.add_fields(
env,
[
(
"analytic_account_id",
"mrp.production",
"mrp_production",
"many2one",
False,
"mrp_account",
)
],
)

@openupgrade.migrate()
def migrate(env, version):
pre_create_mrp_production_analytic_account_id(env)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---Models in module 'mrp_account'---
---Fields in module 'mrp_account'---
mrp_account / account.analytic.account / bom_ids (one2many) : NEW relation: mrp.bom
mrp_account / account.analytic.account / production_ids (one2many) : NEW relation: mrp.production
mrp_account / account.analytic.account / workcenter_ids (one2many) : NEW relation: mrp.workcenter
mrp_account / account.analytic.line / category (False) : NEW selection_keys: ['invoice', 'manufacturing_order', 'other', 'vendor_bill'], mode: modify
mrp_account / mrp.bom / analytic_account_id (many2one): NEW relation: account.analytic.account
# NOTHING TO DO: new feature

mrp_account / mrp.production / analytic_account_id (many2one): NEW relation: account.analytic.account, hasdefault: compute
# DONE: pre-migration: pre-create column 'analytic_account_id' for avoiding computation on module upgrade

mrp_account / mrp.workorder / mo_analytic_account_line_id (many2one): NEW relation: account.analytic.line
mrp_account / mrp.workorder / wc_analytic_account_line_id (many2one): NEW relation: account.analytic.line
# NOTHING TO DO: new feature

---XML records in module 'mrp_account'---
NEW ir.ui.view: mrp_account.account_analytic_account_view_form_mrp
NEW ir.ui.view: mrp_account.mrp_bom_form_view_inherited
NEW ir.ui.view: mrp_account.view_production_graph_inherit_mrp_account
# NOTHING TO DO: new records

0 comments on commit 7ac9ea4

Please sign in to comment.