[FIX] account: cash rounding precision
A cash rounding precision must be strictly larger than zero to follow
the restriction introduced in e270e9e0cc.
opw-2341804
closes odoo/odoo#61382
X-original-commit: 563752358d233d4fc9cf1d7e7abd0b1656dc82c1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
committed by
oco-odoo
parent
bfdb071933
commit
5c57644ead
@@ -8801,12 +8801,6 @@ msgid ""
|
||||
"proceeding."
|
||||
msgstr ""
|
||||
|
||||
#. module: account
|
||||
#: code:addons/account/models/account_cash_rounding.py:0
|
||||
#, python-format
|
||||
msgid "Please set a positive rounding value."
|
||||
msgstr ""
|
||||
|
||||
#. module: account
|
||||
#: code:addons/account/models/account_reconcile_model.py:0
|
||||
#, python-format
|
||||
@@ -8814,6 +8808,12 @@ msgid ""
|
||||
"Please set at least one of the match texts to create a partner mapping."
|
||||
msgstr ""
|
||||
|
||||
#. module: account
|
||||
#: code:addons/account/models/account_cash_rounding.py:0
|
||||
#, python-format
|
||||
msgid "Please set a strictly positive rounding value."
|
||||
msgstr ""
|
||||
|
||||
#. module: account
|
||||
#: model_terms:ir.ui.view,arch_db:account.report_invoice_document
|
||||
msgid "Please use the following communication for your payment :"
|
||||
|
||||
@@ -16,7 +16,7 @@ class AccountCashRounding(models.Model):
|
||||
_description = 'Account Cash Rounding'
|
||||
|
||||
name = fields.Char(string='Name', translate=True, required=True)
|
||||
rounding = fields.Float(string='Rounding Precision', required=True,
|
||||
rounding = fields.Float(string='Rounding Precision', required=True, default=0.01,
|
||||
help='Represent the non-zero value smallest coinage (for example, 0.05).')
|
||||
strategy = fields.Selection([('biggest_tax', 'Modify tax amount'), ('add_invoice_line', 'Add a rounding line')],
|
||||
string='Rounding Strategy', default='add_invoice_line', required=True,
|
||||
@@ -31,8 +31,8 @@ class AccountCashRounding(models.Model):
|
||||
@api.constrains('rounding')
|
||||
def validate_rounding(self):
|
||||
for record in self:
|
||||
if record.rounding < 0:
|
||||
raise ValidationError(_("Please set a positive rounding value."))
|
||||
if record.rounding <= 0:
|
||||
raise ValidationError(_("Please set a strictly positive rounding value."))
|
||||
|
||||
def round(self, amount):
|
||||
"""Compute the rounding on the amount passed as parameter.
|
||||
|
||||
Reference in New Issue
Block a user