Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@LucasLefevre
Copy link
Contributor

LucasLefevre commented Jan 25, 2019

1/ Add Belgian benefit and leave types

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

Task 1923143

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

@robodoo robodoo added the seen 🙂 label Jan 25, 2019

@C3POdoo C3POdoo added the RD label Jan 25, 2019

@robodoo robodoo added the CI 🤖 label Jan 25, 2019

@LucasLefevre LucasLefevre force-pushed the odoo-dev:master-benefit-data-lul branch Jan 31, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Jan 31, 2019

@LucasLefevre LucasLefevre force-pushed the odoo-dev:master-benefit-data-lul branch Feb 20, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Feb 20, 2019

@LucasLefevre LucasLefevre force-pushed the odoo-dev:master-benefit-data-lul branch Feb 21, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Feb 21, 2019

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.

In particular, add belgian data.
[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.
[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)
[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.
[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.
[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
[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.
[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

@LucasLefevre LucasLefevre force-pushed the odoo-dev:master-benefit-data-lul branch to 597c5a9 Feb 22, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Feb 22, 2019

@LucasLefevre LucasLefevre changed the title [IMP] hr_payroll: display worked days amount on payslip [IMP] *hr_payroll: Benefits data and 13th month Feb 27, 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',
)

This comment has been minimized.

@LucasLefevre

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.