-
-
Notifications
You must be signed in to change notification settings - Fork 800
[19.0][MIG] mrp #5558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hbrunn
wants to merge
2
commits into
OCA:19.0
Choose a base branch
from
hbrunn:19.0-mrp
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[19.0][MIG] mrp #5558
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
openupgrade_scripts/scripts/mrp/19.0.2.0/post-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def mrp_production_group(env): | ||
| """ | ||
| Create production groups from procurement groups | ||
| """ | ||
| link_column = openupgrade.get_legacy_name("procurement_group_id") | ||
| env.cr.execute( | ||
| f"ALTER TABLE mrp_production_group ADD COLUMN IF NOT EXISTS {link_column} int" | ||
| ) | ||
| env.cr.execute( | ||
| f""" | ||
| INSERT INTO mrp_production_group | ||
| (name, {link_column}) | ||
| SELECT | ||
| stock_reference.name, stock_reference.id | ||
| FROM | ||
| stock_reference | ||
| WHERE id IN ( | ||
| SELECT procurement_group_id FROM | ||
| mrp_production | ||
| ) | ||
| """ | ||
| ) | ||
| env.cr.execute( | ||
| f""" | ||
| UPDATE mrp_production | ||
| SET production_group_id=mrp_production_group.id | ||
| FROM | ||
| mrp_production_group | ||
| WHERE {link_column}=procurement_group_id | ||
| """ | ||
| ) | ||
| env.cr.execute( | ||
| f""" | ||
| UPDATE stock_move | ||
| SET production_group_id=mrp_production_group.id | ||
| FROM | ||
| mrp_production_group | ||
| WHERE {link_column}=group_id | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def mrp_workorder_state(env): | ||
| """ | ||
| Map mrp.workorder#state values | ||
| """ | ||
| openupgrade.map_values( | ||
| env.cr, | ||
| openupgrade.get_legacy_name("state"), | ||
| "state", | ||
| [("pending", "blocked"), ("waiting", "blocked")], | ||
| table="mrp_workorder", | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.load_data(env, "mrp", "19.0.2.0/noupdate_changes.xml") | ||
| openupgrade.m2o_to_x2m( | ||
| env.cr, | ||
| env["mrp.production"], | ||
| "mrp_production", | ||
| "lot_producing_ids", | ||
| "lot_producing_id", | ||
| ) | ||
| openupgrade.m2o_to_x2m( | ||
| env.cr, | ||
| env["mrp.production"], | ||
| "mrp_production", | ||
| "reference_ids", | ||
| "procurement_group_id", | ||
| ) | ||
| mrp_production_group(env) | ||
| mrp_workorder_state(env) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| _renamed_field_references = [ | ||
| ( | ||
| "mrp.production", | ||
| "lot_producing_id", | ||
| "lot_producing_ids", | ||
| ), | ||
| ( | ||
| "mrp.production", | ||
| "procurement_group_id", | ||
| "reference_ids", | ||
| ), | ||
| ] | ||
|
|
||
| _copied_columns = { | ||
| "mrp_workorder": [ | ||
| ("state", None, None), | ||
| ] | ||
| } | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.rename_field_references(env, _renamed_field_references) | ||
| openupgrade.copy_columns(env.cr, _copied_columns) |
145 changes: 145 additions & 0 deletions
145
openupgrade_scripts/scripts/mrp/19.0.2.0/upgrade_analysis_work.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| ---Models in module 'mrp'--- | ||
| obsolete model mrp.batch.produce (renamed to mrp.production.serials) [transient] | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| new model mrp.production.group | ||
|
|
||
| # DONE: created from procurement groups | ||
|
|
||
| new model mrp.production.serials (renamed from mrp.batch.produce) [transient] | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| ---Fields in module 'mrp'--- | ||
| mrp / mrp.bom / batch_size (float) : NEW hasdefault: default | ||
| mrp / mrp.bom / enable_batch_size (boolean) : NEW hasdefault: default | ||
|
|
||
| # NOTHING TO DO: new feature, defaults keep previous behavior | ||
|
|
||
| mrp / mrp.bom.line / manual_consumption (boolean) : DEL | ||
| mrp / mrp.production / date_deadline (datetime) : not a function anymore | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| mrp / mrp.production / lot_producing_id (many2one) : DEL relation: stock.lot | ||
| mrp / mrp.production / lot_producing_ids (many2many) : NEW relation: stock.lot | ||
|
|
||
| # DONE: m2o_to_x2m | ||
|
|
||
| mrp / mrp.production / procurement_group_id (many2one): DEL relation: procurement.group | ||
|
|
||
| # DONE: m2o_to_x2m | ||
|
|
||
| mrp / mrp.production / production_group_id (many2one): NEW relation: mrp.production.group | ||
|
|
||
| # DONE: created from procurement_group_id in post-migration | ||
|
|
||
| mrp / mrp.production / reference_ids (many2many) : NEW relation: stock.reference | ||
|
|
||
| # DONE: m2o_to_x2m | ||
|
|
||
| mrp / mrp.production.group / child_ids (many2many) : NEW relation: mrp.production.group | ||
| mrp / mrp.production.group / name (char) : NEW required | ||
| mrp / mrp.production.group / parent_ids (many2many) : NEW relation: mrp.production.group | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| mrp / mrp.production.group / production_ids (one2many) : NEW relation: mrp.production | ||
|
|
||
| # DONE: see mrp.production#production_group_id | ||
|
|
||
| mrp / mrp.routing.workcenter / cost_mode (selection) : NEW selection_keys: ['actual', 'estimated'], hasdefault: default | ||
| mrp / mrp.routing.workcenter / note (html) : DEL | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not save this field (with |
||
| mrp / mrp.routing.workcenter / worksheet (binary) : DEL attachment: True | ||
| mrp / mrp.routing.workcenter / worksheet_google_slide (char) : DEL | ||
| mrp / mrp.routing.workcenter / worksheet_type (selection) : DEL selection_keys: ['google_slide', 'pdf', 'text'] | ||
| mrp / mrp.unbuild / lot_id (many2one) : not a function anymore | ||
| mrp / mrp.workcenter / default_capacity (float) : DEL | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| mrp / mrp.workcenter.capacity / product_uom_id (many2one) : is now stored | ||
| mrp / mrp.workcenter.capacity / product_uom_id (many2one) : not related anymore | ||
| mrp / mrp.workcenter.capacity / product_uom_id (many2one) : now required | ||
|
|
||
| # NOTHING TO DO: was related to product_id.uom_id and product_id was required | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then, shouldn't this be filled with |
||
|
|
||
| mrp / mrp.workcenter.productivity / loss_type (selection) : not stored anymore | ||
| mrp / mrp.workcenter.productivity.loss / loss_type (selection) : not stored anymore | ||
| mrp / mrp.workorder / cost_mode (selection) : NEW selection_keys: ['actual', 'estimated'], hasdefault: default | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| mrp / mrp.workorder / last_working_user_id (one2many): type is now 'many2one' ('one2many') | ||
|
|
||
| # NOTHING TO DO: nonstored | ||
|
|
||
| mrp / mrp.workorder / product_id (many2one) : not stored anymore | ||
| mrp / mrp.workorder / product_uom_id (many2one) : not stored anymore | ||
| mrp / mrp.workorder / product_uom_id (many2one) : now related | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| mrp / mrp.workorder / state (selection) : selection_keys added: [blocked], removed: [pending, waiting] | ||
|
|
||
| # DONE: pending, waiting mapped to blocked | ||
|
|
||
| mrp / procurement.group / mrp_production_ids (one2many) : DEL relation: mrp.production | ||
|
|
||
| # DONE: see mrp.production#procurement_group_id | ||
|
|
||
| mrp / res.company / manufacturing_lead (float) : DEL required | ||
| mrp / stock.move / is_done (boolean) : DEL | ||
| mrp / stock.move / order_finished_lot_id (many2one): DEL relation: stock.lot | ||
| mrp / stock.move / production_group_id (many2one): NEW relation: mrp.production.group | ||
|
|
||
| # DONE: set to production group created for mrp.production#procurement_group_id | ||
|
|
||
| mrp / stock.picking / production_ids (many2many) : not a function anymore | ||
| mrp / stock.picking / production_ids (many2many) : now related | ||
| mrp / stock.picking / production_ids (many2many) : type is now 'one2many' ('many2many') | ||
|
|
||
| # NOTHING TO DO: set by setting stock.move#production_group_id | ||
|
|
||
| mrp / stock.reference / production_ids (many2many) : NEW relation: mrp.production | ||
|
|
||
| # DONE: see mrp.production#reference_ids | ||
|
|
||
| mrp / stock.warehouse / manufacture_to_resupply (boolean): not stored anymore | ||
| mrp / stock.warehouse / manufacture_to_resupply (boolean): now a function | ||
| mrp / stock.warehouse.orderpoint / manufacturing_visibility_days (float): DEL | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| ---XML records in module 'mrp'--- | ||
| NEW ir.actions.act_window: mrp.action_assign_serial_numbers | ||
| DEL ir.actions.act_window: mrp.act_product_mrp_production_workcenter | ||
| DEL ir.actions.act_window: mrp.action_mrp_batch_produce | ||
| NEW ir.model.access: mrp.access_mrp_production_group | ||
| NEW ir.model.access: mrp.access_mrp_production_serials | ||
| DEL ir.model.access: mrp.access_mrp_batch_produce | ||
| DEL ir.model.access: mrp.access_mrp_document_mrp_user | ||
| DEL ir.model.access: mrp.access_product_category_mrp_manager | ||
| DEL ir.model.access: mrp.access_product_packaging_mrp_manager | ||
| DEL ir.model.access: mrp.access_product_pricelist_mrp_manager | ||
| DEL ir.model.access: mrp.access_product_product_mrp_manager | ||
| DEL ir.model.access: mrp.access_product_supplierinfo_user | ||
| DEL ir.model.access: mrp.access_product_tag_mrp_manager | ||
| DEL ir.model.access: mrp.access_product_template_mrp_manager | ||
| DEL ir.model.access: mrp.access_uom_category | ||
| DEL ir.model.access: mrp.access_uom_category_mrp_manager | ||
| DEL ir.model.access: mrp.access_uom_uom_mrp_manager | ||
| ir.model.constraint: mrp.constraint_mrp_workcenter_capacity_positive_capacity (changed definition: is now 'CHECK(capacity >= 0)' ('check(capacity > 0)')) | ||
| NEW ir.model.constraint: mrp.constraint_mrp_workcenter_capacity_workcenter_product_product_uom_unique | ||
| DEL ir.model.constraint: mrp.constraint_mrp_workcenter_capacity_unique_product | ||
| NEW ir.ui.view: mrp.mrp_bom_replenishment_tree_view | ||
| NEW ir.ui.view: mrp.mrp_routing_workcenter_kanban_view | ||
| NEW ir.ui.view: mrp.view_move_line_tree | ||
| NEW ir.ui.view: mrp.view_mrp_production_serials_form | ||
| NEW ir.ui.view: mrp.view_stock_replenishment_info_stock_mrp_inherit | ||
| DEL ir.ui.view: mrp.view_mrp_batch_produce_form | ||
| DEL ir.ui.view: mrp.view_stock_move_line_detailed_operation_tree_mrp | ||
| NEW res.groups.privilege: mrp.res_groups_privilege_manufacturing | ||
|
|
||
| # NOTHING TO DO | ||
21 changes: 21 additions & 0 deletions
21
openupgrade_scripts/scripts/mrp_account/19.0.1.0/pre-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| _renamed_tables = [ | ||
| ("account_move_mrp_production_rel", "wip_move_production_rel"), | ||
| ] | ||
|
|
||
| _renamed_columns = { | ||
| "wip_move_production_rel": [ | ||
| ("account_move_id", "move_id"), | ||
| ("mrp_production_id", "production_id"), | ||
| ] | ||
| } | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.rename_tables(env.cr, _renamed_tables) | ||
| openupgrade.rename_columns(env.cr, _renamed_columns) |
14 changes: 14 additions & 0 deletions
14
openupgrade_scripts/scripts/mrp_account/19.0.1.0/upgrade_analysis_work.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ---Models in module 'mrp_account'--- | ||
| ---Fields in module 'mrp_account'--- | ||
| mrp_account / account.move / wip_production_ids (many2many): column1 is now 'move_id' ('account_move_id') [account_move_mrp_production_rel] | ||
| mrp_account / account.move / wip_production_ids (many2many): column2 is now 'production_id' ('mrp_production_id') [account_move_mrp_production_rel] | ||
| mrp_account / account.move / wip_production_ids (many2many): table is now 'wip_move_production_rel' ('account_move_mrp_production_rel') | ||
|
|
||
| # DONE: renamed in pre-migration | ||
|
|
||
| mrp_account / mrp.production / wip_move_ids (many2many) : NEW relation: account.move | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| ---XML records in module 'mrp_account'--- | ||
| DEL ir.ui.view: mrp_account.view_category_property_form |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not telling you to change it, but FYI:
add_columns()exists...