Adapt to new update_cost_type signatura.

This commit is contained in:
Albert Cervera i Areny 2014-03-19 02:01:00 +01:00
parent a176f09315
commit 07a248ae1e
1 changed files with 4 additions and 8 deletions

12
plan.py
View File

@ -13,7 +13,8 @@ class PlanOperationLine(ModelSQL, ModelView):
'Product Cost Plan Operation Line'
__name__ = 'product.cost.plan.operation_line'
plan = fields.Many2One('product.cost.plan', 'Plan', required=True)
plan = fields.Many2One('product.cost.plan', 'Plan', required=True,
ondelete='CASCADE')
sequence = fields.Integer('Sequence')
work_center = fields.Many2One('production.work_center', 'Work Center')
work_center_category = fields.Many2One('production.work_center.category',
@ -165,14 +166,9 @@ class Plan:
return cost
def on_change_operations(self):
pool = Pool()
CostType = pool.get('product.cost.plan.cost.type')
ModelData = pool.get('ir.model.data')
type_ = CostType(ModelData.get_id('product_cost_plan_operation',
'operations'))
self.operation_cost = sum(o.cost for o in self.operations if o.cost)
return self.update_cost_type(type_, self.operation_cost)
return self.update_cost_type('product_cost_plan_operation',
'operations', self.operation_cost)
@classmethod
def get_cost_types(cls):