diff --git a/l10n_it_sct_cbi/models/account_payment_order.py b/l10n_it_sct_cbi/models/account_payment_order.py index 70321b527662..9fae3d534467 100644 --- a/l10n_it_sct_cbi/models/account_payment_order.py +++ b/l10n_it_sct_cbi/models/account_payment_order.py @@ -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", diff --git a/l10n_it_sct_cbi/tests/test_generate_file.py b/l10n_it_sct_cbi/tests/test_generate_file.py index cc350a31f4c4..c7df0d632d70 100644 --- a/l10n_it_sct_cbi/tests/test_generate_file.py +++ b/l10n_it_sct_cbi/tests/test_generate_file.py @@ -3,6 +3,8 @@ import base64 +from lxml import etree + from odoo import Command from odoo.tests import Form, tagged @@ -105,9 +107,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 @@ -143,5 +156,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)