From 5c4dfeb19038bcf22948c135976c7f07b67e5935 Mon Sep 17 00:00:00 2001 From: Ravi Patel Date: Fri, 17 Jul 2015 12:10:29 +0530 Subject: [PATCH] [IMP] mrp: Removed name field and renamed string of code field in mrp.bom. --- addons/mrp/mrp.py | 15 +++++++++++---- addons/mrp/mrp_demo.xml | 13 ------------- addons/mrp/mrp_view.xml | 8 ++++---- addons/mrp/test/bom_with_service_type_product.yml | 1 - addons/mrp/views/report_mrpbomstructure.xml | 2 +- addons/mrp_byproduct/test/mrp_byproduct.yml | 1 - addons/sale_mrp/test/cancellation_propagated.yml | 1 - addons/sale_mrp/test/sale_mrp.yml | 1 - addons/sale_mrp/tests/test_sale_mrp_flow.py | 9 ++++----- 9 files changed, 20 insertions(+), 31 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index e7a67a25539..59e81b14879 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -154,8 +154,7 @@ class mrp_bom(osv.osv): return self.pool['mrp.bom'].search(cr, uid, [('product_tmpl_id', 'in', product_template_ids)], context=context) _columns = { - 'name': fields.char('Name'), - 'code': fields.char('Reference', size=16), + 'code': fields.char('Recipe', size=16), 'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the bills of material without removing it."), 'type': fields.selection([('normal','Manufacture this product'),('phantom','Ship this product as a set of components (kit)')], 'BoM Type', required=True, help= "Set: When processing a sales order for this product, the delivery order will contain the raw materials, instead of the finished product."), @@ -344,7 +343,7 @@ class mrp_bom(osv.osv): if default is None: default = {} bom_data = self.read(cr, uid, id, [], context=context) - default.update(name=_("%s (copy)") % (bom_data['name'])) + default.update(name=_("%s (copy)") % (bom_data['display_name'])) return super(mrp_bom, self).copy_data(cr, uid, id, default, context=context) def onchange_uom(self, cr, uid, ids, product_tmpl_id, product_uom, context=None): @@ -372,11 +371,19 @@ class mrp_bom(osv.osv): if product_tmpl_id: prod = self.pool.get('product.template').browse(cr, uid, product_tmpl_id, context=context) res['value'] = { - 'name': prod.name, 'product_uom': prod.uom_id.id, } return res + def name_get(self, cr, uid, ids, context=None): + res = [] + for record in self.browse(cr, uid, ids, context=context): + name = record.product_tmpl_id.name + if record.code: + name = '[%s] %s' % (record.code, name) + res.append((record.id, name)) + return res + class mrp_bom_line(osv.osv): _name = 'mrp.bom.line' _order = "sequence" diff --git a/addons/mrp/mrp_demo.xml b/addons/mrp/mrp_demo.xml index 77b7ad4f2f6..70a7bc0788a 100644 --- a/addons/mrp/mrp_demo.xml +++ b/addons/mrp/mrp_demo.xml @@ -242,7 +242,6 @@ - HDD 500GB 5 @@ -260,7 +259,6 @@ - HDD 2TB on Demand 5 @@ -278,7 +276,6 @@ - HDD on Demand 10 @@ -295,7 +292,6 @@ - Laptop Customized 5 @@ -331,7 +327,6 @@ - Laptop Customized + Azerty 10 @@ -366,7 +361,6 @@ - Computer Case-1 5 @@ -401,7 +395,6 @@ - Computer Case-2 10 @@ -445,7 +438,6 @@ - PC Assemble + 2GB RAM 5 @@ -453,7 +445,6 @@ - PC Assemble + DDR 512MB 5 @@ -462,7 +453,6 @@ - RAM SR2 PLUS @@ -517,7 +507,6 @@ - PC Assemble + 512MB RAM 4 @@ -571,7 +560,6 @@ - PC Assemble + Custom RAM (PC on Demand) 5 @@ -625,7 +613,6 @@ - iPad Retina Display 1 diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index f43e42d068b..701ab72fdbe 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -388,8 +388,7 @@ - - +

When processing a sales order for this product, the delivery order @@ -452,7 +451,8 @@ mrp.bom - + + @@ -462,7 +462,7 @@ mrp.bom - + diff --git a/addons/mrp/test/bom_with_service_type_product.yml b/addons/mrp/test/bom_with_service_type_product.yml index b2b807d7fae..1fd5c832a4f 100644 --- a/addons/mrp/test/bom_with_service_type_product.yml +++ b/addons/mrp/test/bom_with_service_type_product.yml @@ -3,7 +3,6 @@ - !record {model: mrp.bom, id: mrp_bom_test1}: company_id: base.main_company - name: PC Assemble SC234 product_tmpl_id: product.product_product_3_product_template product_id: product.product_product_3 product_uom: product.product_uom_unit diff --git a/addons/mrp/views/report_mrpbomstructure.xml b/addons/mrp/views/report_mrpbomstructure.xml index f6360764597..f1ad7090f77 100644 --- a/addons/mrp/views/report_mrpbomstructure.xml +++ b/addons/mrp/views/report_mrpbomstructure.xml @@ -19,7 +19,7 @@ - + diff --git a/addons/mrp_byproduct/test/mrp_byproduct.yml b/addons/mrp_byproduct/test/mrp_byproduct.yml index ac1a114ef15..758a7fc2efd 100644 --- a/addons/mrp_byproduct/test/mrp_byproduct.yml +++ b/addons/mrp_byproduct/test/mrp_byproduct.yml @@ -6,7 +6,6 @@ - !record {model: mrp.bom, id: mrp.mrp_bom_9}: product_id: product.product_product_28 - name: External Hard Disk + Subproduct product_uom: product.product_uom_unit sub_products: - product_id: product.product_product_33 diff --git a/addons/sale_mrp/test/cancellation_propagated.yml b/addons/sale_mrp/test/cancellation_propagated.yml index 6a5c557a958..0d72e3d9f3e 100644 --- a/addons/sale_mrp/test/cancellation_propagated.yml +++ b/addons/sale_mrp/test/cancellation_propagated.yml @@ -20,7 +20,6 @@ - !record {model: mrp.bom, id: mrp_bom_test1}: company_id: base.main_company - name: My BOM product_tmpl_id: product_manu_product_template product_id: product_manu product_uom: product.product_uom_unit diff --git a/addons/sale_mrp/test/sale_mrp.yml b/addons/sale_mrp/test/sale_mrp.yml index 442b341bb08..023bdae08f4 100644 --- a/addons/sale_mrp/test/sale_mrp.yml +++ b/addons/sale_mrp/test/sale_mrp.yml @@ -52,7 +52,6 @@ - !record {model: mrp.bom, id: mrp_bom_slidermobile0}: company_id: base.main_company - name: Slider Mobile product_efficiency: 1.0 product_tmpl_id: product_product_slidermobile0_product_template product_id: product_product_slidermobile0 diff --git a/addons/sale_mrp/tests/test_sale_mrp_flow.py b/addons/sale_mrp/tests/test_sale_mrp_flow.py index 3f5b10c7ccc..91696286168 100644 --- a/addons/sale_mrp/tests/test_sale_mrp_flow.py +++ b/addons/sale_mrp/tests/test_sale_mrp_flow.py @@ -50,9 +50,8 @@ class TestSaleMrpFlow(common.TransactionCase): 'bom_id': bom_id, 'product_uom': uom_id}) - def create_bom(name, product_tmpl_id, qty, uom_id, bom_type): + def create_bom(product_tmpl_id, qty, uom_id, bom_type): return self.MrpBom.create({ - 'name': name, 'product_tmpl_id': product_tmpl_id, 'product_qty': qty, 'type': bom_type, @@ -97,18 +96,18 @@ class TestSaleMrpFlow(common.TransactionCase): # ------------------------------------------------------------------------------------------ # Bill of materials for Product A. - bom_a = create_bom(product_a.name, product_a.product_tmpl_id.id, 2, self.uom_dozen.id, 'normal') + bom_a = create_bom(product_a.product_tmpl_id.id, 2, self.uom_dozen.id, 'normal') create_bom_lines(bom_a.id, product_b.id, 3, self.uom_unit.id, 'phantom') create_bom_lines(bom_a.id, product_c.id, 300.5, self.uom_gm.id, 'normal') create_bom_lines(bom_a.id, product_d.id, 4, self.uom_unit.id, 'phantom') create_bom_lines(bom_a.id, product_d.id, 4, self.uom_unit.id, 'normal') # Bill of materials for Product B. - bom_b = create_bom(product_b.name, product_b.product_tmpl_id.id, 1, self.uom_unit.id, 'phantom') + bom_b = create_bom(product_b.product_tmpl_id.id, 1, self.uom_unit.id, 'phantom') create_bom_lines(bom_b.id, product_c.id, 0.400, self.uom_kg.id, 'normal') # Bill of materials for Product D. - bom_d = create_bom(product_d.name, product_d.product_tmpl_id.id, 1, self.uom_unit.id, 'normal') + bom_d = create_bom(product_d.product_tmpl_id.id, 1, self.uom_unit.id, 'normal') create_bom_lines(bom_d.id, product_c.id, 1, self.uom_kg.id, 'normal') # ----------------------------------------