account_move.py 416 B

1234567891011121314151617
  1. from odoo import models, fields
  2. class AccountMove(models.Model):
  3. _inherit = "account.move"
  4. rate = fields.Float(compute="_get_last_exchannge_rate")
  5. def _get_last_exchannge_rate(self):
  6. if self.currency_id.rate_ids:
  7. rate = self.currency_id.rate_ids[0]
  8. if rate:
  9. self.rate= rate.inverse_company_rate
  10. else:
  11. self.rate = 0