From bb77d9e554ce0a876f896fe357d2bc180f4608dc Mon Sep 17 00:00:00 2001 From: "lase@odoo.com" Date: Mon, 22 Jan 2024 10:53:35 +0100 Subject: [PATCH] [FIX] account: render draft invoice without early payment Current behaviour: 500: Internal Server Error Error while rendering the template account.report_invoice_document Steps to reproduce: Accounting > Configuration > invoicing > Payment Terms New > Create and save a payment term with 2 lines For example : - name 80/20 test - line_1 : 80% after 0 days - line_2 : 20% after 30 days Sales > Orders > Quotations Chose any > use payment terms 80/20 test Save and create associated invoice > chose regular invoice > create draft invoice > preview > 500: Internal Server Error Cause of the issue: The method _get_amount_due_after_discount() called during the rendering of the template does not return a value in case self.early_discount is False. Fix: Return total_amount by default since no discount is applied. opw-3683708 closes odoo/odoo#155080 X-original-commit: c8154b6aa57cc42e352260c7f75e52cd29a2d52d Signed-off-by: Quentin De Paoli Signed-off-by: Lancelot Semal (lase) --- addons/account/models/account_payment_term.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/models/account_payment_term.py b/addons/account/models/account_payment_term.py index 1ccab7ce077..c6f25724890 100644 --- a/addons/account/models/account_payment_term.py +++ b/addons/account/models/account_payment_term.py @@ -60,6 +60,7 @@ class AccountPaymentTerm(models.Model): else: discount_amount_currency = self.currency_id.round(total_amount - (total_amount * (1 - (percentage)))) return total_amount - discount_amount_currency + return total_amount @api.depends('company_id') def _compute_discount_computation(self):