OCA / payroll

Odoo modules for payroll management
GNU Affero General Public License v3.0
75 stars 117 forks source link

Global rule blacklist ban rule for next contacts #127

Closed voronind closed 7 months ago

voronind commented 1 year ago

Global rule blacklist ban rule for next contacts

Module

payroll

Describe the bug

Rules can not appear in Paysplips depends on contract computing order.

To Reproduce

Affected versions: 13-16

Steps to reproduce the behavior:

  1. Create 2 open contracts for same employee with same structure and wages 1 and 10
  2. Add "C" rule to this structure with code condition: result = contract.wage > 5
  3. Create Payslip for our employee without specified Contract to compute 2 added contracts in this payslip
  4. Compute payslip.

Expected behavior Payslip lines will have C rule in any cases. But if Odoo will compute contract with wage = 1 firstly, Payslip will not contain C rule at all. This happens cause if condition is negative Odoo adds rule to global blacklist and second contract ignores C rule at all.

IMHO We must create blacklist for every contract.

nimarosa commented 1 year ago

Hello @vernichon, actually i think this behavoir is because we don't reset the blacklist in every contract iteration in the function get_lines_dict(), so, as you described, rule will be in the blacklist for the next contract if it's the same rule.

I can write a fix for this in a few days, or if you want you can open a PR. The only change needed is to include blacklist reset inside the contract loop in that function.

github-actions[bot] commented 8 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.