[IMP] mrp: Removed name field and renamed string of code field in mrp.bom.

This commit is contained in:
Ravi Patel
2015-08-27 15:03:47 +02:00
committed by David Monjoie
parent 11c12b56b6
commit 5c4dfeb190
9 changed files with 20 additions and 31 deletions
+11 -4
View File
@@ -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"
-13
View File
@@ -242,7 +242,6 @@
<record id="mrp_bom_1" model="mrp.bom">
<field name="name">HDD 500GB</field>
<field name="product_tmpl_id" ref="product.product_product_18_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
@@ -260,7 +259,6 @@
</record>
<record id="mrp_bom_2" model="mrp.bom">
<field name="name">HDD 2TB on Demand</field>
<field name="product_tmpl_id" ref="product.product_product_19_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
@@ -278,7 +276,6 @@
</record>
<record id="mrp_bom_3" model="mrp.bom">
<field name="name">HDD on Demand</field>
<field name="product_tmpl_id" ref="product.product_product_19_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">10</field>
@@ -295,7 +292,6 @@
</record>
<record id="mrp_bom_4" model="mrp.bom">
<field name="name">Laptop Customized</field>
<field name="product_tmpl_id" ref="product.product_product_27_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
@@ -331,7 +327,6 @@
</record>
<record id="mrp_bom_5" model="mrp.bom">
<field name="name">Laptop Customized + Azerty</field>
<field name="product_tmpl_id" ref="product.product_product_27_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">10</field>
@@ -366,7 +361,6 @@
</record>
<record id="mrp_bom_6" model="mrp.bom">
<field name="name">Computer Case-1</field>
<field name="product_tmpl_id" ref="product.product_product_16_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
@@ -401,7 +395,6 @@
</record>
<record id="mrp_bom_7" model="mrp.bom">
<field name="name">Computer Case-2</field>
<field name="product_tmpl_id" ref="product.product_product_16_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">10</field>
@@ -445,7 +438,6 @@
</record>
<record id="mrp_bom_8" model="mrp.bom">
<field name="name">PC Assemble + 2GB RAM</field>
<field name="product_tmpl_id" ref="product.product_product_3_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
@@ -453,7 +445,6 @@
</record>
<record id="mrp_bom_property_0" model="mrp.bom">
<field name="name">PC Assemble + DDR 512MB</field>
<field name="product_tmpl_id" ref="product.product_product_3_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
@@ -462,7 +453,6 @@
</record>
<record id="mrp_bom_property_line" model="mrp.bom">
<field name="name">RAM SR2 PLUS</field>
<field name="product_id" ref="product.product_product_14"/>
<field name="product_tmpl_id" ref="product.product_product_14_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
@@ -517,7 +507,6 @@
</record>
<record id="mrp_bom_9" model="mrp.bom">
<field name="name">PC Assemble + 512MB RAM</field>
<field name="product_tmpl_id" ref="product.product_product_3_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">4</field>
@@ -571,7 +560,6 @@
</record>
<record id="mrp_bom_10" model="mrp.bom">
<field name="name">PC Assemble + Custom RAM (PC on Demand)</field>
<field name="product_tmpl_id" ref="product.product_product_5_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
@@ -625,7 +613,6 @@
</record>
<record id="mrp_bom_11" model="mrp.bom">
<field name="name">iPad Retina Display</field>
<field name="product_tmpl_id" ref="product.product_product_4_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">1</field>
+4 -4
View File
@@ -388,8 +388,7 @@
</div>
</group>
<group>
<field name="name"/>
<field name="code" string="Reference"/>
<field name="code" string="Recipe"/>
<field name="type" widget="radio"/>
<p colspan="2" class="oe_grey" attrs="{'invisible': [('type','=','normal')]}">
When processing a sales order for this product, the delivery order
@@ -452,7 +451,8 @@
<field name="model">mrp.bom</field>
<field name="arch" type="xml">
<tree string="Bill of Materials">
<field name="name"/>
<field name="display_name"/>
<field name="product_tmpl_id"/>
<field name="product_id" groups="product.group_product_variant"/>
</tree>
</field>
@@ -462,7 +462,7 @@
<field name="model">mrp.bom</field>
<field name="arch" type="xml">
<search string="Search Bill Of Material">
<field name="name" string="Bill Of Material" filter_domain="['|',('name','ilike',self),('code','ilike',self)]"/>
<field name="code" string="Recipe"/>
<field name="bom_line_ids" string="Components"/>
<field name="product_tmpl_id" string="Product"/>
<field name="product_id" string="Variant"/>
@@ -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
+1 -1
View File
@@ -19,7 +19,7 @@
<tr style="font-weight: bold;">
<td>
<span t-field="o.product_id.default_code"/>
<span t-field="o.name"/>
<span t-field="o.display_name"/>
</td>
<td>
<span t-field="o.product_qty"/>
@@ -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
@@ -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
-1
View File
@@ -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
+4 -5
View File
@@ -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')
# ----------------------------------------