3

I need a monetary field to keep 5 decimal places (e.g. 12.34567), but Odoo version 18.0 enterprise keeps rounding to the currency’s precision (2 decimals for my company currency).

Here is my code:

class AccountPaymentRegister(models.TransientModel):
    _inherit = 'account.payment.register'

    bank_charges = fields.Monetary(
        string='Bank Charges',
        currency_field='currency_id',
    )

class AccountJournal(models.Model):
    _inherit = 'account.journal'

    default_bank_charge_amount = fields.Monetary(
        string='Default Bank Charge Amount',
        currency_field='company_currency_id',
        help='Default bank charge amount to prefill in the Pay wizard.',
    )

I tried:

  • Setting digits=(16, 5) on the field → seems ignored by Monetary.
  • Changing only the widget in the view.

Expected: store and display 5 decimals.
Actual: values are rounded to the currency precision.

Is there a supported way to have 5 decimals on a Monetary field, without changing the company currency for everything? If not, what is the recommended pattern?

9
  • No there is no supported way on Monetary fields. You should use Float fields instead, but will lose the currency symbol in outputs. Commented Oct 21 at 15:41
  • Thank you for your effort! Is there any workaround or alternative approach that keeps the currency symbol visible while allowing more decimal precision? Commented Oct 21 at 18:53
  • The alternative is to use a custom widget (like in the first answer) or just trying to show/print the currency symbol directly in a view or qweb report. Commented Oct 22 at 7:10
  • Thank you for your help. Will changing the field type from Monetary to Float affect the accounting system in Odoo? Commented Oct 22 at 8:52
  • 1
    Changing your own field shouldn't be a problem. You're also increasing the precision, no values will be dropped. But to be absolutely sure, you should definitely check this in a test database ;-) Commented Oct 23 at 12:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.