From a6798548538c4b61614720c9fdf15073ba660b9b Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Tue, 21 Mar 2023 23:13:02 +0100 Subject: [PATCH] [FIX] contract: subtotal miscalculated when price_unit displayed with fewer digits than actual value This commit addresses an issue in the "contract" module where the subtotal was incorrectly calculated when the price_unit field was displayed with fewer digits than its actual value, resulting in discrepancies of a few cents. The change made in this commit is: Adding the digits attribute with the value "Product Price" to the price_unit field, ensuring the proper display of decimal places, leading to accurate subtotal calculations and eliminating cent discrepancies. --- contract/models/abstract_contract_line.py | 1 + contract/readme/CONTRIBUTORS.rst | 1 + 2 files changed, 2 insertions(+) diff --git a/contract/models/abstract_contract_line.py b/contract/models/abstract_contract_line.py index 94f81342b..ba84f6f29 100644 --- a/contract/models/abstract_contract_line.py +++ b/contract/models/abstract_contract_line.py @@ -39,6 +39,7 @@ class ContractAbstractContractLine(models.AbstractModel): string="Unit Price", compute="_compute_price_unit", inverse="_inverse_price_unit", + digits="Product Price", ) price_subtotal = fields.Float( compute="_compute_price_subtotal", diff --git a/contract/readme/CONTRIBUTORS.rst b/contract/readme/CONTRIBUTORS.rst index dda95e89e..1d303c64d 100644 --- a/contract/readme/CONTRIBUTORS.rst +++ b/contract/readme/CONTRIBUTORS.rst @@ -14,3 +14,4 @@ * Rafael Blasco * Víctor Martínez * Iván Antón +* Eric Antones