From 670664ebe82b49366e1dd89cb9c2900ba595fc8c Mon Sep 17 00:00:00 2001 From: SodexisTeam Date: Wed, 25 Sep 2019 18:16:37 +0530 Subject: [PATCH] [12.0][FIX] action_cancel resets the workflow If someone cancel the invoice reset the "automated workflow" to null to make sure it is not processed anymore. --- sale_automatic_workflow/models/account_invoice.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sale_automatic_workflow/models/account_invoice.py b/sale_automatic_workflow/models/account_invoice.py index e822facbebbf..8be06fda4b99 100644 --- a/sale_automatic_workflow/models/account_invoice.py +++ b/sale_automatic_workflow/models/account_invoice.py @@ -13,3 +13,10 @@ class AccountInvoice(models.Model): comodel_name='sale.workflow.process', string='Sale Workflow Process' ) + + @api.multi + def action_cancel(self): + for inv in self: + if inv.workflow_process_id: + inv.workflow_process_id = None + return super(AccountInvoice, self).action_cancel()