[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`.
This commit is contained in:
Benjamin Frantzen (bfr)
2021-07-16 09:05:43 +00:00
parent 9e1e0ebb02
commit e615d4ad8b
3 changed files with 11 additions and 4 deletions
@@ -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()
@@ -33,10 +33,10 @@
<field name="edi_error_count" invisible="1" />
<div class="alert alert-info" role="alert" style="margin-bottom:0px;"
attrs="{'invisible': ['|', ('edi_web_services_to_process', 'in', ['', False]), ('state', '=', 'draft')]}">
<div>The invoice will be sent asynchronously to :
<div>The invoice will be processed asynchronously by the following E-invoicing service :
<field name="edi_web_services_to_process" class="oe_inline"/>
</div>
<button name="action_process_edi_web_services" type="object" class="oe_link" string="Send now" />
<button name="action_process_edi_web_services" type="object" class="oe_link" string="Process now" />
</div>
<div class="alert alert-danger" role="alert" style="margin-bottom:0px;"
attrs="{'invisible': ['|', ('edi_error_count', '=', 0), ('edi_blocking_level', '!=', 'error')]}">
@@ -19,10 +19,10 @@
<field name="edi_error_count" invisible="1" />
<div class="alert alert-info" role="alert" style="margin-bottom:0px;"
attrs="{'invisible': ['|', ('edi_web_services_to_process', 'in', ['', False]), ('state', '=', 'draft')]}">
<div>The payment will be sent asynchronously to :
<div>The payment will be processed asynchronously by the following E-invoicing service :
<field name="edi_web_services_to_process" class="oe_inline"/>
</div>
<button name="action_process_edi_web_services" type="object" class="oe_link" string="Send now"/>
<button name="action_process_edi_web_services" type="object" class="oe_link" string="Process now"/>
</div>
<div class="alert alert-danger" role="alert" style="margin-bottom:0px;"
attrs="{'invisible': ['|', ('edi_error_count', '=', 0), ('edi_blocking_level', '!=', 'error')]}">