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 OCA-git-bot committed Oct 16, 2024
1 parent d2f8407 commit 20fac5d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 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(

Check warning on line 349 in l10n_it_sct_cbi/models/account_payment_order.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/models/account_payment_order.py#L349

Added line #L349 was not covered by tests
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(

Check warning on line 354 in l10n_it_sct_cbi/models/account_payment_order.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/models/account_payment_order.py#L352-L354

Added lines #L352 - L354 were not covered by tests
"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

Check warning on line 9 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L9

Added line #L9 was not covered by tests

Expand Down Expand Up @@ -105,9 +107,20 @@ def test_2_bills(self):
payment_att = self._get_payment_attachment(bills)

Check warning on line 107 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L107

Added line #L107 was not covered by tests

# 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(

Check warning on line 112 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L110-L112

Added lines #L110 - L112 were not covered by tests
".//PMRQ:RmtInf//PMRQ:Ustrd",
namespaces=namespaces,
)
self.assertIn(bill_1.ref, bills_refs_node.text)
self.assertIn(bill_2.ref, bills_refs_node.text)

Check warning on line 117 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L116-L117

Added lines #L116 - L117 were not covered by tests

category_purpose_code_node = payment_tree.find(

Check warning on line 119 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L119

Added line #L119 was not covered by tests
".//PMRQ:CtgyPurp//PMRQ:Cd",
namespaces=namespaces,
)
self.assertEqual(category_purpose_code_node.text, "SUPP")

Check warning on line 123 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L123

Added line #L123 was not covered by tests

def test_multiple_payment_priority(self):

Check warning on line 125 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L125

Added line #L125 was not covered by tests
"""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)

Check warning on line 156 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L154-L156

Added lines #L154 - L156 were not covered by tests

# 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(

Check warning on line 161 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L159-L161

Added lines #L159 - L161 were not covered by tests
".//PMRQ:RmtInf//PMRQ:Ustrd",
namespaces=namespaces,
)
self.assertIn(bill.ref, bills_refs_node.text)

Check warning on line 165 in l10n_it_sct_cbi/tests/test_generate_file.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_sct_cbi/tests/test_generate_file.py#L165

Added line #L165 was not covered by tests

0 comments on commit 20fac5d

Please sign in to comment.