[FIX] l10n_it_edi: fix test_ir_mail_server (test_receive_signed_invoice_bill)

closes odoo/odoo#72147

X-original-commit: 3370bb9bf77e76dad4fd72fe7eda3820a3849f5e
Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit is contained in:
Benjamin Frantzen (bfr)
2021-06-14 17:11:27 +00:00
parent c1f97a367f
commit 1ad0a8ce5e
2 changed files with 10 additions and 8 deletions
@@ -288,7 +288,7 @@ class AccountEdiFormat(models.Model):
if elements:
date_str = elements[0].text
date_obj = datetime.strptime(date_str, DEFAULT_FACTUR_ITALIAN_DATE_FORMAT)
invoice_form.invoice_date = date_obj.strftime(DEFAULT_FACTUR_ITALIAN_DATE_FORMAT)
invoice_form.invoice_date = date_obj
# Dati Bollo. <2.1.1.6>
elements = body_tree.xpath('.//DatiGeneraliDocumento/DatiBollo/ImportoBollo')
@@ -5,6 +5,7 @@ import datetime
import logging
from collections import namedtuple
from unittest.mock import patch
import freezegun
from odoo import tools
from odoo.addons.account_edi.tests.common import AccountEdiTestCommon
@@ -108,13 +109,14 @@ class PecMailServerTests(AccountEdiTestCommon):
def test_receive_signed_vendor_bill(self):
""" Test a signed (P7M) sample e-invoice file from https://www.fatturapa.gov.it/export/documenti/fatturapa/v1.2/IT01234567890_FPR01.xml """
invoices = self._create_invoice(self.signed_invoice_content, self.signed_invoice_filename)
self.assertRecordValues(invoices, [{
'company_id': self.company.id,
'name': 'BILL/2014/12/0001',
'date': datetime.date(2014, 12, 18),
'ref': '01234567890',
}])
with freezegun.freeze_time('2020-04-06'):
invoices = self._create_invoice(self.signed_invoice_content, self.signed_invoice_filename)
self.assertRecordValues(invoices, [{
'company_id': self.company.id,
'name': 'BILL/2020/04/0001',
'invoice_date': datetime.date(2014, 12, 18),
'ref': '01234567890',
}])
def test_receive_same_vendor_bill_twice(self):
""" Test that the second time we are receiving a PEC mail with the same attachment, the second is discarded """