# [IMP] *hr_payroll: Benefits data and 13th month #30562

Open
wants to merge 8 commits into
from

Projects
None yet
3 participants
Contributor

# 2/ [IMP] hr_payroll: display worked days amount on payslip

## Purpose

Currently, the number of days and hours for each `worked_days_line_ids` are
displayed on the payslip report. However the corresponding amount is not.

## Specification

For each `worked_days_line_ids` of a payslip, display the corresponding
amount on the report.
Amounts should be computed as follows:
Worked days lines of unpaid benefit type: 0
For other worked days lines:

1. Compute what the employee should not earn for the unpaid days
`unpaid amount = (average salary per day)*(number of unpaid days)`
The average salary per day is computed on a 3 month basis (there are always the
same number of days in 3 months=13 weeks).
=> `unpaid amount = wage*3/13/5 (5 days/week)`

2. Compute what the basic salary becomes:
`basic = wage - unpaid amount`

3. Distribute the basic salary among paid worked days types.
`amount of the line = basic * (number of days of the line)/(total number of paid days)`

# 3/ [IMP] l10n_be_hr_payroll: 13th month salary structure

## Purpose

Currently, 13th month computation doesn't take into account several things:

• An employee should not receive a 13th month if he arrive after the 1st July

• The amount should be proportional to the employee seniority if he arrived between the 1st January and 1st July.

• Several benefit type should be deducted from the 13th month:
- Unpaid
- Time Credit
- Parental Time Off
- Unpredictable Reason
- Long Term Sick
- Long Term Sick > 12 months
- Part Time Sick
- Notice

## Specification

Take into account points above

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

### LucasLefevre added some commits Jan 25, 2019

``` [IMP] l10n_be_payroll*, hr_payroll, hr_holidays: add benefit type data ```
```This commit adds benefit types and leave types data.

``` 59d93fa ```
``` [IMP] hr_payroll: Allow to get days data for multiple benefit types ```
```Currently the method `get_benefit_days_data` only accept one
benefit type as parameter.
After this commit, the method accept multiple benefit types.
The data returned is the sum of attendance/leaves data for all benefit
types in the parameter.```
``` 5e0f3d2 ```
``` [IMP] hr_payroll: display worked days amount on payslip ```
```    Purpose
=======

Currently, the number of days and hours for each `worked_days_line_ids` are
displayed on the payslip report. However the corresponding amount is not.

Specification
=============

For each `worked_days_line_ids` of a payslip, display the corresponding
amount on the report.
Amounts should be computed as follows:
Worked days lines of unpaid benefit type: 0
For other worked days lines:

1. Compute what the employee should *not* earn for the unpaid days
unpaid amount = (average salary per day)*(number of unpaid days)
The average salary per day is computed on a 3 month basis (there are always the
same number of days in 3 months=13 weeks).
=> unpaid amount = unpaid_days * wage*3/13/5 (5 days/week)

2. Compute what the basic salary becomes:
basic = wage - unpaid amount

3. Distribute the basic salary among paid worked days types.
amount of the line = basic * (number of days of the line)/(total number of paid days)```
``` cfd7981 ```
``` [FIX] l10n_be_hr_payroll: Compute yearly income from payslips ```
```To compute witholding taxes rate, the yearly income is needed.
Currently it's naively computed as GROSS*12 which does not
take into account any appraisal or if an employee didn't
work all year.

After this commit, the yearly income is computed from the
actual payslips.```
``` d5efa78 ```
``` [FIX] l10n_be_hr_payroll: Use BASIC to compute withholding tax rate ```
```Currently the yearly income used to compute the withholding tax rate
is computed based on the GROSS salary. This is incorrect for special
withholding tax (double holidays, 13 month)
Also, the withholding amount is computed from the yearly income
instead of the amount of the current payslip.

This commit fixes both issues.```
``` 73cfcb5 ```
``` [FIX] hr_payroll: Don't archive benefit on leave refuse ```
```Currently when a leave is refused, any linked benefit is archived.
This is incorrect. It should only archive leave benefits.

Approved leave => it generate a leave benefit.
Then I refuse the leave => should archive the leave benefit

Leave to approve => it generate attendance benefits
(with a warning because of the conflicting leave).
Then I refuse the leave => should not archive the attendance
benefits```
``` c7594b1 ```
``` [IMP] hr_payroll: Compute BASIC rule with a method ```
```The BASIC rule is common to all structure inheriting from
the base structure.
Overriding the basic rule for different structure is therefore
impossible.

The BASIC rule will now call a method overridable in localization.
The method can return a different amount based on the structure.```
``` 078d225 ```
``` [IMP] l10n_be_hr_payroll: Improve 13th month structure ```
```Purpose
=======

Currently, 13th month computation doesn't take into account
several things:

- An employee should not receive a 13th month if he arrive
after the 1st July

- The amount should be proportional to the employee seniority if
he arrived between the 1st January and 1st July.

- Several benefit type should be deducted from the 13th month:
- Unpaid
- Time Credit
- Parental Time Off
- Unpredictable Reason
- Long Term Sick
- Long Term Sick > 12 months
- Part Time Sick
- Notice

Specification
=============
Take into account points above```
``` 597c5a9 ```

### LucasLefevre reviewed Mar 18, 2019

 'l10n_be_hr_payroll.benefit_type_small_unemployment', 'l10n_be_hr_payroll.benefit_type_training', 'l10n_be_hr_payroll.benefit_type_training_time_off', )

#### LucasLefevre Mar 18, 2019

Author Contributor

What about adding two m2m on salary structures: `paid_work_entry_type` and `unpaid_work_entry_type` ?
There are different for many structures (13th month, double holiday, "indemnités de rupture", etc)
It would avoid hard coding them like here each time.
And it is more flexible than adding an `unpaid` boolean field like in this PR (commit cfd7981)