From 6bf439f496fd1f9513dde6caa0828541de8f5b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Aug 2026 00:56:10 +0200 Subject: [PATCH] Use DueDate as fallback for payment term date for UBL without payment terms Closes #14981 (grafted from df7119de4a976b2d12c884c6d3f0a2c5f2a67174) --HG-- branch : 8.0 --- modules/edocument_ubl/edocument.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/edocument_ubl/edocument.py b/modules/edocument_ubl/edocument.py index 17b103c088..80dabb31dc 100644 --- a/modules/edocument_ubl/edocument.py +++ b/modules/edocument_ubl/edocument.py @@ -382,6 +382,9 @@ class Invoice(Model): root.findall('./{*}PaymentMeans'), payees=payees) invoice.payment_term_date = cls._parse_2_payment_term_date( root.findall('./{*}PaymentTerms')) + if not invoice.payment_term_date: + if due_date := root.findtext('./{*}DueDate'): + invoice.payment_term_date = dt.date.fromisoformat(due_date) lines = [ cls._parse_invoice_2_line( line, @@ -697,6 +700,9 @@ class Invoice(Model): root.findall('./{*}PaymentMeans'), payees=payees) invoice.payment_term_date = cls._parse_2_payment_term_date( root.findall('./{*}PaymentTerms')) + if not invoice.payment_term_date: + if due_date := root.findtext('./{*}DueDate'): + invoice.payment_term_date = dt.date.fromisoformat(due_date) lines = [ cls._parse_credit_note_2_line( line, company=invoice.company, currency=invoice.currency,