diff options
| author | Anh Thao Pham (pta) <pta@odoo.com> | 2020-07-09 13:23:06 +0000 |
|---|---|---|
| committer | Anh Thao Pham (pta) <pta@odoo.com> | 2020-07-10 09:41:08 +0000 |
| commit | cc8c036f878fcf03c6c547fdc9760fbf5bc23759 (patch) | |
| tree | d652b25fe25aa25765103b245f1c050aa719580b /addons/payment/wizards | |
| parent | 878a92b528327b8dfad0dd49a80ce73f2ff2db94 (diff) | |
[FIX] payment: use currency precision when comparing amounts in Payment Link wizard
In Sales, in Payment Link generation wizard, when entering manually the total of the quotation
as Amount, it can happen that the Validation Error asking to set an Amount smaller than the total
is triggered.
opw-2287794
closes odoo/odoo#54309
X-original-commit: a7034b75383f23f309d97a86cbde7d9f8176ed6d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons/payment/wizards')
| -rw-r--r-- | addons/payment/wizards/payment_link_wizard.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/payment/wizards/payment_link_wizard.py b/addons/payment/wizards/payment_link_wizard.py index 57b3ec1282d..54de9a31d96 100644 --- a/addons/payment/wizards/payment_link_wizard.py +++ b/addons/payment/wizards/payment_link_wizard.py @@ -7,7 +7,7 @@ from werkzeug import urls from odoo import api, fields, models, _ from odoo.exceptions import ValidationError -from odoo.tools import ustr, consteq +from odoo.tools import ustr, consteq, float_compare class PaymentLinkWizard(models.TransientModel): @@ -46,7 +46,7 @@ class PaymentLinkWizard(models.TransientModel): @api.onchange('amount', 'description') def _onchange_amount(self): - if self.amount_max < self.amount: + if float_compare(self.amount_max, self.amount, precision_rounding=self.currency_id.rounding or 0.01) == -1: raise ValidationError(_("Please set an amount smaller than %s.") % (self.amount_max)) if self.amount <= 0: raise ValidationError(_("The value of the payment amount must be positive.")) |
