odoo/odoo · error · UserError
You cannot reduce the number of decimal places of a currency
Error message
You cannot reduce the number of decimal places of a currency which has already been used to make accounting entries.
What it means
Raised by res.currency.write (addons/account/models/res_currency.py:31) when you increase the rounding value (or set it to 0) of a currency that already has accounting entries. A larger rounding factor means fewer decimal places, which would contradict amounts already computed and stored on move lines, so Odoo refuses the change for used currencies.
Source
Thrown at addons/account/models/res_currency.py:31
return ','.join(self.env.companies.mapped('account_fiscal_country_id.code'))
display_rounding_warning = fields.Boolean(string="Display Rounding Warning", compute='_compute_display_rounding_warning',
help="The warning informs a rounding factor change might be dangerous on res.currency's form view.")
fiscal_country_codes = fields.Char(store=False, default=_get_fiscal_country_codes)
@api.depends('rounding')
def _compute_display_rounding_warning(self):
for record in self:
record.display_rounding_warning = (
record._origin.id and record._origin.rounding != record.rounding
)
def write(self, vals):
if 'rounding' in vals:
rounding_val = vals['rounding']
for record in self:
if (rounding_val > record.rounding or rounding_val == 0) and record._has_accounting_entries():
raise UserError(_("You cannot reduce the number of decimal places of a currency which has already been used to make accounting entries."))
return super(ResCurrency, self).write(vals)
def _has_accounting_entries(self):
""" Returns True iff this currency has been used to generate (hence, round)
some move lines (either as their foreign currency, or as the main currency).
"""
self.ensure_one()
return bool(self.env['account.move.line'].sudo().search_count(['|', ('currency_id', '=', self.id), ('company_currency_id', '=', self.id)]))
def _get_simple_currency_table(self, companies) -> SQL:
""" Helper creating the currency table and returning its definition for basic cases of Odoo reports needing to convert amounts using only the
current rates, in a single period.
"""
if self._check_currency_table_monocurrency(companies):
return self._get_monocurrency_currency_table_sql(companies)
self._create_currency_table(companies, [('period', None, fields.Date.today())])View on GitHub (pinned to 1e661df964)
Solutions
- Keep the historical currency untouched and create a new currency record with the desired rounding, then use it going forward.
- Only decrease rounding (more precision) on a used currency — that direction is permitted.
- On an empty/test database, remove the accounting entries (or use a fresh DB) and then change rounding.
Example fix
# before
currency.write({'rounding': 1.0}) # UserError: currency already used
# after (new currency for future use)
new_cur = currency.copy({'name': currency.name + ' (2dp→0dp)', 'rounding': 1.0}) Defensive patterns
Strategy: validation
Validate before calling
def can_set_rounding(currency, new_rounding):
if new_rounding > currency.rounding or new_rounding == 0:
return not currency._has_accounting_entries()
return True Prevention
- Configure currency rounding correctly before the first transaction.
- Allow only precision-increasing edits (smaller rounding) on used currencies.
- Need coarser rounding later? Create a new currency instead of editing the used one.
When it happens
Trigger: write({'rounding': X}) where X > record.rounding (e.g. going from 0.01 to 0.05/1.0) or X == 0, on a currency referenced by any account.move.line.currency_id or company_currency_id (_has_accounting_entries does a sudoed search_count). Decreasing rounding (more decimals) is allowed.
Common situations: Fixing a misconfigured currency (e.g. rounding set to 0.01 when it should be 1 for a zero-decimal currency like JPY) after transactions exist; data imports or demo-data corrections on currencies already used by invoices; enabling a new decimal convention on a live database.
Related errors
- The foreign currency must be different than the journal one:
- You can't provide an amount in foreign currency without spec
- You can't provide a foreign currency without specifying an a
- No journal could be found in company %(company_name)s for an
- Cannot find a chart of accounts for this company, You should
AI-assisted analysis of odoo/odoo@1e661df964 (2026-08-15).
Data as JSON: /api/errors/8febe56dd9d807d9.
Report an issue: GitHub.