[MERGE] OPW 575424: mrp: error on analytic entries when workcenter has no product
bzr revid: odo@openerp.com-20120601143249-xkk2iog1l22kmz82
This commit is contained in:
commit
e8ab2c3ae5
|
@ -786,6 +786,7 @@ class mrp_production(osv.osv):
|
|||
for wc_line in production.workcenter_lines:
|
||||
wc = wc_line.workcenter_id
|
||||
if wc.costs_journal_id and wc.costs_general_account_id:
|
||||
# Cost per hour
|
||||
value = wc_line.hour * wc.costs_hour
|
||||
account = wc.costs_hour_account_id.id
|
||||
if value and account:
|
||||
|
@ -799,9 +800,9 @@ class mrp_production(osv.osv):
|
|||
'ref': wc.code,
|
||||
'product_id': wc.product_id.id,
|
||||
'unit_amount': wc_line.hour,
|
||||
'product_uom_id': wc.product_id.uom_id.id
|
||||
'product_uom_id': wc.product_id and wc.product_id.uom_id.id or False
|
||||
} )
|
||||
if wc.costs_journal_id and wc.costs_general_account_id:
|
||||
# Cost per cycle
|
||||
value = wc_line.cycle * wc.costs_cycle
|
||||
account = wc.costs_cycle_account_id.id
|
||||
if value and account:
|
||||
|
@ -815,7 +816,7 @@ class mrp_production(osv.osv):
|
|||
'ref': wc.code,
|
||||
'product_id': wc.product_id.id,
|
||||
'unit_amount': wc_line.cycle,
|
||||
'product_uom_id': wc.product_id.uom_id.id
|
||||
'product_uom_id': wc.product_id and wc.product_id.uom_id.id or False
|
||||
} )
|
||||
return amount
|
||||
|
||||
|
|
Loading…
Reference in New Issue