[FIX] project_mrp: procurement of service product should not be closed without task
bzr revid: hmo@tinyerp.com-20111214102933-vmzwp6hxrds9dqw3
This commit is contained in:
parent
5910e38001
commit
1ca40d12ff
|
@ -4,7 +4,7 @@
|
|||
<record id="trans_make_done_done2" model="workflow.transition">
|
||||
<field name="act_from" ref="procurement.act_make_done"/>
|
||||
<field name="act_to" ref="procurement.act_done"/>
|
||||
<field name="condition">check_task_done()</field>
|
||||
<field name="condition">action_check_finished()</field>
|
||||
<field name="trigger_model">project.task</field>
|
||||
<field name="trigger_expr_id">task_id and [task_id.id] or []</field>
|
||||
</record>
|
||||
|
|
|
@ -28,6 +28,10 @@ class procurement_order(osv.osv):
|
|||
'task_id': fields.many2one('project.task', 'Task'),
|
||||
'sale_line_id': fields.many2one('sale.order.line', 'Sale order line')
|
||||
}
|
||||
|
||||
def action_check_finished(self, cr, uid, ids):
|
||||
res = super(procurement_order, self).action_check_finished(cr, uid, ids)
|
||||
return res and self.check_task_done(cr, uid, ids)
|
||||
|
||||
def check_task_done(self, cr, uid, ids, context=None):
|
||||
""" Checks if task is done or not.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
procurement_ids = self.search(cr, uid, [('sale_line_id', '=', ref('line_services'))])
|
||||
assert procurement_ids, "Procurement is not generated for Service Order Line."
|
||||
procurement = self.browse(cr, uid, procurement_ids[0], context=context)
|
||||
assert procurement.state != 'done' , "Procurement should not be closed."
|
||||
task = procurement.task_id
|
||||
assert task, "Task is not generated."
|
||||
planned_hours = self._convert_qty_company_hours(cr, uid, procurement, context=context)
|
||||
|
|
Loading…
Reference in New Issue