diff --git a/addons/project_mrp/project_mrp_workflow.xml b/addons/project_mrp/project_mrp_workflow.xml index c62c5b4626e..18962cde0ee 100644 --- a/addons/project_mrp/project_mrp_workflow.xml +++ b/addons/project_mrp/project_mrp_workflow.xml @@ -4,7 +4,7 @@ - check_task_done() + action_check_finished() project.task task_id and [task_id.id] or [] diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py index 23e288973c2..7cb9d6ea590 100644 --- a/addons/project_mrp/project_procurement.py +++ b/addons/project_mrp/project_procurement.py @@ -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. diff --git a/addons/project_mrp/test/project_task_procurement.yml b/addons/project_mrp/test/project_task_procurement.yml index 81db4525d14..dc613146822 100644 --- a/addons/project_mrp/test/project_task_procurement.yml +++ b/addons/project_mrp/test/project_task_procurement.yml @@ -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)