From fcbfb096c86af29bf8a7dbfabf4779f83f31eecb Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Wed, 27 Dec 2023 16:03:11 +0100 Subject: [PATCH] [FIX] account_invoice_ubl: Fix CreditNote Do not provide payment means & terms on a credit note --- account_invoice_ubl/models/account_move.py | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/account_invoice_ubl/models/account_move.py b/account_invoice_ubl/models/account_move.py index 6585a74c5ef..b714f29722a 100644 --- a/account_invoice_ubl/models/account_move.py +++ b/account_invoice_ubl/models/account_move.py @@ -439,21 +439,22 @@ def generate_invoice_ubl_xml_etree(self, version="2.1"): # the field 'partner_shipping_id' is defined in the 'sale' module if hasattr(self, "partner_shipping_id") and self.partner_shipping_id: self._ubl_add_delivery(self.partner_shipping_id, xml_root, ns) - # Put paymentmeans block even when invoice is paid ? - payment_identifier = self.get_payment_identifier() - self._ubl_add_payment_means( - self.partner_bank_id, - self.payment_mode_id, - self.invoice_date_due, - xml_root, - ns, - payment_identifier=payment_identifier, - version=version, - ) - if self.invoice_payment_term_id: - self._ubl_add_payment_terms( - self.invoice_payment_term_id, xml_root, ns, version=version + if self.move_type == "out_invoice": + # Put paymentmeans block even when invoice is paid ? + payment_identifier = self.get_payment_identifier() + self._ubl_add_payment_means( + self.partner_bank_id, + self.payment_mode_id, + self.invoice_date_due, + xml_root, + ns, + payment_identifier=payment_identifier, + version=version, ) + if self.invoice_payment_term_id: + self._ubl_add_payment_terms( + self.invoice_payment_term_id, xml_root, ns, version=version + ) self._ubl_add_tax_total(xml_root, ns, version=version) self._ubl_add_legal_monetary_total(xml_root, ns, version=version)