Skip to content

Instantly share code, notes, and snippets.

@drkpkg
Created April 2, 2025 03:56
Show Gist options
  • Save drkpkg/9a33dae94dddf983279533a8e897593a to your computer and use it in GitHub Desktop.
Save drkpkg/9a33dae94dddf983279533a8e897593a to your computer and use it in GitHub Desktop.
Odoo account_move_line rate
from odoo import models, fields, api
class AccountMove(models.Model):
_inherit = 'account.move.line'
currency_rate = fields.Float(
compute='_compute_currency_rate',
help="Currency rate from company currency to document currency.",
store=True,
)
currency_rate_editable = fields.Float(
help="Currency rate from company currency to document currency.",
)
@api.onchange('currency_rate_editable')
def _onchange_currency_rate_editable(self):
if self.currency_rate_editable:
self.currency_rate = self.currency_rate_editable
def _compute_currency_rate(self):
super()._compute_currency_rate()
for line in self:
line.currency_rate_editable = line.currency_rate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment