Skip to content

Commit 466116d

Browse files
committed
Merge PR #4379 into 16.0
Signed-off-by SirAionTech
2 parents 624f106 + ee35db5 commit 466116d

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

l10n_it_sct_cbi/models/account_payment_order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def _l10n_it_sct_cbi_generate_transaction_block(
349349
payment_identification_CtgyPurp_Cd = etree.SubElement(
350350
payment_identification_CtgyPurp, "Cd"
351351
)
352-
payment_identification_CtgyPurp_Cd.text = "SEPA"
352+
payment_identification_CtgyPurp_Cd.text = "SUPP"
353353
instruction_identification = etree.SubElement(payment_identification, "InstrId")
354354
instruction_identification.text = self._prepare_field(
355355
"Instruction Identification",

l10n_it_sct_cbi/tests/test_generate_file.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import base64
55

6+
from lxml import etree
7+
68
from odoo import Command
79
from odoo.tests import Form, tagged
810

@@ -105,9 +107,20 @@ def test_2_bills(self):
105107
payment_att = self._get_payment_attachment(bills)
106108

107109
# Assert
108-
payment_att_content = base64.b64decode(payment_att.datas).decode()
109-
self.assertIn(bill_1.ref, payment_att_content)
110-
self.assertIn(bill_2.ref, payment_att_content)
110+
payment_tree = etree.fromstring(base64.b64decode(payment_att.datas))
111+
namespaces = payment_tree.nsmap
112+
bills_refs_node = payment_tree.find(
113+
".//PMRQ:RmtInf//PMRQ:Ustrd",
114+
namespaces=namespaces,
115+
)
116+
self.assertIn(bill_1.ref, bills_refs_node.text)
117+
self.assertIn(bill_2.ref, bills_refs_node.text)
118+
119+
category_purpose_code_node = payment_tree.find(
120+
".//PMRQ:CtgyPurp//PMRQ:Cd",
121+
namespaces=namespaces,
122+
)
123+
self.assertEqual(category_purpose_code_node.text, "SUPP")
111124

112125
def test_multiple_payment_priority(self):
113126
"""Generate a payment file for a vendor bill
@@ -143,5 +156,10 @@ def test_multiple_payment_priority(self):
143156
payment_att = self._get_record_from_action(payment_file_action)
144157

145158
# Assert
146-
payment_att_content = base64.b64decode(payment_att.datas).decode()
147-
self.assertIn(bill.ref, payment_att_content)
159+
payment_tree = etree.fromstring(base64.b64decode(payment_att.datas))
160+
namespaces = payment_tree.nsmap
161+
bills_refs_node = payment_tree.find(
162+
".//PMRQ:RmtInf//PMRQ:Ustrd",
163+
namespaces=namespaces,
164+
)
165+
self.assertIn(bill.ref, bills_refs_node.text)

0 commit comments

Comments
 (0)