Currency Rounding Script - odoo-ps/pshk-process GitHub Wiki

When trying to manually change the currency rounding in a running database (contains data already), Odoo will throw an error warning to prevent it. To circumvent this issue, we can run a script by putting it on a server action as such

env.cr.execute('''update res_currency set rounding = 0.01, decimal_places = 2 where name = 'THB';''')
env.cr.execute('''update account_move_line set debit = round(debit, 2), credit = round(credit, 2), balance = round(balance, 2), amount_residual = round(amount_residual, 2), amount_currency = round(amount_currency, 2), amount_residual_currency = round(amount_residual_currency, 2);''')