[FIX] account_peppol: commit after updating the move
When using the Send & Print wizard in invoice_single, the error is raised if any making all changes rollbacked including the update of the 'peppol_move_state'. closes odoo/odoo#125302 X-original-commit: ec1209c2853ead82bcf27728612d1a7efc6dc97a Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import _, api, fields, models, tools, Command
|
||||
from odoo import _, api, fields, models, modules, tools, Command
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools.misc import get_lang
|
||||
|
||||
@@ -483,6 +483,14 @@ class AccountMoveSend(models.Model):
|
||||
**mail_params,
|
||||
)
|
||||
|
||||
def _can_commit(self):
|
||||
""" Helper to know if we can commit the current transaction or not.
|
||||
|
||||
:return: True if commit is accepted, False otherwise.
|
||||
"""
|
||||
self.ensure_one()
|
||||
return not tools.config['test_enable'] and not modules.module.current_test
|
||||
|
||||
def _call_web_service(self, invoices_data):
|
||||
# TO OVERRIDE
|
||||
self.ensure_one()
|
||||
|
||||
@@ -178,3 +178,6 @@ class AccountMoveSend(models.Model):
|
||||
invoices |= invoice
|
||||
log_message = _('The document has been sent to the Peppol Access Point for processing')
|
||||
invoices._message_log_batch(bodies=dict((invoice.id, log_message) for invoice in invoices_data_peppol))
|
||||
|
||||
if self._can_commit():
|
||||
self._cr.commit()
|
||||
|
||||
Reference in New Issue
Block a user