diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 8a25af01e7b..ed3872a855a 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -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