Repository navigation
feat(payroll): effective-dated salary component allocation on SSA - #2
Merged
Merged
Conversation
Per-component salary amounts on the Salary Structure Assignment, changeable from a date, and read correctly by payroll for each period. Each component gets its own Currency field on the assignment (HRA, Transport, Other, plus core `base`, and a read-only Total). On the SSA form each carries a history button and a change button. Changing a component does not rewrite the submitted assignment. It creates the next one: a new submitted SSA dated from the effective date, carrying every other value forward including payroll_payable_account, without which a Payroll Entry silently drops the employee. That is what makes payroll correct. hrms picks the assignment for a slip with `from_date <= <slip start> ORDER BY from_date DESC` and merges every field of that row into the salary-formula namespace, so a slip reads the amounts in force for its own period and regenerating an old slip reproduces its original figures. Notes on the mechanics: * Mid-year tax openings (taxable_earnings_till_date, tax_deducted_till_date) are cleared on the new assignment. get_opening_for() only ignores them while from_date < payroll_period.start_date, so carrying them into a later assignment in the same period would re-arm a stale opening on every remaining slip. * docstatus is reset explicitly after copy_doc: frappe.copy_doc only clears it when local.flags.in_test is false, so tests would otherwise insert straight at docstatus 1 and skip the draft-then-submit path. * Retro increments stay allowed - dating a change before already-paid periods is normal - but the call reports which periods it reached behind, since no arrears are created automatically. * A change is refused only when it would be meaningless: an assignment already starts on that date, or a later one already exists. * wire_salary_structure_formulas() points the Salary Structure earning rows at these fields, dry-run by default. Without it the values are stored and never read. It writes Salary Detail rows directly because amount_based_on_formula is not allow_on_submit and amending the structure would break linked assignments. The component fields ship as fixtures filtered on module TSI, and sit in their own section after payroll_cost_centers so they do not absorb core's fields. Not included, by design: the HR Suite Salary Breakup Table band lookup, the override ledger with its Pending/Applied/Superseded states, the daily scheduler, and any write into a submitted assignment.
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.
Per-component salary amounts on the Salary Structure Assignment, changeable from a date, and read correctly by payroll for each period.
Each component gets its own Currency field on the assignment (HRA, Transport, Other, plus core
base, and a read-only Total). On the SSA form each carries a history button and a change button.Changing a component does not rewrite the submitted assignment. It creates the next one: a new submitted SSA dated from the effective date, carrying every other value forward including payroll_payable_account, without which a Payroll Entry silently drops the employee.
That is what makes payroll correct. hrms picks the assignment for a slip with
from_date <= <slip start> ORDER BY from_date DESCand merges every field of that row into the salary-formula namespace, so a slip reads the amounts in force for its own period and regenerating an old slip reproduces its original figures.Notes on the mechanics:
The component fields ship as fixtures filtered on module TSI, and sit in their own section after payroll_cost_centers so they do not absorb core's fields.
Not included, by design: the HR Suite Salary Breakup Table band lookup, the override ledger with its Pending/Applied/Superseded states, the daily scheduler, and any write into a submitted assignment.