Skip to content

Commit e2f4025

Browse files
committed
Merge PR #1097 into 16.0
Signed-off-by alexis-via
2 parents b3a3969 + 47e04b2 commit e2f4025

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

account_einvoice_generate/models/account_move.py

+12
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,15 @@ def _xml_format_in_pdf_invoice(self):
3535
return xml_format
3636
else:
3737
return False
38+
39+
def _get_unece_due_date_type_code(self):
40+
"""account.tax has a selection field 'tax_exigibility' with 2 possible values:
41+
'on_invoice' or 'on_payment'.
42+
As a consequence, tax exigibility is a property of the invoice line.
43+
But, in real life (at least in France), tax exigibility is a property of the invoice,
44+
not the invoice line!
45+
This method is a hook to get the UNECE due date type code from the invoice instead
46+
of the tax. If it returns None, Odoo will get it from the tax.
47+
"""
48+
self.ensure_one()
49+
return None

account_invoice_facturx/models/account_move.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,14 @@ def _cii_total_applicable_trade_tax_block(
458458
base.text = "%0.*f" % (ns["cur_prec"], base_amount * ns["sign"])
459459
tax_categ_code = etree.SubElement(trade_tax, ns["ram"] + "CategoryCode")
460460
tax_categ_code.text = tax["unece_categ_code"]
461-
if tax.get("unece_due_date_code"):
461+
due_date_type_code = self._get_unece_due_date_type_code() or tax.get(
462+
"unece_due_date_code"
463+
)
464+
if due_date_type_code:
462465
trade_tax_due_date = etree.SubElement(
463466
trade_tax, ns["ram"] + "DueDateTypeCode"
464467
)
465-
trade_tax_due_date.text = tax["unece_due_date_code"]
468+
trade_tax_due_date.text = due_date_type_code
466469
# Field tax_exigibility is not required, so no error if missing
467470
if tax.get("amount_type") == "percent":
468471
percent = etree.SubElement(trade_tax, ns["ram"] + "RateApplicablePercent")

0 commit comments

Comments
 (0)