Add name field to product.cost.plan.product_line.

This commit is contained in:
Albert Cervera i Areny 2014-02-19 12:16:21 +01:00
parent b7fbaefb53
commit 5e4f2359d1
2 changed files with 6 additions and 1 deletions

View File

@ -269,12 +269,13 @@ class Plan(Workflow, ModelSQL, ModelView):
Input = pool.get('production.bom.input')
quantity = Input.compute_quantity(input_, factor)
return {
'name': input_.product.rec_name,
'product': input_.product.id,
'quantity': quantity,
'uom': input_.uom.id,
'product_cost_price': input_.product.cost_price,
'cost_price': input_.product.cost_price,
}
}
class PlanBOM(ModelSQL, ModelView):
@ -293,6 +294,7 @@ class PlanProductLine(ModelSQL, ModelView):
'Product Cost Plan Product Line'
__name__ = 'product.cost.plan.product_line'
name = fields.Char('Name', required=True)
plan = fields.Many2One('product.cost.plan', 'Plan', required=True,
ondelete='CASCADE')
product = fields.Many2One('product.product', 'Product',
@ -328,11 +330,13 @@ class PlanProductLine(ModelSQL, ModelView):
uoms = self.product.default_uom.category.uoms
if (not self.uom or self.uom not in uoms):
# TODO: Convert price to UoM
res['name'] = self.product.rec_name
res['uom'] = self.product.default_uom.id
res['uom.rec_name'] = self.product.default_uom.rec_name
res['product_cost_price'] = self.product.cost_price
res['cost_price'] = self.product.cost_price
else:
res['name'] = None
res['uom'] = None
res['uom.rec_name'] = ''
res['product_cost_price'] = None

View File

@ -3,6 +3,7 @@
copyright notices and license terms. -->
<tree string="Product Cost Plan Product Line" editable="bottom">
<field name="plan"/>
<field name="name"/>
<field name="product"/>
<field name="quantity"/>
<field name="uom"/>