-
-
Save drkpkg/9a33dae94dddf983279533a8e897593a to your computer and use it in GitHub Desktop.
Odoo account_move_line rate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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