[FIX] l10n_es_edi: no commits in tests
When processing web services for test purposes, use with_commit=False Avoids multiple potential psycopg2 errors closes odoo/odoo#90546 X-original-commit: a08d09e0e12d026b27a7a8434edcac0aa6b3c501 Signed-off-by: Laurent Smet <las@odoo.com> Signed-off-by: Stanislas Gueniffey (stgu) <stgu@odoo.com>
This commit is contained in:
@@ -617,9 +617,9 @@ class AccountMove(models.Model):
|
||||
# Business operations
|
||||
####################################################
|
||||
|
||||
def action_process_edi_web_services(self):
|
||||
def action_process_edi_web_services(self, with_commit=True):
|
||||
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()
|
||||
docs._process_documents_web_services(with_commit=with_commit)
|
||||
|
||||
def _retry_edi_documents_error_hook(self):
|
||||
''' Hook called when edi_documents are retried. For example, when it's needed to clean a field.
|
||||
|
||||
@@ -53,7 +53,7 @@ class TestEdiWebServices(TestEsEdiCommon):
|
||||
def test_edi_aeat(self):
|
||||
self.env.company.l10n_es_edi_tax_agency = 'aeat'
|
||||
|
||||
self.moves.action_process_edi_web_services()
|
||||
self.moves.action_process_edi_web_services(with_commit=False)
|
||||
generated_files = self._process_documents_web_services(self.moves, {'es_sii'})
|
||||
self.assertTrue(generated_files)
|
||||
self.assertRecordValues(self.out_invoice, [{'edi_state': 'sent'}])
|
||||
@@ -62,7 +62,7 @@ class TestEdiWebServices(TestEsEdiCommon):
|
||||
def test_edi_gipuzkoa(self):
|
||||
self.env.company.l10n_es_edi_tax_agency = 'gipuzkoa'
|
||||
|
||||
self.moves.action_process_edi_web_services()
|
||||
self.moves.action_process_edi_web_services(with_commit=False)
|
||||
generated_files = self._process_documents_web_services(self.moves, {'es_sii'})
|
||||
self.assertTrue(generated_files)
|
||||
self.assertRecordValues(self.out_invoice, [{'edi_state': 'sent'}])
|
||||
@@ -71,7 +71,7 @@ class TestEdiWebServices(TestEsEdiCommon):
|
||||
def test_edi_bizkaia(self):
|
||||
self.env.company.l10n_es_edi_tax_agency = 'bizkaia'
|
||||
|
||||
self.moves.action_process_edi_web_services()
|
||||
self.moves.action_process_edi_web_services(with_commit=False)
|
||||
generated_files = self._process_documents_web_services(self.moves, {'es_sii'})
|
||||
self.assertTrue(generated_files)
|
||||
self.assertRecordValues(self.out_invoice, [{'edi_state': 'sent'}])
|
||||
|
||||
Reference in New Issue
Block a user