from odoo import models, api from odoo.tools import float_round class AccountMoveLine(models.Model): _inherit = 'account.move.line' @api.model_create_multi def create(self, vals_list): for vals in vals_list: if vals.get('expense_id') and vals.get('price_unit'): # Force rounding on expense-related lines to prevent noise from 10-decimal precision currency = self.env['res.currency'].browse(vals.get('currency_id')) or self.env.company.currency_id vals['price_unit'] = float_round(vals['price_unit'], precision_digits=currency.decimal_places or 2) return super().create(vals_list) def write(self, vals): if 'price_unit' in vals: for line in self: if line.expense_id: currency = line.currency_id or self.env.company.currency_id vals['price_unit'] = float_round(vals['price_unit'], precision_digits=currency.decimal_places or 2) return super().write(vals)