diff --git a/addons/l10n_be_hr_payroll_fleet/models/fleet.py b/addons/l10n_be_hr_payroll_fleet/models/fleet.py index 543c4b72..372b3b3a 100644 --- a/addons/l10n_be_hr_payroll_fleet/models/fleet.py +++ b/addons/l10n_be_hr_payroll_fleet/models/fleet.py @@ -13,7 +13,8 @@ class FleetVehicle(models.Model): co2_fee = fields.Float(compute='_compute_co2_fee', string="CO2 Fee") total_depreciated_cost = fields.Float(compute='_compute_total_depreciated_cost', - string="Total Cost (Depreciated)", help="This includes all the depreciated costs and the CO2 fee") + string="Total Cost (Depreciated)", track_visibility="onchange", + help="This includes all the depreciated costs and the CO2 fee") total_cost = fields.Float(compute='_compute_total_cost', string="Total Cost", help="This include all the costs and the CO2 fee") fuel_type = fields.Selection(required=True, default='diesel') atn = fields.Float(compute='_compute_car_atn', string="ATN") diff --git a/addons/l10n_be_hr_payroll_fleet/models/hr_contract.py b/addons/l10n_be_hr_payroll_fleet/models/hr_contract.py index 26bd27ad..ebb2349d 100644 --- a/addons/l10n_be_hr_payroll_fleet/models/hr_contract.py +++ b/addons/l10n_be_hr_payroll_fleet/models/hr_contract.py @@ -25,7 +25,7 @@ class HrContract(models.Model): 'car_id.log_contracts.recurring_cost_amount_depreciated') # the fleet vehicle to avoid these dependencies def _compute_car_atn_and_costs(self): for contract in self: - if contract.car_id: + if not contract.new_car and contract.car_id: contract.car_atn = contract.car_id.atn contract.company_car_total_depreciated_cost = contract.car_id.total_depreciated_cost elif contract.new_car and contract.new_car_model_id: