[18.0][ADD] payroll_rule_tag: tag salary rules and use tag totals in computations - #290
Open
nimarosa wants to merge 2 commits into
Open
[18.0][ADD] payroll_rule_tag: tag salary rules and use tag totals in computations#290nimarosa wants to merge 2 commits into
nimarosa wants to merge 2 commits into
Conversation
Contributor
Author
|
@dreispt @norlinhenrik @CristianoMafraJunior @pedrobaeza |
Member
|
You should squash your commits into less of them, as they are not adding value for the final result. |
nimarosa
force-pushed
the
18.0-add-payroll_rule_tag
branch
from
August 31, 2026 11:51
fe09f9a to
df7e940
Compare
Contributor
Author
|
@pedrobaeza Done ;) |
nimarosa
force-pushed
the
18.0-add-payroll_rule_tag
branch
from
August 31, 2026 11:59
df7e940 to
9063721
Compare
Member
|
Now you have squashed into one, removing @dreispt attribution. He should check as well the final state. |
Member
|
I mean there should be at least 2 commits: Daniel's one, and yours. |
Contributor
Author
|
@pedrobaeza I left @dreispt attribution in the commit. But okay, I make two commits if you thinl it's better. |
…ations Add hr.salary.rule.tag: a tag that groups salary rules so payslip computations can reference a total across the group instead of one rule at a time (payslip_lines_tag.<code>), which is what advanced structures such as final-liquidation or overtime computations need. - New model hr.salary.rule.tag with a resolved, unique, language-independent code (explicit code field, falling back to a normalized name), enforced by a company-scoped SQL/Python constraint so two tags can never collide on the same effective code. - hr.salary.rule <-> hr.salary.rule.tag is a proper many2many inverse pair (fixed the relation table mismatch that kept salary_rules_ids and tag_ids out of sync and salary_rules_count stuck at 0). - Multi-company support: tags are company-scoped with an access rule restricting them to their own company. - Kanban view migrated to the Odoo 18 "card" API (t-name="kanban-box" is deprecated and was logging a warning on every load). - Security: access rights for users/managers and the multi-company record rule. - Test coverage for tag defaults/code resolution, the uniqueness constraints, both sides of the rule/tag relation, access rights, the record rule, and the payslip tag-total behaviour (unknown tags, untagged rules, archived tags, recomputation). - Spanish (es, es_AR) translations and the OCA packaging (readme fragments, roadmap, contributors).
nimarosa
force-pushed
the
18.0-add-payroll_rule_tag
branch
from
August 31, 2026 12:16
9063721 to
4a4bfed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
payroll_rule_tag: Salary Rules can carry any number of Tags, and each tag'stotal is exposed to salary rule computations as
tags.<CODE>.Tags are a more flexible alternative to Salary Rule Categories: a rule belongs to a
single Category, but can carry any number of Tags, and tags may freely overlap. The
typical use is grouping rules into calculation bases — "Taxable", "Social Security",
"Benefits" — and computing each base as the total of the rules carrying that tag,
instead of repeating a list of rule codes in every formula:
Extraction note
Extracted from #174 (author @dreispt) to allow individual review/merge. The original
[ADD] payroll_rule_tagcommit is cherry-picked unchanged with its authorshippreserved; #174 bundles several unrelated modules, which is why this one never got
reviewed on its own.
Completed on top of the original module
Configuration and multi-company
Codefield, so the identifier salary rules use no longer has to be thetag name
company_idplus a multi-company record rule, list/kanban/search views, and ACLssplit between Payroll Officer (read) and Payroll Manager (full)
Fixes
salary_rules_idsdeclared an explicit relation table whilehr.salary.rule.tag_idsleft it implicit, so the two fields were backed by different tables instead of
being the two sides of one relation: tagging a rule never showed up on the tag's
Salary Rules page and
# Rulesstayed at 0. The fix drops the explicit parametersrather than adding them on both sides —
hr.payslip.lineprototype-inheritshr.salary.rule, so an explicit table ontag_idsis copied to it and the registryrefuses to build with two models sharing one many2many schema.
computed in a language having a translation for the tag resolved to a different code
than the one written in the rule.
BrowsableObjectreturns0.0for an unknown key,so this silently produced a wrong amount instead of an error. The fallback now reads
the source value.
another tag's normalized name) and silently accumulate into a single total. Added a
constraint rejecting duplicate effective codes per company; the existing SQL
constraints only caught exact matches.
t-name="kanban-box", which warns on every viewload in 18.0; migrated to the
cardAPI.Tests — 24 tests covering tag defaults and code resolution (explicit code,
normalized name, language independence), the constraints, both sides of the rule/tag
relation, ACLs and the multi-company rule, and the payslip behaviour: totals per tag,
unknown tags evaluating to zero, untagged rules staying out, totals summing line totals
rather than unit amounts, archived tags dropping out, and recomputing a payslip not
doubling the totals.
Packaging — version reset to
18.0.1.0.0(the module was never released), readmefragments completed (DESCRIPTION / CONFIGURE / USAGE / ROADMAP / CONTRIBUTORS), and
es/es_ARtranslations added.@dreispt this is your module — could you take a look?