Skip to content

Commit

Permalink
Merge PR #2446 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by TheMule71
  • Loading branch information
OCA-git-bot committed Oct 22, 2021
2 parents a731772 + e3b0fa6 commit a63d71a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 1 addition & 3 deletions l10n_it_fatturapa_in/models/attachment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import base64

from odoo import _, api, fields, models
from odoo.tools import format_date

Expand Down Expand Up @@ -135,7 +133,7 @@ def extract_attachments(self, AttachmentsData, invoice_id):
content = attach.Attachment.encode()
_attach_dict = {
"name": name,
"datas": base64.b64encode(content),
"datas": content,
"description": attach.DescrizioneAttachment or "",
"compression": attach.AlgoritmoCompressione or "",
"format": attach.FormatoAttachment or "",
Expand Down
Binary file added l10n_it_fatturapa_in/tests/data/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from psycopg2 import IntegrityError

from odoo.exceptions import UserError
from odoo.modules import get_module_resource
from odoo.tests import Form
from odoo.tools import mute_logger

Expand Down Expand Up @@ -103,6 +104,17 @@ def test_01_xml_import(self):
self.assertEqual(invoice.ftpa_incoterms, "DAP")
self.assertEqual(invoice.fiscal_document_type_id.code, "TD01")
self.assertTrue(invoice.art73)

# verify if attached documents are correctly imported
attachments = invoice.fatturapa_doc_attachments
self.assertEqual(len(attachments), 1)
orig_attachment_path = get_module_resource(
"l10n_it_fatturapa_in", "tests", "data", "test.png"
)
with open(orig_attachment_path, "rb") as orig_attachment:
orig_attachment_data = orig_attachment.read()
self.assertEqual(attachments[0].raw, orig_attachment_data)

# allow following tests to reuse the same XML file
invoice.ref = invoice.payment_reference = "14011"

Expand Down

0 comments on commit a63d71a

Please sign in to comment.