diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2020-11-03 12:41:12 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-11-05 09:10:52 +0000 |
| commit | 563752358d233d4fc9cf1d7e7abd0b1656dc82c1 (patch) | |
| tree | eab142b5b3b0be35d521c9f405126bc147347705 | |
| parent | cbca0e103bda3bce92779bbb2a718b210a71846f (diff) | |
[FIX] account: cash rounding precision
A cash rounding precision must be strictly larger than zero to follow
the restriction introduced in e270e9e0cc6574.
opw-2341804
closes odoo/odoo#61348
X-original-commit: d803c2c73cfa53aba38bee647d4af9bb01120819
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
| -rw-r--r-- | addons/account/i18n/account.pot | 10 | ||||
| -rw-r--r-- | addons/account/models/account_cash_rounding.py | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 50776854be5..392ed38f3cc 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -8802,16 +8802,16 @@ msgid "" msgstr "" #. module: account -#: code:addons/account/models/account_cash_rounding.py:0 +#: code:addons/account/models/account_reconcile_model.py:0 #, python-format -msgid "Please set a positive rounding value." +msgid "" +"Please set at least one of the match texts to create a partner mapping." msgstr "" #. module: account -#: code:addons/account/models/account_reconcile_model.py:0 +#: code:addons/account/models/account_cash_rounding.py:0 #, python-format -msgid "" -"Please set at least one of the match texts to create a partner mapping." +msgid "Please set a strictly positive rounding value." msgstr "" #. module: account diff --git a/addons/account/models/account_cash_rounding.py b/addons/account/models/account_cash_rounding.py index f71ece8460f..b4cb8a23560 100644 --- a/addons/account/models/account_cash_rounding.py +++ b/addons/account/models/account_cash_rounding.py @@ -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. |
