Skip to content

[IMP] payroll: expose a cooperative monthly cash wage input - #49

Closed
votrelec wants to merge 2 commits into
Data-Dance:19.0from
votrelec:agent/monthly-cash-wage-input-20261116
Closed

votrelec wants to merge 2 commits into
Data-Dance:19.0from
votrelec:agent/monthly-cash-wage-input-20261116

Conversation

@votrelec

@votrelec votrelec commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Provide a cooperative monthly wage input for OCA payslips. BASIC resolves it inside the monthly branch before the existing calendar and absence proration; probable hourly earnings use the same amount when the determining quarter has insufficient worked time. A qualifying quarter keeps its historical average, and hourly pay retains its own calculation.

Default behavior reads the native contract wage. Integrations own the review and evidence for their supplied amount and implement a pure hook of the payslip and supplied contract, including repeated calls for dated segments. This is an OCA seam; Enterprise has a different paid-amount producer.

Validated on fresh Odoo 19 Community with stock OCA payroll, sk_SK and the declaration/surcharge modules: 338 tests, 0 failures, 0 errors, actual exit 0. Includes native insurance/tax/NET, proration, hourly pay and real holiday compensation with both probable and actual-quarter averages. Version 19.0.1.26.1 follows #48. Source documentation is updated; generated pages remain for the maintainer's generator.

@Rad0van

Rad0van commented Nov 16, 2026

Copy link
Copy Markdown
Member

Thank you for this one, it is a small and well-placed seam. Resolving the monthly amount once inside the existing monthly branch of l10n_sk_basic_salary is exactly where it belongs: proration by hours, the absence subtraction and a caller-supplied segment divisor all keep working unchanged, the hourly branch never sees it, and the method is private, so it cannot be called or set over RPC. It applies cleanly on top of current 19.0 (19.0.1.25.2).

What we ran: a fresh Odoo 19 Community database with OCA payroll, sk_SK loaded, l10n_sk_hr_payroll_oca + l10n_sk_hr_payroll_surcharges_oca, tests for l10n_sk_hr_payroll_oca, l10n_sk_hr_payroll_base and l10n_sk_hr_payroll_surcharges_oca, without demo. Plain 19.0: 0 failed of 243. With the PR: 0 failed of 246. As a negative control we bypassed the hook in BASIC (back to contract.wage) and kept your tests: the insurance/tax test and the proration test both fail, so they really bite. The engine parity check passes and every changelog parses.

One change we would like before we port it, and two small things on the docs side.

1. The pravdepodobný zárobok fallback still reads the contract wage. l10n_sk_average_hourly_earnings() falls back, when the determining quarter has fewer than 21 days / 168 hours (§ 134 ods. 3), to self._l10n_sk_version().wage / sched_hours. With the hook returning a different amount, BASIC is cut on the supplied wage while the holiday and obstacle náhrada for the same hours are paid at the contract wage, so the "GROSS made whole" invariant that the BASIC rule comment and test_holiday_nahrada_no_proration_cut rely on no longer holds. Concretely: contract 2 000, hook 2 500, no prior quarter, five days of dovolenka in June 2026 (Mon–Fri, 176 h) gives BASIC 1 931.82, DOVOLENKA_NAHRADA 454.54 (40 h × 11.3636), GROSS 2 386.36 instead of 2 500. Routing the fallback through the same hook, round(self._l10n_sk_monthly_cash_wage(self._l10n_sk_version()) / sched_hours, 4), gives PHZ 14.2045, náhrada 568.18 and GROSS 2 500.00, and the l10n_sk_hr_payroll_oca suite stays green with it. It is also the better reading of § 134 ods. 3: the probable earnings are what the employee would probably earn, and a reviewed monthly wage for this payslip is a better estimate of that than the contract figure. Please add that line plus a test for this case (your proration test pattern with a real DOVOLENKA leave and no _seed_prior_quarter works). Where the quarter does have enough time, the average comes from past GROSS, which already contains whatever the hook supplied in those months, so nothing else needs to change there.

For completeness, the other places we checked do agree with BASIC: the minimum-wage top-up in the surcharges module compares categories.BASIC, so it follows the hook (a supplied amount below the claim is topped up, which is right); social and health insurance, the health minimum, tax and the bonus all read categories; sick pay is on the DVZ, not the wage; the declaration modules (RLFO, ELDP, MVP, VPP, the annual reconciliation and the monthly overview) do not read the contract wage at all; and the recorded fund evidence stores the bases the rules actually charged, so it stays consistent with the supplied amount. The only remaining version.wage reader is the surcharges module's data-entry warning on the contract form, which is a contract-level check and fine to leave.

2. The user-facing paragraph sits at the top of the page. The new paragraph in doc/en.md and doc/sk.md is the first paragraph of the body, so after regeneration it becomes the first thing in README.rst and in the Apps screen description, ahead of the sentence saying what the module is. A payroll officer cannot act on it either. we would keep it in doc/DEVELOPER.md only (your note there is good) and drop it from en.md/sk.md, keeping just the verified: bump. Related: the generated pages were not regenerated, so gen_module_docs.py --check --strict goes from 25 to 28 errors (README.rst, index.html, index_sk.html out of date); we regenerate on our side when porting, so there is no need to hand-edit README.rst.

3. Two notes for DEVELOPER.md. First, the hook can be called more than once per payslip: an integration that overrides l10n_sk_basic_salary for dated segments calls super() per segment, and each call resolves the hook again with that segment's contract. Please say it must be a pure function of the payslip and the contract it receives, with no side effects. Second, say that it is an OCA-engine seam: on Enterprise the BASIC rule reads payslip.paid_amount, built from the worked-day line amounts, which read the version's wage directly, so there is no single equivalent hook there today and we are not mirroring it in l10n_sk_hr_payroll_ee for now.

Small things: the CHANGELOG entry should also get a line under Carry-over to 18.0 (on 18.0 the contract is hr.contract, and the fallback fix from point 1 goes with it), and if #48 lands first, which takes 19.0.1.26.0, this one becomes 19.0.1.26.1.

Verdict: changes needed, all small. With point 1 and its test it is ready to port; points 2 and 3 are docs and we are happy to fold them in on our side if you prefer.

Keep sufficient-quarter averages historical, cover real holiday compensation in both routes, and document the pure OCA seam. Leave generated pages for the maintainer generator.

Assisted-by: OpenAI Codex
@votrelec

Copy link
Copy Markdown
Contributor Author

Addressed in 93bbfe1. The insufficient-quarter probable-earnings fallback now uses the same monthly wage input. A real five-day holiday with contract 2000 and supplied 2500 gives BASIC 1931.82, compensation 568.18 and GROSS 2500. A second test retains the sufficient-quarter historical average and compensation 454.54.

Fresh Community regression with sk_SK and the declaration/surcharge modules: 338 tests, 0 failures, 0 errors, actual exit 0. The contract remains unchanged. Version and verified markers are 19.0.1.26.1 for the ordering after #48. Developer notes cover repeated pure calls, dated segments and OCA-only scope. The integration paragraph is removed from both user pages; generated README edits are reverted. Carry-over to 18.0 includes the fallback. Please regenerate the pages with your generator when porting.

@Rad0van

Rad0van commented Nov 17, 2026

Copy link
Copy Markdown
Member

Thank you, verified: the fallback now uses the supplied wage. Merged into our 19.0 as 49a8dcf6. Your commits were squashed into one under your name (68ae2240), because the series met #48's version and documentation changes and your branch's changelog predated #48's release section. The code, tests and DEVELOPER.md are byte-identical to your head; the changelog entry, the 19.0.1.26.1 version and the carry-over line were written onto the current file. On top of it (c2957cc5): pages regenerated. 284/284 with sk_SK loaded (OCA, surcharges, MVP, VPP, parity). The change reaches this repository with the next sync. Closing here.

@Rad0van Rad0van closed this Nov 17, 2026
Rad0van pushed a commit that referenced this pull request Nov 17, 2026
6 source commit(s) since c9b9b201, 4 of which changed a module here.

* [FIX] l10n_sk_vehicle_tax: keep test imports out of production startup
  acda30bb — l10n_sk_vehicle_tax

  The module's __init__ imported its tests package, so a normal server
  start loaded the test framework and logged an ERROR even with testing
  disabled. The business entrypoint now loads the models only; Odoo's
  native test loader still discovers the suite.

* [IMP] l10n_sk_vehicle_tax: release section and pages as in cssk-public #52
  5de3907f — l10n_sk_vehicle_tax

  The fix becomes the dated 19.0.1.0.1 release, in English like the rest of
  the changelog; the startup note moves out of the user pages (it is about
  how the module is loaded, not about filing); pages regenerated.

* [IMP] l10n_sk_hr_payroll_oca: cooperative monthly cash wage input
  68ae2240 — l10n_sk_hr_payroll_oca

  _l10n_sk_monthly_cash_wage(contract), defaulting to the contract wage,
  is resolved once in the monthly branch of BASIC, so an integration can
  supply a payslip-specific monthly amount without editing the contract;
  proration, insurance and tax follow it, hourly pay is unchanged. The
  § 134 ods. 3 probable-earnings fallback uses the same amount, so holiday
  and obstacle pay keep GROSS whole.

* [IMP] l10n_sk_hr_payroll_oca: pages as in cssk-public #49
  c2957cc5 — l10n_sk_hr_payroll_oca

207 modules in this repository.

Co-authored-by: votrelec <votrelec@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants