Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] XML di pagamento rifiutato: Valore SEPA non è un codice valido per Category Purpose #4379

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
28 changes: 23 additions & 5 deletions l10n_it_sct_cbi/tests/test_generate_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import base64

from lxml import etree

from odoo import Command
from odoo.tests import Form, tagged

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Loading