From e615d4ad8b77f28d10706b61c5bd82c9aa0bd31f Mon Sep 17 00:00:00 2001 From: "Benjamin Frantzen (bfr)" Date: Thu, 25 Feb 2021 07:38:43 +0000 Subject: [PATCH] [IMP] account_edi: added hook when retrying EDI & reword some text In some cases, non-generic operation needs to be done when retrying to process and edi.document. For example : for web-services with two steps, if there is an error we need to restart the two steps (and therefore reset the internal state of the edi to the first step, typically by deleting the transaction_id). In case of a warning, we want to retry the second step. This can only be done in the non-generic part of the code, so a hook is added in `account.move`. --- addons/account_edi/models/account_move.py | 7 +++++++ addons/account_edi/views/account_move_views.xml | 4 ++-- addons/account_edi/views/account_payment_views.xml | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/account_edi/models/account_move.py b/addons/account_edi/models/account_move.py index 05eea94a60c..5a89eb626fb 100644 --- a/addons/account_edi/models/account_move.py +++ b/addons/account_edi/models/account_move.py @@ -508,7 +508,14 @@ class AccountMove(models.Model): docs = self.edi_document_ids.filtered(lambda d: d.state in ('to_send', 'to_cancel') and d.blocking_level != 'error') docs._process_documents_web_services() + def _retry_edi_documents_error_hook(self): + ''' Hook called when edi_documents are retried. For example, when it's needed to clean a field. + TO OVERRIDE + ''' + return + def action_retry_edi_documents_error(self): + self._retry_edi_documents_error_hook() self.edi_document_ids.write({'error': False, 'blocking_level': False}) self.action_process_edi_web_services() diff --git a/addons/account_edi/views/account_move_views.xml b/addons/account_edi/views/account_move_views.xml index 9f3d07d5d97..7a17d2afe06 100644 --- a/addons/account_edi/views/account_move_views.xml +++ b/addons/account_edi/views/account_move_views.xml @@ -33,10 +33,10 @@