Skip to content

Commit

Permalink
[FIX] l10n_it_sct_cbi: Use accepted category purpose code
Browse files Browse the repository at this point in the history
  • Loading branch information
SirAionTech authored and toita86 committed Oct 21, 2024
1 parent 72fd9d0 commit 842c43b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion l10n_it_sct_cbi/models/account_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def _l10n_it_sct_cbi_generate_transaction_block(
payment_identification_CtgyPurp_Cd = etree.SubElement(
payment_identification_CtgyPurp, "Cd"
)
payment_identification_CtgyPurp_Cd.text = "SEPA"
payment_identification_CtgyPurp_Cd.text = "SUPP"
instruction_identification = etree.SubElement(payment_identification, "InstrId")
instruction_identification.text = self._prepare_field(
"Instruction Identification",
Expand Down
29 changes: 23 additions & 6 deletions l10n_it_sct_cbi/tests/test_generate_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

import base64

from odoo import Command
from lxml import etree

from odoo.tests import Form, tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon
Expand Down Expand Up @@ -105,9 +106,20 @@ def test_2_bills(self):
payment_att = self._get_payment_attachment(bills)

# Assert
payment_att_content = base64.b64decode(payment_att.datas).decode()
self.assertIn(bill_1.ref, payment_att_content)
self.assertIn(bill_2.ref, payment_att_content)
payment_tree = etree.fromstring(base64.b64decode(payment_att.datas))
namespaces = payment_tree.nsmap
bills_refs_node = payment_tree.find(
".//PMRQ:RmtInf//PMRQ:Ustrd",
namespaces=namespaces,
)
self.assertIn(bill_1.ref, bills_refs_node.text)
self.assertIn(bill_2.ref, bills_refs_node.text)

category_purpose_code_node = payment_tree.find(
".//PMRQ:CtgyPurp//PMRQ:Cd",
namespaces=namespaces,
)
self.assertEqual(category_purpose_code_node.text, "SUPP")

def test_multiple_payment_priority(self):
"""Generate a payment file for a vendor bill
Expand Down Expand Up @@ -143,5 +155,10 @@ def test_multiple_payment_priority(self):
payment_att = self._get_record_from_action(payment_file_action)

# Assert
payment_att_content = base64.b64decode(payment_att.datas).decode()
self.assertIn(bill.ref, payment_att_content)
payment_tree = etree.fromstring(base64.b64decode(payment_att.datas))
namespaces = payment_tree.nsmap
bills_refs_node = payment_tree.find(
".//PMRQ:RmtInf//PMRQ:Ustrd",
namespaces=namespaces,
)
self.assertIn(bill.ref, bills_refs_node.text)

0 comments on commit 842c43b

Please sign in to comment.