From edcbf067d65910c58f08e1e64f9aec2decd4d5aa Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 10 Mar 2015 19:16:07 +0100 Subject: [PATCH] [FIX] workflow.workitem: deleting a subflow should never cascade to workitems It's always dangerous because (cascade-)deleting workitems has a great chance of killing the workflow instances they belong to, putting the records in the workflow limbo permanently. (They will appear stuck as they don't have enough workitems anymore) In addition, in some rare cases a subflow activity is converted into a regular activity during an update, and nullifying the `subflow_id` column is all there is to fixing the corresponding workitems. It will simply take them out of their subflow, and back into the main flow. This is the case for the modification of the purchase.order workflow in Odoo 8 (saas-5), for the picking subflow. --- openerp/addons/base/ir/workflow/workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/workflow/workflow.py b/openerp/addons/base/ir/workflow/workflow.py index cfef52a7b88..dc1fc9afb79 100644 --- a/openerp/addons/base/ir/workflow/workflow.py +++ b/openerp/addons/base/ir/workflow/workflow.py @@ -157,7 +157,7 @@ class wkf_workitem(osv.osv): _columns = { 'act_id': fields.many2one('workflow.activity', 'Activity', required=True, ondelete="cascade", select=True), 'wkf_id': fields.related('act_id','wkf_id', type='many2one', relation='workflow', string='Workflow'), - 'subflow_id': fields.many2one('workflow.instance', 'Subflow', ondelete="cascade", select=True), + 'subflow_id': fields.many2one('workflow.instance', 'Subflow', ondelete="set null", select=True), 'inst_id': fields.many2one('workflow.instance', 'Instance', required=True, ondelete="cascade", select=True), 'state': fields.char('Status', size=64, select=True), }