changeset 5160:180cc7a9d84b

bug #62555. Use product price_decimal value from system configuration
author Luis Falcon <falcon@gnuhealth.org>
date Wed, 08 Jun 2022 17:12:32 +0100
parents d35dc2652483
children 227cc26317f7
files tryton/health_insurance/wizard/wizard_health_insurance.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health_insurance/wizard/wizard_health_insurance.py
+++ b/tryton/health_insurance/wizard/wizard_health_insurance.py
@@ -26,6 +26,7 @@
 from trytond.transaction import Transaction
 from trytond.pool import Pool
 from trytond.i18n import gettext
+from trytond.modules.product import round_price
 from ..exceptions import (
     ServiceInvoiced, NoInvoiceAddress, NoPaymentTerm, NoAccountReceivable)
 
@@ -193,9 +194,10 @@
                                     if (discount['type'] == 'pct'):
                                         unit_price *= decimal.Decimal(
                                             1 - discount['value']/100)
-                                        # Round to avoid error on sig figs
-                                        # at invoice.
-                                        unit_price = round(unit_price, 2)
+                                        # Use price_decimal value from
+                                        # system configuration to set
+                                        # the number of decimals
+                                        unit_price = round_price(unit_price)
 
                                         # Add remark on description discount
                                         str_disc = str(discount['value']) + '%'