mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] mrp_production_estimated_cost: Cost load in positive + sumatory values
This commit is contained in:
committed by
Oihane Crucelaegui
parent
9304baf440
commit
0239325504
@@ -25,16 +25,16 @@ class MrpProduction(models.Model):
|
||||
@api.depends('analytic_line_ids', 'analytic_line_ids.estim_std_cost',
|
||||
'product_qty')
|
||||
def get_unit_std_cost(self):
|
||||
self.std_cost = sum([line.estim_std_cost for line in
|
||||
self.analytic_line_ids])
|
||||
self.std_cost = -(sum([line.estim_std_cost for line in
|
||||
self.analytic_line_ids]))
|
||||
self.unit_std_cost = self.std_cost / self.product_qty
|
||||
|
||||
@api.one
|
||||
@api.depends('analytic_line_ids', 'analytic_line_ids.estim_avg_cost',
|
||||
'product_qty')
|
||||
def get_unit_avg_cost(self):
|
||||
self.avg_cost = sum([line.estim_avg_cost for line in
|
||||
self.analytic_line_ids])
|
||||
self.avg_cost = -(sum([line.estim_avg_cost for line in
|
||||
self.analytic_line_ids]))
|
||||
self.unit_avg_cost = self.avg_cost / self.product_qty
|
||||
|
||||
@api.one
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
<field name="product_id"/>
|
||||
</field>
|
||||
<field name="journal_id" position="after">
|
||||
<field name="estim_std_cost" />
|
||||
<field name="estim_avg_cost" />
|
||||
<field name="estim_std_cost" sum="Estim. AVG"/>
|
||||
<field name="estim_avg_cost" sum="Estim. STD"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -41,8 +41,8 @@
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="estim_avg_cost"/>
|
||||
<field name="estim_std_cost"/>
|
||||
<field name="estim_avg_cost" sum="Estim. AVG"/>
|
||||
<field name="estim_std_cost" sum="Estim. STD"/>
|
||||
<field name="amount"/>
|
||||
<field name="unit_amount"/>
|
||||
<field name="account_id"/>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</button>
|
||||
<button name="action_cancel" position="after">
|
||||
<button name="calculate_production_estimated_cost" states="draft,ready,in_production" string="Create Estimated Costs" type="object"/>
|
||||
<button name="load_product_std_price" string="Load Cost on Product" type="object" attrs="{'invisible':[('std_cost', '=', 0)]}"/>
|
||||
<button name="load_product_std_price" string="Load Estimated Cost on Product" type="object" attrs="{'invisible':[('std_cost', '=', 0)]}"/>
|
||||
</button>
|
||||
<group string="Manufacturing costs" position="inside">
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user