[FIX] l10n_be_hr_payroll: Allow to edit wage_with_holidays
Purpose ======= Currently, when editing the number of holiday days, the field wage with holidays is computed. The goal of this commit is to allow to edit the wage_with_holidays field and compute the wage amount instead.
This commit is contained in:
@@ -67,7 +67,7 @@ class HrContract(models.Model):
|
||||
help="Number of days of paid leaves the employee gets per year.")
|
||||
holidays_editable = fields.Boolean(string="Editable Holidays", default=True)
|
||||
holidays_compensation = fields.Monetary(compute='_compute_holidays_compensation', string="Holidays Compensation")
|
||||
wage_with_holidays = fields.Monetary(compute='_compute_wage_with_holidays', string="Wage update with holidays retenues")
|
||||
wage_with_holidays = fields.Monetary(compute='_compute_wage_with_holidays', inverse='_inverse_wage_with_holidays', string="Wage update with holidays retenues")
|
||||
additional_net_amount = fields.Monetary(string="Net Supplements",
|
||||
help="Monthly net amount the employee receives.")
|
||||
retained_net_amount = fields.Monetary(sting="Net Retained",
|
||||
@@ -85,6 +85,23 @@ class HrContract(models.Model):
|
||||
else:
|
||||
contract.wage_with_holidays = contract.wage
|
||||
|
||||
def _inverse_wage_with_holidays(self):
|
||||
for contract in self:
|
||||
if contract.holidays > 20.0:
|
||||
remaining_for_gross = contract.wage_with_holidays * (13.0 + 13.0 * 0.3507 + 0.92)
|
||||
yearly_cost = remaining_for_gross \
|
||||
+ 12.0 * contract.representation_fees \
|
||||
+ 12.0 * contract.fuel_card \
|
||||
+ 12.0 * contract.internet \
|
||||
+ 12.0 * (contract.mobile + contract.mobile_plus) \
|
||||
+ 12.0 * contract.transport_employer_cost \
|
||||
+ (1.326 / 1.05 * 12.0) * contract.commission_on_target \
|
||||
+ 220.0 * contract.meal_voucher_paid_by_employer
|
||||
contract.final_yearly_costs = yearly_cost / (1.0 - (contract.holidays - 20.0) / 231.0)
|
||||
contract.wage = contract._get_gross_from_employer_costs(contract.final_yearly_costs)
|
||||
else:
|
||||
contract.wage = contract.wage_with_holidays
|
||||
|
||||
@api.depends('transport_mode', 'company_car_total_depreciated_cost',
|
||||
'public_transport_reimbursed_amount', 'others_reimbursed_amount')
|
||||
def _compute_transport_employer_cost(self):
|
||||
|
||||
Reference in New Issue
Block a user