diff --git a/hr_contract_currency/models/hr_contract.py b/hr_contract_currency/models/hr_contract.py index 3d9c19ca5a0..f9c0adaffc4 100644 --- a/hr_contract_currency/models/hr_contract.py +++ b/hr_contract_currency/models/hr_contract.py @@ -1,5 +1,6 @@ # Copyright 2018 Brainbean Apps (https://brainbeanapps.com) # Copyright 2020 Onestein () +# Copyright 2024 Newlogic () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import api, fields, models @@ -14,12 +15,18 @@ class HrContract(models.Model): readonly=False, required=True, default=lambda self: self._get_default_currency_id(), + compute="_compute_currency_id", tracking=True, + store=True, ) def _get_default_currency_id(self): return self.company_id.currency_id or self.env.company.currency_id + def _compute_currency_id(self): + for rec in self: + rec.currency_id = rec.company_id.currency_id + @api.model def create(self, vals): if vals.get("company_id") and not vals.get("currency_id"): diff --git a/hr_contract_currency/views/hr_contract.xml b/hr_contract_currency/views/hr_contract.xml index c3025132331..bf9e5425409 100644 --- a/hr_contract_currency/views/hr_contract.xml +++ b/hr_contract_currency/views/hr_contract.xml @@ -1,6 +1,7 @@ @@ -8,8 +9,15 @@ hr.contract - - + + + +