From dc2b11ed4bf36fd7821a067a4e165f54caa51342 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 13:02:57 +0200 Subject: [PATCH 01/18] First part of product migration analysis. XML ID migration complete --- .../migrations/8.0.1.1/modified_data.xml | 25 ++++ .../8.0.1.1/openupgrade_analysis_WORK.txt | 115 ++++++++++++++++++ .../8.0.1.1/post-modified_noupdate_data.py | 6 + 3 files changed, 146 insertions(+) create mode 100644 addons/product/migrations/8.0.1.1/modified_data.xml create mode 100644 addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt create mode 100644 addons/product/migrations/8.0.1.1/post-modified_noupdate_data.py diff --git a/addons/product/migrations/8.0.1.1/modified_data.xml b/addons/product/migrations/8.0.1.1/modified_data.xml new file mode 100644 index 000000000000..93c05c245d06 --- /dev/null +++ b/addons/product/migrations/8.0.1.1/modified_data.xml @@ -0,0 +1,25 @@ + + + + ['|',('company_id','=',False),('company_id','=',user.company_id.id)] + + ['|',('company_id','=',user.company_id.id),('company_id','=',False)] + + + + 1000 + + All + + ['|',('company_id','=',user.company_id.id),('company_id','=',False)] + + ['|',('company_id','=',user.company_id.id),('company_id','=',False)] + + ['|',('company_id','=',user.company_id.id),('company_id','=',False)] + + + + + + diff --git a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt new file mode 100644 index 000000000000..fdc2032cbb89 --- /dev/null +++ b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt @@ -0,0 +1,115 @@ +---Fields in module 'product'--- +product / product.attribute / name (char) : NEW required: required +product / product.attribute / value_ids (one2many) : NEW relation: product.attribute.value +product / product.attribute.line / attribute_id (many2one) : NEW relation: product.attribute, required: required +product / product.attribute.line / product_tmpl_id (many2one) : NEW relation: product.template, required: required +product / product.attribute.line / value_ids (many2many) : NEW relation: product.attribute.value +product / product.attribute.price / price_extra (float) : NEW +product / product.attribute.price / product_tmpl_id (many2one) : NEW relation: product.template, required: required +product / product.attribute.price / value_id (many2one) : NEW relation: product.attribute.value, required: required +product / product.attribute.value / attribute_id (many2one) : NEW relation: product.attribute, required: required +product / product.attribute.value / name (char) : NEW required: required +product / product.attribute.value / price_ids (one2many) : NEW relation: product.attribute.price +product / product.attribute.value / product_ids (many2many) : NEW relation: product.product +product / product.attribute.value / sequence (integer) : NEW +product / product.packaging / height (float) : DEL +product / product.packaging / length (float) : DEL +product / product.packaging / ul_container (many2one) : NEW relation: product.ul +product / product.packaging / weight_ul (float) : DEL +product / product.packaging / width (float) : DEL +product / product.price.history / company_id (many2one) : NEW relation: res.company, required: required, req_default: function +product / product.price.history / cost (float) : NEW +product / product.price.history / datetime (datetime) : NEW +product / product.price.history / product_template_id (many2one): NEW relation: product.template, required: required +product / product.product / attribute_value_ids (many2many): NEW relation: product.attribute.value +product / product.product / color (integer) : DEL +product / product.product / image (binary) : now a function +product / product.product / image_variant (binary) : NEW +product / product.product / incoming_qty (float) : module is now 'stock' ('product') +product / product.product / message_last_post (datetime) : NEW +product / product.product / outgoing_qty (float) : module is now 'stock' ('product') +product / product.product / price_extra (float) : now a function +product / product.product / price_margin (float) : DEL +product / product.product / qty_available (float) : module is now 'stock' ('product') +product / product.product / variants (char) : DEL +product / product.product / virtual_available (float) : module is now 'stock' ('product') +product / product.supplierinfo / product_id (many2one) : DEL relation: product.template, required: required +product / product.supplierinfo / product_tmpl_id (many2one) : NEW relation: product.template, required: required +product / product.template / active (boolean) : NEW +product / product.template / attribute_line_ids (one2many) : NEW relation: product.attribute.line +product / product.template / color (integer) : NEW +product / product.template / cost_method (selection) : module is now 'stock_account' ('product') +product / product.template / cost_method (selection) : now a function +product / product.template / cost_method (selection) : selection_keys is now '['average', 'real', 'standard']' ('['average', 'standard']') +product / product.template / image (binary) : NEW +product / product.template / message_ids (one2many) : NEW relation: mail.message +product / product.template / message_last_post (datetime) : NEW +product / product.template / packaging (one2many) : NEW relation: product.packaging +product / product.template / produce_delay (float) : DEL +product / product.template / product_variant_ids (one2many): NEW relation: product.product, required: required +product / product.template / standard_price (float) : now a function +product / product.ul / height (float) : NEW +product / product.ul / length (float) : NEW +product / product.ul / weight (float) : NEW +product / product.ul / width (float) : NEW + + + +---XML records in module 'product'--- +NEW ir.actions.act_window: product.product_template_action +NEW ir.actions.act_window: product.product_variant_action +NEW ir.actions.act_window: product.variants_template_action +DEL ir.actions.act_window: product.product_normal_action_puchased +DEL ir.actions.act_window: product.product_template_action_tree +DEL ir.actions.act_window.view: product.open_view_product_form1 +DEL ir.actions.act_window.view: product.open_view_product_kanban1 +DEL ir.actions.act_window.view: product.open_view_product_tree1 +NEW ir.actions.report.xml: product.action_report_pricelist +DEL ir.actions.report.xml: product.report_product_pricelist +## ir.actions: the doc says we can safely ignore these + +NEW ir.model.access: product.access_product_attribute +NEW ir.model.access: product.access_product_attribute_line +NEW ir.model.access: product.access_product_attribute_line_sale_manager +NEW ir.model.access: product.access_product_attribute_price +NEW ir.model.access: product.access_product_attribute_price_sale_manager +NEW ir.model.access: product.access_product_attribute_sale_manager +NEW ir.model.access: product.access_product_attribute_value +NEW ir.model.access: product.access_product_attribute_value_sale_manager +NEW ir.model.access: product.access_product_price_history_employee +## access rules: let them be for now + + +NEW ir.ui.menu: product.menu_product_template_action +NEW ir.ui.view: product.product_template_form_view_variant_button +NEW ir.ui.view: product.product_template_kanban_view +NEW ir.ui.view: product.product_template_kanban_view_variant_button +NEW ir.ui.view: product.product_template_search_view +NEW ir.ui.view: product.report_pricelist +NEW ir.ui.view: product.variants_template_tree_view +DEL ir.ui.view: product.product_variant_form_view +DEL ir.ui.view: product.product_variant_tree_view +DEL ir.ui.view_sc: product.ir_ui_view_sc_product0 +## ir.ui.* doc says we can ignore + +DEL process.node: product.process_node_product0 +DEL process.node: product.process_node_supplier0 +DEL process.process: product.process_process_productprocess0 +DEL process.transition: product.process_transition_supplierofproduct0 +## process addon removed -> nothing to do + +NEW product.uom: product.product_uom_floz +NEW product.uom: product.product_uom_foot +NEW product.uom: product.product_uom_gal +NEW product.uom: product.product_uom_inch +NEW product.uom: product.product_uom_lb +NEW product.uom: product.product_uom_mile +NEW product.uom: product.product_uom_oz +NEW product.uom: product.product_uom_qt +## great new stuff, std upgrade should work by itself + +DEL res.groups: product.group_costing_method +DEL res.groups: product.group_product_variant +## well... probably nothing to do either... + +## modified no update records listed in modified_data.xml diff --git a/addons/product/migrations/8.0.1.1/post-modified_noupdate_data.py b/addons/product/migrations/8.0.1.1/post-modified_noupdate_data.py new file mode 100644 index 000000000000..7ea5e631b75f --- /dev/null +++ b/addons/product/migrations/8.0.1.1/post-modified_noupdate_data.py @@ -0,0 +1,6 @@ + +import openupgrade + +@openupgrade.migrate +def migrate(cr, version): + openupgrade.load_data(cr, 'product', 'migrations/8.0.1.1/modified_data.xml', mode='init') From 1252ab41a009e46e765389571061958b943e410b Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 16:16:57 +0200 Subject: [PATCH 02/18] fix missing dependency in product in v8 --- addons/product/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/__openerp__.py b/addons/product/__openerp__.py index 83ecea958869..469941620e1a 100644 --- a/addons/product/__openerp__.py +++ b/addons/product/__openerp__.py @@ -25,7 +25,7 @@ 'version': '1.1', 'author': 'OpenERP SA', 'category': 'Sales Management', - 'depends': ['base', 'decimal_precision', 'mail'], + 'depends': ['base', 'decimal_precision', 'mail', 'report'], 'demo': [ 'product_demo.xml', 'product_image_demo.xml', From 12403313d61722c8b63d5623c6f194da4fedd382 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 16:18:10 +0200 Subject: [PATCH 03/18] updated product migration analysis --- .../8.0.1.1/openupgrade_analysis_WORK.txt | 72 ++++++++++++++----- 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt index fdc2032cbb89..a3522cb16778 100644 --- a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt +++ b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt @@ -12,46 +12,84 @@ product / product.attribute.value / name (char) : NEW re product / product.attribute.value / price_ids (one2many) : NEW relation: product.attribute.price product / product.attribute.value / product_ids (many2many) : NEW relation: product.product product / product.attribute.value / sequence (integer) : NEW + +## new model, will be handled by standard migration + + +product / product.packaging / ul_container (many2one) : NEW relation: product.ul product / product.packaging / height (float) : DEL +product / product.ul / height (float) : NEW product / product.packaging / length (float) : DEL -product / product.packaging / ul_container (many2one) : NEW relation: product.ul +product / product.ul / length (float) : NEW product / product.packaging / weight_ul (float) : DEL +product / product.ul / weight (float) : NEW product / product.packaging / width (float) : DEL +product / product.ul / width (float) : NEW +## new relation ul_container, and the dimensions are moved there +## TODO later because rarely used feature + + product / product.price.history / company_id (many2one) : NEW relation: res.company, required: required, req_default: function product / product.price.history / cost (float) : NEW product / product.price.history / datetime (datetime) : NEW product / product.price.history / product_template_id (many2one): NEW relation: product.template, required: required +# new fields -> nothing to do + +product / product.template / attribute_line_ids (one2many) : NEW relation: product.attribute.line product / product.product / attribute_value_ids (many2many): NEW relation: product.attribute.value -product / product.product / color (integer) : DEL -product / product.product / image (binary) : now a function -product / product.product / image_variant (binary) : NEW -product / product.product / incoming_qty (float) : module is now 'stock' ('product') -product / product.product / message_last_post (datetime) : NEW -product / product.product / outgoing_qty (float) : module is now 'stock' ('product') -product / product.product / price_extra (float) : now a function -product / product.product / price_margin (float) : DEL -product / product.product / qty_available (float) : module is now 'stock' ('product') -product / product.product / variants (char) : DEL -product / product.product / virtual_available (float) : module is now 'stock' ('product') +# nothing to do + + product / product.supplierinfo / product_id (many2one) : DEL relation: product.template, required: required product / product.supplierinfo / product_tmpl_id (many2one) : NEW relation: product.template, required: required +# seller_ids moved from product.product to product.template product / product.template / active (boolean) : NEW -product / product.template / attribute_line_ids (one2many) : NEW relation: product.attribute.line +# need to move seller_ids from product.product to product.template + product / product.template / color (integer) : NEW +product / product.product / color (integer) : DEL +## color moved up in template + product / product.template / cost_method (selection) : module is now 'stock_account' ('product') product / product.template / cost_method (selection) : now a function product / product.template / cost_method (selection) : selection_keys is now '['average', 'real', 'standard']' ('['average', 'standard']') +# TODO + product / product.template / image (binary) : NEW +product / product.product / image (binary) : now afunction +# need to move up to template + +product / product.product / image_variant (binary) : NEW +# nothing to do + product / product.template / message_ids (one2many) : NEW relation: mail.message product / product.template / message_last_post (datetime) : NEW +# now product.template derives from mail template +# TODO : move up messages +product / product.product / message_last_post (datetime) : NEW + + product / product.template / packaging (one2many) : NEW relation: product.packaging +# TODO later once issue #291 is solved + product / product.template / produce_delay (float) : DEL +# moved in mrp, defined on product.product + product / product.template / product_variant_ids (one2many): NEW relation: product.product, required: required +# nothing to do? + product / product.template / standard_price (float) : now a function -product / product.ul / height (float) : NEW -product / product.ul / length (float) : NEW -product / product.ul / weight (float) : NEW -product / product.ul / width (float) : NEW +# nothing to do + +product / product.product / incoming_qty (float) : module is now 'stock' ('product') +# function field nothing to do + +product / product.product / outgoing_qty (float) : module is now 'stock' ('product') +product / product.product / price_extra (float) : now a function +product / product.product / price_margin (float) : DEL +product / product.product / qty_available (float) : module is now 'stock' ('product') +product / product.product / variants (char) : DEL +product / product.product / virtual_available (float) : module is now 'stock' ('product') From d8f8b1bede44e759b599a16e367e3388cf148946 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 16:20:10 +0200 Subject: [PATCH 04/18] first pass at product migration script --- .../migrations/8.0.1.1/post-migration.py | 33 +++++++++++++++++++ .../8.0.1.1/post-modified_noupdate_data.py | 6 ---- .../migrations/8.0.1.1/pre-migration.py | 25 ++++++++++++++ 3 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 addons/product/migrations/8.0.1.1/post-migration.py delete mode 100644 addons/product/migrations/8.0.1.1/post-modified_noupdate_data.py create mode 100644 addons/product/migrations/8.0.1.1/pre-migration.py diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py new file mode 100644 index 000000000000..deed2c8785fd --- /dev/null +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -0,0 +1,33 @@ +from openerp.openupgrade import openupgrade + +def load_data(cr): + openupgrade.load_data(cr, 'product', 'migrations/8.0.1.1/modified_data.xml', mode='init') + +def move_fields(cr): + execute = openupgrade.logged_query + queries = [ """ + UPDATE product_supplierinfo + SET product_tmpl_id=(SELECT product_tmpl_id + FROM product_product + WHERE product_product.id=product_supplierinfo.%s) + """ % openupgrade.get_legacy_name('product_id'), + """ + UPDATE product_template as pt + SET color=(SELECT pp1.%s + FROM product_product as pp1 + WHERE pp1.product_tmpl_id=pt.id ORDER BY pp1.id LIMIT 1), + image=(SELECT pp2.%s + FROM product_product as pp2 + WHERE pp2.product_tmpl_id=pt.id ORDER BY pp2.id LIMIT 1) + """ % (openupgrade.get_legacy_name('color'), + openupgrade.get_legacy_name('image') + ), + ] + for sql in queries: + execute(cr, sql) + +@openupgrade.migrate() +def migrate(cr, version): + move_fields() + load_data() + diff --git a/addons/product/migrations/8.0.1.1/post-modified_noupdate_data.py b/addons/product/migrations/8.0.1.1/post-modified_noupdate_data.py deleted file mode 100644 index 7ea5e631b75f..000000000000 --- a/addons/product/migrations/8.0.1.1/post-modified_noupdate_data.py +++ /dev/null @@ -1,6 +0,0 @@ - -import openupgrade - -@openupgrade.migrate -def migrate(cr, version): - openupgrade.load_data(cr, 'product', 'migrations/8.0.1.1/modified_data.xml', mode='init') diff --git a/addons/product/migrations/8.0.1.1/pre-migration.py b/addons/product/migrations/8.0.1.1/pre-migration.py new file mode 100644 index 000000000000..1bb169ededb1 --- /dev/null +++ b/addons/product/migrations/8.0.1.1/pre-migration.py @@ -0,0 +1,25 @@ +from openerp.openupgrade import openupgrade + +column_renames = { + # Using magic None value to trigger call to get_legacy_name() + 'product_supplierinfo': [ + ('product_id', None), + ], + 'product_product': + [ + ('color', None), + ('image', None), + ], + 'product_template':[ + ('produce_delay', None), # need to handle in mrp migration + ] + } + +def migrate_packaging(cr): + pass # XXX + +@openupgrade.migrate() +def migrate(cr, version): + openupgrade.rename_columns(cr, column_renames) + migrate_packaging() + From adb73d2d05827fdee54809db87f2a7105c5ed229 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 16:30:18 +0200 Subject: [PATCH 05/18] fix bad refactoring --- addons/product/migrations/8.0.1.1/post-migration.py | 8 +++++--- addons/product/migrations/8.0.1.1/pre-migration.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index deed2c8785fd..df95a7de5dea 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -1,9 +1,10 @@ from openerp.openupgrade import openupgrade +from openerp import pooler, SUPERUSER_ID def load_data(cr): openupgrade.load_data(cr, 'product', 'migrations/8.0.1.1/modified_data.xml', mode='init') -def move_fields(cr): +def move_fields(cr, pool): execute = openupgrade.logged_query queries = [ """ UPDATE product_supplierinfo @@ -28,6 +29,7 @@ def move_fields(cr): @openupgrade.migrate() def migrate(cr, version): - move_fields() - load_data() + pool = pooler.get_pool(cr.dbname) + move_fields(cr, pool) + load_data(cr) diff --git a/addons/product/migrations/8.0.1.1/pre-migration.py b/addons/product/migrations/8.0.1.1/pre-migration.py index 1bb169ededb1..f9d98880ab14 100644 --- a/addons/product/migrations/8.0.1.1/pre-migration.py +++ b/addons/product/migrations/8.0.1.1/pre-migration.py @@ -21,5 +21,5 @@ def migrate_packaging(cr): @openupgrade.migrate() def migrate(cr, version): openupgrade.rename_columns(cr, column_renames) - migrate_packaging() + migrate_packaging(cr) From 776c954961ce6996ff07eb9c52d2f0517dc56914 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 16:44:45 +0200 Subject: [PATCH 06/18] compute active attribute of template from attribute of variants --- .../migrations/8.0.1.1/openupgrade_analysis_WORK.txt | 12 +++++++----- addons/product/migrations/8.0.1.1/post-migration.py | 12 ++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt index a3522cb16778..6138a5e97003 100644 --- a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt +++ b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt @@ -13,7 +13,7 @@ product / product.attribute.value / price_ids (one2many) : NEW re product / product.attribute.value / product_ids (many2many) : NEW relation: product.product product / product.attribute.value / sequence (integer) : NEW -## new model, will be handled by standard migration +## OK new model, will be handled by standard migration product / product.packaging / ul_container (many2one) : NEW relation: product.ul @@ -33,19 +33,21 @@ product / product.price.history / company_id (many2one) : NEW re product / product.price.history / cost (float) : NEW product / product.price.history / datetime (datetime) : NEW product / product.price.history / product_template_id (many2one): NEW relation: product.template, required: required -# new fields -> nothing to do +# OK new fields -> nothing to do product / product.template / attribute_line_ids (one2many) : NEW relation: product.attribute.line product / product.product / attribute_value_ids (many2many): NEW relation: product.attribute.value -# nothing to do +# OK nothing to do product / product.supplierinfo / product_id (many2one) : DEL relation: product.template, required: required product / product.supplierinfo / product_tmpl_id (many2one) : NEW relation: product.template, required: required -# seller_ids moved from product.product to product.template -product / product.template / active (boolean) : NEW +# OK seller_ids moved from product.product to product.template # need to move seller_ids from product.product to product.template +product / product.template / active (boolean) : NEW +# OK: copy + product / product.template / color (integer) : NEW product / product.product / color (integer) : DEL ## color moved up in template diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index df95a7de5dea..3000202dcd43 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -27,9 +27,21 @@ def move_fields(cr, pool): for sql in queries: execute(cr, sql) +def copy_fields(cr, pool): + product_tmpl= pool['product.template'] + product_obj= pool['product.product'] + # copy the active field from product to template + ctx = {'active_test': False} + tmpl_ids = product_tmpl.search(cr, SUPERUSER_ID, [], context=ctx) + for template in product_tmpl.browse(cr, SUPERUSER_ID, tmpl_ids, context=ctx): + template.write({'active': any(variant.active + for variant in template.product_variant_ids) + }) + @openupgrade.migrate() def migrate(cr, version): pool = pooler.get_pool(cr.dbname) move_fields(cr, pool) + copy_fields(cr, pool) load_data(cr) From db73bf7a379f312cc823f5f1929053d0eb7eca9f Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 16:52:35 +0200 Subject: [PATCH 07/18] copy product_product.image to product_product.image_variant --- .../product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt | 5 ++--- addons/product/migrations/8.0.1.1/post-migration.py | 3 +-- addons/product/migrations/8.0.1.1/pre-migration.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt index 6138a5e97003..0058b626411e 100644 --- a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt +++ b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt @@ -43,14 +43,13 @@ product / product.product / attribute_value_ids (many2many): NEW r product / product.supplierinfo / product_id (many2one) : DEL relation: product.template, required: required product / product.supplierinfo / product_tmpl_id (many2one) : NEW relation: product.template, required: required # OK seller_ids moved from product.product to product.template -# need to move seller_ids from product.product to product.template product / product.template / active (boolean) : NEW # OK: copy product / product.template / color (integer) : NEW product / product.product / color (integer) : DEL -## color moved up in template +## OK color moved up in template product / product.template / cost_method (selection) : module is now 'stock_account' ('product') product / product.template / cost_method (selection) : now a function @@ -59,7 +58,7 @@ product / product.template / cost_method (selection) : select product / product.template / image (binary) : NEW product / product.product / image (binary) : now afunction -# need to move up to template +# OK need to move up to template product / product.product / image_variant (binary) : NEW # nothing to do diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index 3000202dcd43..3f61e80adcd2 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -17,11 +17,10 @@ def move_fields(cr, pool): SET color=(SELECT pp1.%s FROM product_product as pp1 WHERE pp1.product_tmpl_id=pt.id ORDER BY pp1.id LIMIT 1), - image=(SELECT pp2.%s + image=(SELECT pp2.image_variant FROM product_product as pp2 WHERE pp2.product_tmpl_id=pt.id ORDER BY pp2.id LIMIT 1) """ % (openupgrade.get_legacy_name('color'), - openupgrade.get_legacy_name('image') ), ] for sql in queries: diff --git a/addons/product/migrations/8.0.1.1/pre-migration.py b/addons/product/migrations/8.0.1.1/pre-migration.py index f9d98880ab14..09bc8ae80a56 100644 --- a/addons/product/migrations/8.0.1.1/pre-migration.py +++ b/addons/product/migrations/8.0.1.1/pre-migration.py @@ -8,7 +8,7 @@ 'product_product': [ ('color', None), - ('image', None), + ('image', 'image_variant'), ], 'product_template':[ ('produce_delay', None), # need to handle in mrp migration From 2e9f1a6e66b66a7d42a15c776ec1aae1c10092d1 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 16:56:39 +0200 Subject: [PATCH 08/18] updated work analysis --- .../migrations/8.0.1.1/openupgrade_analysis_WORK.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt index 0058b626411e..b9b9f21c2548 100644 --- a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt +++ b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt @@ -45,7 +45,7 @@ product / product.supplierinfo / product_tmpl_id (many2one) : NEW re # OK seller_ids moved from product.product to product.template product / product.template / active (boolean) : NEW -# OK: copy +# OK: set to True if at least one variant is active product / product.template / color (integer) : NEW product / product.product / color (integer) : DEL @@ -54,7 +54,7 @@ product / product.product / color (integer) : DEL product / product.template / cost_method (selection) : module is now 'stock_account' ('product') product / product.template / cost_method (selection) : now a function product / product.template / cost_method (selection) : selection_keys is now '['average', 'real', 'standard']' ('['average', 'standard']') -# TODO +# nothing to do ? product / product.template / image (binary) : NEW product / product.product / image (binary) : now afunction @@ -66,7 +66,7 @@ product / product.product / image_variant (binary) : NEW product / product.template / message_ids (one2many) : NEW relation: mail.message product / product.template / message_last_post (datetime) : NEW # now product.template derives from mail template -# TODO : move up messages +# TODO : move up messages -> they will still be on the product so why bother product / product.product / message_last_post (datetime) : NEW From 978684c28ea18989d21c51f13f0e7657f869edfd Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 17:47:02 +0200 Subject: [PATCH 09/18] migration of product.packaging and product.ul --- .../8.0.1.1/openupgrade_analysis_WORK.txt | 4 ++-- .../product/migrations/8.0.1.1/post-migration.py | 16 ++++++++++++++++ .../product/migrations/8.0.1.1/pre-migration.py | 15 ++++++++------- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt index b9b9f21c2548..9dc246e0372b 100644 --- a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt +++ b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt @@ -25,8 +25,8 @@ product / product.packaging / weight_ul (float) : DEL product / product.ul / weight (float) : NEW product / product.packaging / width (float) : DEL product / product.ul / width (float) : NEW -## new relation ul_container, and the dimensions are moved there -## TODO later because rarely used feature +## OK new relation ul_container handled by migration +## OK the dimensions are weight must be moved to the related UL (through the ul field) product / product.price.history / company_id (many2one) : NEW relation: res.company, required: required, req_default: function diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index 3f61e80adcd2..fce32a75497e 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -37,10 +37,26 @@ def copy_fields(cr, pool): for variant in template.product_variant_ids) }) +def migrate_packaging(cr, pool): + """create 1 product UL for each different product packaging dimension + and link it to the packagings + """ + packaging_obj = pool['product.packaging'] + ul_obj = pool['product.ul'] + packaging_ids = packaging_obj.search(cr, SUPERUSER_ID, []) + for packaging in packaging_obj.browse(cr, SUPERUSER_ID, packaging_ids): + ul = packaging.ul + ul.write({'height': height, + 'width': width, + 'length': length, + 'weight_ul': weight, + }) + @openupgrade.migrate() def migrate(cr, version): pool = pooler.get_pool(cr.dbname) move_fields(cr, pool) copy_fields(cr, pool) + migrate_packaging(cr, pool) load_data(cr) diff --git a/addons/product/migrations/8.0.1.1/pre-migration.py b/addons/product/migrations/8.0.1.1/pre-migration.py index 09bc8ae80a56..0530e8074b93 100644 --- a/addons/product/migrations/8.0.1.1/pre-migration.py +++ b/addons/product/migrations/8.0.1.1/pre-migration.py @@ -5,21 +5,22 @@ 'product_supplierinfo': [ ('product_id', None), ], - 'product_product': - [ + 'product_product': [ ('color', None), ('image', 'image_variant'), ], - 'product_template':[ + 'product_template': [ ('produce_delay', None), # need to handle in mrp migration + ], + 'product_packaging': [ + ('height', None), + ('length', None), + ('weight_ul', None), + ('width', None), ] } -def migrate_packaging(cr): - pass # XXX @openupgrade.migrate() def migrate(cr, version): openupgrade.rename_columns(cr, column_renames) - migrate_packaging(cr) - From c6845124d0b94c136efcf2d96f3780641ba95b00 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Mon, 2 Jun 2014 17:57:58 +0200 Subject: [PATCH 10/18] migration of product_template.cost_method, moved in stock_account --- addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt | 2 +- addons/product/migrations/8.0.1.1/pre-migration.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt index 9dc246e0372b..50cda025c18e 100644 --- a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt +++ b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt @@ -54,7 +54,7 @@ product / product.product / color (integer) : DEL product / product.template / cost_method (selection) : module is now 'stock_account' ('product') product / product.template / cost_method (selection) : now a function product / product.template / cost_method (selection) : selection_keys is now '['average', 'real', 'standard']' ('['average', 'standard']') -# nothing to do ? +# moved in stock_account, now a fields.property product / product.template / image (binary) : NEW product / product.product / image (binary) : now afunction diff --git a/addons/product/migrations/8.0.1.1/pre-migration.py b/addons/product/migrations/8.0.1.1/pre-migration.py index 0530e8074b93..fb6208e1748e 100644 --- a/addons/product/migrations/8.0.1.1/pre-migration.py +++ b/addons/product/migrations/8.0.1.1/pre-migration.py @@ -11,6 +11,7 @@ ], 'product_template': [ ('produce_delay', None), # need to handle in mrp migration + ('cost_method', None), # need to handle in stock_account migration ], 'product_packaging': [ ('height', None), From 08fd7aab26349efe79bbd5a51c9ae8cad1d2e487 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 18:22:00 +0200 Subject: [PATCH 11/18] reinstall data from product moved to mrp --- addons/mrp/migrations/8.0.1.1/post-migrate.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 addons/mrp/migrations/8.0.1.1/post-migrate.py diff --git a/addons/mrp/migrations/8.0.1.1/post-migrate.py b/addons/mrp/migrations/8.0.1.1/post-migrate.py new file mode 100644 index 000000000000..d8e1cd22b2c4 --- /dev/null +++ b/addons/mrp/migrations/8.0.1.1/post-migrate.py @@ -0,0 +1,18 @@ +from openerp.openupgrade import openupgrade +from openerp import pooler, SUPERUSER_ID + +def move_fields(cr, pool): + execute = openupgrade.logged_query + queries = [ """ + UPDATE product_product + SET produce_delay=(SELECT pt.%s + FROM product_template + WHERE product_template.id=product_product.product_tmpl_id) + """ % openupgrade.get_legacy_name('produce_delay'), + + +@openupgrade.migrate() +def migrate(cr, version): + pool = pooler.get_pool(cr.dbname) + move_fields(cr, pool) + From 81da4ed74b03d6e092ebe5b68d9e73968e973ddd Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 18:37:27 +0200 Subject: [PATCH 12/18] add migration for product.packaging to template --- .../8.0.1.1/openupgrade_analysis_WORK.txt | 4 +- .../migrations/8.0.1.1/post-migration.py | 39 +++++++++++-------- .../migrations/8.0.1.1/pre-migration.py | 1 + 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt index 9dc246e0372b..17a098dd3b62 100644 --- a/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt +++ b/addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt @@ -71,10 +71,10 @@ product / product.product / message_last_post (datetime) : NEW product / product.template / packaging (one2many) : NEW relation: product.packaging -# TODO later once issue #291 is solved +# OK moved from product.product product / product.template / produce_delay (float) : DEL -# moved in mrp, defined on product.product +# OK moved in mrp, defined on product.product product / product.template / product_variant_ids (one2many): NEW relation: product.product, required: required # nothing to do? diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index fce32a75497e..a25023b9ab63 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -6,23 +6,28 @@ def load_data(cr): def move_fields(cr, pool): execute = openupgrade.logged_query - queries = [ """ - UPDATE product_supplierinfo - SET product_tmpl_id=(SELECT product_tmpl_id - FROM product_product - WHERE product_product.id=product_supplierinfo.%s) - """ % openupgrade.get_legacy_name('product_id'), - """ - UPDATE product_template as pt - SET color=(SELECT pp1.%s - FROM product_product as pp1 - WHERE pp1.product_tmpl_id=pt.id ORDER BY pp1.id LIMIT 1), - image=(SELECT pp2.image_variant - FROM product_product as pp2 - WHERE pp2.product_tmpl_id=pt.id ORDER BY pp2.id LIMIT 1) - """ % (openupgrade.get_legacy_name('color'), - ), - ] + queries = ["UPDATE product_supplierinfo " + "SET product_tmpl_id=(SELECT product_tmpl_id " + " FROM product_product " + " WHERE product_product.id=product_supplierinfo.%s) " \ + % openupgrade.get_legacy_name('product_id'), + # + "UPDATE product_template as pt " + "SET color=(SELECT pp1.%s " + " FROM product_product as pp1 " + " WHERE pp1.product_tmpl_id=pt.id ORDER BY pp1.id LIMIT 1), " + " image=(SELECT pp2.image_variant " + " FROM product_product as pp2 " + " WHERE pp2.product_tmpl_id=pt.id ORDER BY pp2.id LIMIT 1)" + " packaging=(SELECT pp3.%s " + " FROM product_product as pp3 " + " WHERE pp3.product_tmpl_id=pt.id ORDER BY pp3.id LIMIT 1)" \ + % (openupgrade.get_legacy_name('color'), + openupgrade.get_legacy_name('packaging'), + ) + # + + ] for sql in queries: execute(cr, sql) diff --git a/addons/product/migrations/8.0.1.1/pre-migration.py b/addons/product/migrations/8.0.1.1/pre-migration.py index 0530e8074b93..f5a934d22ed9 100644 --- a/addons/product/migrations/8.0.1.1/pre-migration.py +++ b/addons/product/migrations/8.0.1.1/pre-migration.py @@ -8,6 +8,7 @@ 'product_product': [ ('color', None), ('image', 'image_variant'), + ('packaging', None), ], 'product_template': [ ('produce_delay', None), # need to handle in mrp migration From dd941af6c6c5ad1fae3029b1ca8750a128c90979 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Jun 2014 18:38:49 +0200 Subject: [PATCH 13/18] fix error in previous refactoring --- .../migrations/8.0.1.1/post-migration.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index a25023b9ab63..fca7ed440f6d 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -12,13 +12,13 @@ def move_fields(cr, pool): " WHERE product_product.id=product_supplierinfo.%s) " \ % openupgrade.get_legacy_name('product_id'), # - "UPDATE product_template as pt " + "UPDATE product_template as pt " "SET color=(SELECT pp1.%s " " FROM product_product as pp1 " " WHERE pp1.product_tmpl_id=pt.id ORDER BY pp1.id LIMIT 1), " " image=(SELECT pp2.image_variant " " FROM product_product as pp2 " - " WHERE pp2.product_tmpl_id=pt.id ORDER BY pp2.id LIMIT 1)" + " WHERE pp2.product_tmpl_id=pt.id ORDER BY pp2.id LIMIT 1)" " packaging=(SELECT pp3.%s " " FROM product_product as pp3 " " WHERE pp3.product_tmpl_id=pt.id ORDER BY pp3.id LIMIT 1)" \ @@ -26,7 +26,7 @@ def move_fields(cr, pool): openupgrade.get_legacy_name('packaging'), ) # - + ] for sql in queries: execute(cr, sql) @@ -51,12 +51,12 @@ def migrate_packaging(cr, pool): packaging_ids = packaging_obj.search(cr, SUPERUSER_ID, []) for packaging in packaging_obj.browse(cr, SUPERUSER_ID, packaging_ids): ul = packaging.ul - ul.write({'height': height, - 'width': width, - 'length': length, - 'weight_ul': weight, + ul.write({'height': packaging.height, + 'width': packaging.width, + 'length': packaging.length, + 'weight_ul': packaging.weight, }) - + @openupgrade.migrate() def migrate(cr, version): pool = pooler.get_pool(cr.dbname) @@ -64,4 +64,4 @@ def migrate(cr, version): copy_fields(cr, pool) migrate_packaging(cr, pool) load_data(cr) - + From be0576e3fc51d68a2f2dcbb72223dd2450c0f5a4 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 3 Jun 2014 11:18:08 +0200 Subject: [PATCH 14/18] packaging field is o2m -> no colum renaming required --- addons/product/migrations/8.0.1.1/post-migration.py | 4 ---- addons/product/migrations/8.0.1.1/pre-migration.py | 1 - 2 files changed, 5 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index fca7ed440f6d..54d7be6f50ba 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -19,11 +19,7 @@ def move_fields(cr, pool): " image=(SELECT pp2.image_variant " " FROM product_product as pp2 " " WHERE pp2.product_tmpl_id=pt.id ORDER BY pp2.id LIMIT 1)" - " packaging=(SELECT pp3.%s " - " FROM product_product as pp3 " - " WHERE pp3.product_tmpl_id=pt.id ORDER BY pp3.id LIMIT 1)" \ % (openupgrade.get_legacy_name('color'), - openupgrade.get_legacy_name('packaging'), ) # diff --git a/addons/product/migrations/8.0.1.1/pre-migration.py b/addons/product/migrations/8.0.1.1/pre-migration.py index 3b92afeae619..fb6208e1748e 100644 --- a/addons/product/migrations/8.0.1.1/pre-migration.py +++ b/addons/product/migrations/8.0.1.1/pre-migration.py @@ -8,7 +8,6 @@ 'product_product': [ ('color', None), ('image', 'image_variant'), - ('packaging', None), ], 'product_template': [ ('produce_delay', None), # need to handle in mrp migration From c6e21ee3b9cbc7897bfb2b80c57de4a4f973c178 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 3 Jun 2014 11:32:15 +0200 Subject: [PATCH 15/18] fix packaging/ul migration --- .../migrations/8.0.1.1/post-migration.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index 54d7be6f50ba..842d498275fa 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -44,14 +44,19 @@ def migrate_packaging(cr, pool): """ packaging_obj = pool['product.packaging'] ul_obj = pool['product.ul'] - packaging_ids = packaging_obj.search(cr, SUPERUSER_ID, []) - for packaging in packaging_obj.browse(cr, SUPERUSER_ID, packaging_ids): - ul = packaging.ul - ul.write({'height': packaging.height, - 'width': packaging.width, - 'length': packaging.length, - 'weight_ul': packaging.weight, - }) + execute = openupgrade.logged_query + legacy_columns = dict((key, openupgrade.get_legacy_name(key)) + for key in ('height', 'width', + 'length', 'weight_ul')) + execute(cr, + 'select ul, %(height)s, %(width)s, %(length)s, %(weight_ul)s ' + 'from product_packaging' % legacy_columns) + for ul_id, height, width, length, weight in cr.fetchall(): + ul_obj.write(cr, SUPERUSER_ID, [ul_id], + {'height': height, + 'width': width, + 'length': weight, + }) @openupgrade.migrate() def migrate(cr, version): From 6afa1a61dc0d6da6d6132fa12afc66768f99117d Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 3 Jun 2014 11:38:35 +0200 Subject: [PATCH 16/18] re-add the change on product consultant --- addons/product/migrations/8.0.1.1/modified_data.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/product/migrations/8.0.1.1/modified_data.xml b/addons/product/migrations/8.0.1.1/modified_data.xml index 93c05c245d06..144955bcda48 100644 --- a/addons/product/migrations/8.0.1.1/modified_data.xml +++ b/addons/product/migrations/8.0.1.1/modified_data.xml @@ -17,9 +17,8 @@ ['|',('company_id','=',user.company_id.id),('company_id','=',False)] - - + + From 2f10573a29d754615e7870fc83320a6d36039198 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 3 Jun 2014 11:39:01 +0200 Subject: [PATCH 17/18] added AGPL header --- .../migrations/8.0.1.1/post-migration.py | 21 +++++++++++++++++++ .../migrations/8.0.1.1/pre-migration.py | 21 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index 842d498275fa..8fccf7e51c99 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -1,3 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Alexandre Fayolle +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + from openerp.openupgrade import openupgrade from openerp import pooler, SUPERUSER_ID diff --git a/addons/product/migrations/8.0.1.1/pre-migration.py b/addons/product/migrations/8.0.1.1/pre-migration.py index fb6208e1748e..f9ed9a211ded 100644 --- a/addons/product/migrations/8.0.1.1/pre-migration.py +++ b/addons/product/migrations/8.0.1.1/pre-migration.py @@ -1,3 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Alexandre Fayolle +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + from openerp.openupgrade import openupgrade column_renames = { From 0bbfeb698dd9a841ee7da6ce21772c776c0155c3 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 3 Jun 2014 11:48:09 +0200 Subject: [PATCH 18/18] fix typo --- addons/product/migrations/8.0.1.1/post-migration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/product/migrations/8.0.1.1/post-migration.py b/addons/product/migrations/8.0.1.1/post-migration.py index 8fccf7e51c99..78177737001e 100644 --- a/addons/product/migrations/8.0.1.1/post-migration.py +++ b/addons/product/migrations/8.0.1.1/post-migration.py @@ -76,7 +76,8 @@ def migrate_packaging(cr, pool): ul_obj.write(cr, SUPERUSER_ID, [ul_id], {'height': height, 'width': width, - 'length': weight, + 'length': length, + 'weight': weight, }) @openupgrade.migrate()