[IMP] mrp_production_project_estimated_cost: Show "Estimated Average Cost" field in mrp.production tree view.

[IMP] mrp_production_real_cost: Show "Total Real Cost" field in mrp.production tree view.
This commit is contained in:
alfredoavanzosc
2015-09-10 12:11:35 +02:00
committed by Pedro M. Baeza
parent ec923b14d0
commit 44b2fa7713
2 changed files with 20 additions and 0 deletions

View File

@@ -36,10 +36,19 @@ class MrpProduction(models.Model):
self.real_cost = self.calc_mrp_real_cost()
self.unit_real_cost = self.real_cost / self.product_qty
@api.one
@api.depends('avg_cost', 'real_cost')
def get_percentage_difference(self):
self.percentage_difference = 0
if self.avg_cost and self.real_cost:
self.percentage_difference = (self.real_cost * 100 / self.avg_cost)
real_cost = fields.Float("Total Real Cost", compute="get_real_cost",
store=True)
unit_real_cost = fields.Float("Unit Real Cost", compute="get_real_cost",
store=True)
percentage_difference = fields.Float(
"% difference", compute="get_percentage_difference", store=True)
@api.multi
def action_production_end(self):

View File

@@ -12,5 +12,16 @@
</field>
</field>
</record>
<record id="mrp_production_tree_view_inh_realcost" model="ir.ui.view">
<field name="name">mrp.production.tree.view.inh.realcost</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp_production_project_estimated_cost.mrp_production_tree_view_inh_estimatedcost"/>
<field name="arch" type="xml">
<field name="avg_cost" position="after">
<field name="real_cost" />
<field name="percentage_difference" />
</field>
</field>
</record>
</data>
</openerp>