From d2880ddf9c8f6129d88cc6569fa7f3630ceb4c8d Mon Sep 17 00:00:00 2001 From: Ignacio Cainelli Date: Tue, 29 Aug 2023 11:38:10 +0000 Subject: [PATCH] [FW][FIX] account_payment_term_surcharge: fwport ticket 64738 closes ingadhoc/account-financial-tools#448 Signed-off-by: Nicolas Mac Rouillon --- account_payment_term_surcharge/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/account_payment_term_surcharge/models/account_move.py b/account_payment_term_surcharge/models/account_move.py index 11a7876a6..d9f887eee 100644 --- a/account_payment_term_surcharge/models/account_move.py +++ b/account_payment_term_surcharge/models/account_move.py @@ -1,5 +1,6 @@ from odoo import fields, models, _, api from odoo.exceptions import UserError +from odoo.tools import float_round import logging _logger = logging.getLogger(__name__) @@ -76,7 +77,7 @@ def _add_surcharge_line(self, debit_note, product, debt, to_date, surcharge): })]}) debit_note = debit_note.with_context(check_move_validity=False) debit_note.invoice_line_ids._onchange_product_id() - debit_note.invoice_line_ids[0].price_unit = (surcharge / 100) * debt + debit_note.invoice_line_ids[0].price_unit = float_round((surcharge / 100) * debt, precision_digits=2) debit_note.invoice_line_ids[0].name = product.name + '.\n' + comment debit_note._recompute_dynamic_lines()