Skip to content

[19.0][IMP] payroll: shared recorded fund core and OCA writer - #43

Closed
votrelec wants to merge 3 commits into
Data-Dance:19.0from
votrelec:feat/sk-payroll-fund-core
Closed

votrelec wants to merge 3 commits into
Data-Dance:19.0from
votrelec:feat/sk-payroll-fund-core

Conversation

@votrelec

@votrelec votrelec commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This replaces #34 with the shared evidence core requested in #34/#37. It records actual fund-rule values without changing premium arithmetic. Updated for the second review of #43 and rebased onto public sync afd668b6 (l10n_cssk@653c353d).

The base owns the signed shape and abstract identity/salary validation, without storage or an engine import. The OCA bridge owns one compact JSON field, records only within compute_sheet, and retains native signed/subcent/manual-credit-note behavior. Direct evaluation, caller flags and forged JSON cannot rewrite confirmed evidence. One statutory profile is stored per calculation, without birth numbers or copied worked-day/input histories. The separate Enterprise mirror remains with the maintainer.

MVP, VPP, health and ELDP use the framework's plural accessor. An engine without the recorder hook continues its original workflow, without a new warning or refusal. With a supported recorder, an original declaration names missing/inconsistent evidence and retains its existing gross-based calculation. A correction requires exact records by default. Access errors always propagate.

Old filed wages do not need recomputation just to prepare their correction. On a draft correction the accountant may record a reviewed reason and use the explicit confirmation action. The framework owns reviewer/time, source/input digest and chatter. Source, version, report-input or reason changes invalidate that approval; repeated approval is idempotent. Direct create/write/context-default forgery is rejected. The four insurance forms expose the warning and review action. Original payslips and filed XML remain unchanged. This is an audited review decision, not a claim that gross equals the historical statutory base.

Validation (overlapping suites are not summed):

  • Stock OCA 2eca6caa, without #330/#332: the initial full suite passed 279 tests. The final public-base run with optional wage-surcharge rules is reported in the follow-up review reply. The reference fixture excludes MIN_WAGE_TOPUP only from its own test structure; production rules are unchanged.
  • Seven affected modules with actual Slovak default language: 253 tests, zero failures/errors, including company-scope and historical correction cases. Native POT export/import, four compiled form views, loaded labels and Slovak errors passed; eight original glossary translations were preserved.
  • Two actual HTTP passes under the stock Payroll Officer, without System Administrator or Payroll Manager: missing-review rejection, forged reviewer rejection, reasoned approval, idempotent retry, generation, VPP XSD and unchanged original payroll/XML. The native Officer role itself implies HR Manager; that implication is retained.
  • A separate engine-neutral case checks original and corrective declarations with no reader hook. The native VPP integration covers the same policy. The earlier upgrade from unchanged public upstream retained payslip lines and archived XML without backfilling evidence.
  • Frozen fifteen-formula sources and AST/runtime comparisons retain native amounts, including fractional and negative cases. Consumer wire rounding and statutory arithmetic fixes remain separate contributions.
  • Three changelogs parse with docutils. User guides describe the accountant workflow; adapter/capability details live in DEVELOPER. Generated README files are restored, and the 18.0 carry-over is under Unreleased. The separate guide site and Enterprise runtime were not run locally.

Dependent OOP/cap ordering, health profiles/calendars and health calculation changes remain separate, to be forwarded after the corresponding source sync. Suggested guide topic: Recorded rule bases -> l10n_sk_hr_payroll_oca/doc/en.md#recorded-funds. No authority filing or acceptance is claimed.

@Rad0van

Rad0van commented Nov 10, 2026

Copy link
Copy Markdown
Member

Thank you, this is the shape we agreed: the record shape and checks in the base with no storage and no engine import, the OCA bridge writing its own records, and one plural accessor in the declaration framework. It also behaves well where we feared it might not:

  • with sk_SK loaded, the 281 tests in scope (base, OCA, declaration framework, MVP, VPP, ELDP, health) pass on stock OCA/payroll 19.0 as well as with your #330/#332, and also in English only and with demo data;
  • on Enterprise, MVP, VPP and health output is byte-identical with and without this PR;
  • upgrading a database from current 19.0 with confirmed payslips and archived filings succeeds, keeps every payslip line and every XML attachment unchanged, and new payslips afterwards store complete records whose amounts match their lines.

It still needs changes before we can merge it. In order of importance:

Blocking

  1. A payslip with a negative GROSS no longer computes. Every social and health rule builds a record unconditionally, and fund_assessment._decimal rejects a negative base (l10n_sk_hr_payroll_base/fund_assessment.py:29). assessment_base keeps a negative gross, so a correction payslip (a clawback input, a recomputed manual credit note) now raises a bare ValueError in compute_sheet. It computed before. Build records only when the slip is recording, and decide how a negative base is stored (sign or credit_note), rather than refusing the calculation.

  2. Core A changes premiums. The description says no output changes, but four amounts do, without a changelog entry and only on round-number fixtures:

    • GROSS is rounded half-up to the cent before the base is taken (social_assessment_profile.py:73, health_assessment_profile.py:223,275). With sub-cent GROSS (hourly wages, prorations) about 1 % of premiums move by 0.01.
    • The agreement OOP now comes off before the maximum (social_assessment.py:143-145). That order is the statutory one: § 138 ods. 1 reduces the agreement worker's base by the OOP, and the ods. 9 / ods. 10 maximum applies to that base. Both engines have it the other way today, so this is a real fix (an agreement at 17,100: base 16,564 before, 16,764 now).
    • The health OP is rounded up to the cent (health_assessment.py:74), on the strength of an insurer's guidance only. Please cite § 16 of 580/2004 or the methodology that requires it.
    • DoVP/DoPČ of pensioners and DoBPŠ become automatically health-exempt, whatever the manual flag says (health_assessment.py:22-30, health_assessment_profile.py:199). It matches § 10b ods. 1 písm. a) of 580/2004, but it changes the result for every customer who never ticked the flag. SERVICE_AT_AGE is not distinguished by the age condition, and the field's help text is rewritten on the OCA side only.

    None of this is mirrored in the Enterprise rules, so the two engines would compute different premiums. Please take these out of [19.0][IMP] payroll: shared recorded fund core and OCA writer #43 into a separate, disclosed [FIX] PR with tests that compare the old and new amounts on non-round inputs. We'll mirror the ones we accept on Enterprise in the same merge. Core A should keep today's arithmetic exactly.

  3. New refusals in compute_sheet block payroll that works today. A payslip spanning two months or with a version/company mismatch (fund_assessment.py:121-138), a social profile that changes within the month (social_fund_records.py:256-266), a PN_DAYS input that disagrees with a dated PN leave while the rule still lets the input win (health_fund_records.py:43-52), two versions resolved for a slip without contract_id (fund_assessment.py:202-207), and an opt-out without a notice reference (health_assessment_profile.py:177-188) all raise now. In A such a slip should simply stay unrecorded: it then counts as missing, and the declaration warns or refuses under the policy. Payroll itself must not stop.

  4. The "old precise evidence" adapters read data our repository never had. l10n_sk_health_assessment_snapshot, l10n_sk_social_assessment and l10n_sk_social_confirmed_at (fund_assessment.py:45-59) and the 178-line legacy_fund_assessment.py read the shape of your earlier [FIX] l10n_sk_hr_payroll: retain individual social fund bases for MVP #37 branch, which was never merged. Here they are new, always-empty columns and code we would carry forever. Please drop them; if your own installation needs them, a migration in your fork fits better.

Should fix

  1. get_lines_dict() / _get_payslip_lines() rewrite the evidence of a confirmed payslip (fund_assessment.py:211-226): localdict_hook writes complete: False whenever rules are evaluated, so one RPC call on a done slip makes every later read fail with "Recalculate…". Write evidence only under a context flag set by compute_sheet.
  2. The birth number is copied into the JSON (social_fund_records.py:198, health_fund_records.py:86, fund_assessment.py:152), and l10n_sk_fund_assessment has no groups=, while identification_id is an HR-officer field. Drop the copies, or at least restrict the field to payroll users.
  3. The full social profile, including the 12-entry applicable map, is repeated in each of the 12 social records next to all salary lines, inputs, worked days, versions and absences. Please measure the size per payslip and store the profile once.
  4. Recording depends on struct_id.country_id.code == "SK" (fund_assessment.py:86), so a customer's own structure without a country records nothing and silently falls back. Gate on whether the rules emitted records instead.
  5. _effective_fund_payslips in the declaration framework (fund_bases.py:130-160) pairs refunds by the OCA field refunded_id. Enterprise refunds use origin_payslip_id and negated lines, so there it silently does nothing. Move the pairing behind a bridge hook.
  6. The policy is a caller flag, and nothing calls it yet. _collect_payslip_fund_bases takes allow_fallback from each caller, and no declaration calls the accessor in this PR. We checked: a new MVP for a pre-upgrade month shows no warning, and a corrective VPP doesn't refuse. Called directly, the helper does exactly what we agreed. Please put the decision in the framework (filing kind → fallback with warning, or strict), so the declaration PRs only ask for records. Also, inconsistent evidence (a manually edited line) currently raises inside the accessor and stops the whole monthly original. We'd rather it count as missing (warning) for an original and refuse only for a correction.
  7. refunded_id = fields.Many2one(copy=False) (fund_assessment.py:41) changes a native OCA field. It's defensible, but it belongs in OCA/payroll.
  8. test_sk_payroll.py:2054 replaces the manual copy(credit_note) + compute_sheet with refund_sheet(). It passes on stock OCA too, but please say why the old path had to change, since it was the scenario under test.

Minor

  1. Scope: several pieces belong to the later PRs and are dead code without them. From B: the calendar hooks (_l10n_sk_health_calendar_context, l10n_sk_health_calendar_minimum, the concurrent-OP suppression, the calendar branch of HEALTHDOPLATOK). From C: health_day_source.py. From the locking PR: fund_absence_facts.py, l10n_sk_fund_confirmed_at, the unused _l10n_sk_write_fund_values and the current=True source checks. The § 16a ods. 5 opt-out fields and the new group on the contract form are a new feature. social_assessment*.py and the employee/employer parts of health_assessment*.py are legitimately A.
  2. About eight extra searches per payslip (_l10n_sk_health_day_facts runs once per health rule and twice more through the source facts); cache them per compute.
  3. Conventions:
    • the changelogs again lack Added/Changed/Fixed sections, and the OCA heading underline is --- among ===;
    • add a carry-over note for 18.0;
    • vz_base help now says "Assessment base used for this employee declaration" while the value is still GROSS;
    • _payslip_fund_bases is called a compatibility reader, though nothing existed before it;
    • the commit message has missing spaces ("suite230/0/0").
  4. The tests mostly check that a record equals its line. Add tests that pin the rule amounts against the pre-PR formulas on non-round inputs; those would have caught point 2.

For planning: the Enterprise half (storage and guard on the Enterprise payslip, capture in its rule loop, records from the 12 social rules and the health overrides, refund adapter, mirrored tests) is about 4–6 days for us, of which 1.5–2 depend on which arithmetic changes from point 2 we take. We'll start once points 1–4 and 10 are settled.

@votrelec

votrelec commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Thank you for checking stock OCA, Enterprise and an upgrade with retained data, and for the concrete counterexamples. The arithmetic changes did not belong in core A. I am separating them into a disclosed FIX contribution; they will need the agreed Enterprise mirror before acceptance. A will retain the exact current formulas, including their current OOP/cap order and rounding. The local instrumentation now asserts that each of the fourteen original rule ASTs is an unchanged prefix, and the tests compare complete payslip lines against fifteen frozen pre-PR rule bodies on sub-cent and negative inputs.

The local A rewrite retains signed bases and signed charges. Recording is enabled only by an in-process capability carried by compute_sheet, so direct get_lines_dict/_get_payslip_lines calls (including forged JSON context flags) cannot rewrite evidence. Unsupported optional metadata remains missing rather than stopping native calculation. The new, never-upstream legacy columns/adapters are removed, as are the calendar/minimum-opt-out feature, source checks, absence facts, confirmation timestamp and the native refunded_id override. The original native manual credit-note test is restored unchanged.

The bridge now stores one compact statutory profile per calculation, with no copied birth number, inputs, worked-day or absence payload. Rules are detected by emitted records, not by the structure's country. Refund pairing and direction are bridge hooks; the declaration framework no longer assumes OCA's refunded_id field. I am measuring the JSON size in the native tests.

For point 10, I am following your newer policy explicitly: the framework decides original versus corrective handling, and invokes the accessor during the common totals collection. Missing or inconsistent evidence warns on an original and refuses a correction; access failures are not downgraded. There is no caller allow_fallback switch. Country declaration contributions can then consume the collected records without reimplementing the policy.

The coherent revision is now published as 7fd622f. Clean stock OCA with all insurance forms passed 246 tests, followed by a 25-test target including the frozen-formula AST contract; the engine-free base passed 31 tests and OCA without the optional declaration framework passed 191. Native SK field/two-module error probes and CS references passed. An actual stock-upstream-to-core upgrade preserved every original line and two XML hashes without backfill, while a new calculation produced fourteen matching records. The JSON fixture is about 3.6 kB. Changelog sections, carry-over note, catalogs, docs and commit wording are updated; no calendar/day searches remain in A. Arithmetic fixes remain separate work.

@votrelec

votrelec commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

The separate OOP-before-maximum FIX is updated after the review: votrelec#2, now 6118abb on core #43/b581c64a.

The guides/changelog include TAXBASE, INCOMETAX and NET effects: old-age DoPC at 17,100 has employee insurance +8, tax withheld -2.80 and NET -5.20; student DoBPS at 19,000 has NET -9.10 in the same 35% marginal tax band. Carry-over is under Unreleased, the generated README is preserved and the optional minimum-wage fixture fix comes from the updated core.

Full clean stock OCA with the surcharge module and all four insurance declarations passed 306 tests with zero failures/errors. RST parsing passes. The five-rule arithmetic change remains separate from capture and calendar work. As agreed, please mirror those five Enterprise overrides in the coordinated merge; no Enterprise run is claimed here. I will forward this contribution upstream after the core source sync.

@votrelec

votrelec commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Calendar contribution B is now separated from the evidence-only core and the monetary/codec changes: ready dependent contribution, commit 110c2d6 on #43 at 7fd622f. The fork base keeps the review diff limited to B; I will rebase and forward it here once #43 reaches public 19.0.

It provides the engine-neutral reviewed calendar/source API, immutable revisions and company/concurrency guards. It distinguishes same-employer 2P from other-employer minimum opt-out and retains 2S strike facts with separate reviewed no-income/benefit intervals. Real bridge-field tests reject a disability conflict while accepting disability beginning within the month. No premium formula, fund-record shape or 514/601 wire format is changed.

Independent base 61, clean stock OCA 251 and actual Slovak-default base 61 tests pass with zero failures/errors (overlapping). Native POT/SK has no missing entries. Ordinary HR-manager HTTP/UI review/revision/immutability and composed Slovak error pass twice without system-administrator/payroll-officer rights. EN/SK docs and 18.0 carry-over are included; Enterprise and the private guide generator were not run.

Next public pieces remain the separate 514 codec/consumer and 601 rebase/source checks discussed in the reviews. The arithmetic fixes stay separate. If you prefer a different location for the factual calendar API, I can align those consumers before forwarding B.

@votrelec

votrelec commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

The separate statutory health-profile FIX is ready at dependent fork PR4, on this core at 7fd622f. It derives DoBPŠ and eligible pensioner DoVP/DoPČ exclusions, separates ordinary pensioner premiums from state-insuree minimum relief, and applies recognised-invalidity reduced rates without another ZTP checkbox. Individually selected other exclusions retain a dated basis and receive readable validation before rule evaluation.

The final matrix on unchanged original production code reproduces 22 failing subcases across three tests, with zero errors. Corrected stock OCA 228, independent base 35 and actual Slovak-default base/OCA 201 tests pass (overlapping, four existing optional-framework/demo skips). Ordinary-officer HTTP passes twice for five profiles, including invalidity; rejected retries preserve the calculation. The original formula JSON stays unchanged, with twelve unaffected formulas pinned and independent output checks for the three changed health rules.

Profile4 itself does not change OP rounding/proration, social OOP order, calendar monetary integration or declaration formats. Enterprise still needs the corresponding rule calls to the shared base predicates; it was not run here. After this core reaches public 19.0 I will forward the independent OOP2, calendars B3 and health-profile4 contributions here. The core branch remains evidence-only.

The separate calendar calculation FIX5 is now also ready, against a merged B3/profile4 dependency base so its review diff excludes those prerequisites. It connects distinct OP/minimum days, upward OP cent rounding, concurrent employers/SZCO and disability-month rates; it preserves the native premium rounding and no-calendar PN workflow. Stock OCA273, base68 and actual Slovak-default246 tests pass (overlapping), plus ordinary-officer HTTP twice for ten profiles with readable errors and unchanged calculations after rejected retries. Please mirror the shared calculation API in Enterprise. I will forward5 here after its prerequisites are source-synced, then continue the separate514/601 consumers and explicit multi-source income allocation. No unrelated engine arithmetic is added to this evidence-only core.

@Rad0van

Rad0van commented Nov 11, 2026

Copy link
Copy Markdown
Member

Thank you for the revision. It is a much smaller and clearer change than the first round: the base owns only the record shape, the OCA bridge records during compute_sheet and nowhere else, the never-merged columns are gone, and the declaration framework owns the policy. We checked the claims from your two replies one by one, on our current 19.0 (653c353d) with stock OCA/payroll 19.0 at 2eca6caa and sk_SK loaded. Almost all of them hold. Two things still block the merge, and both are small. We also ask for one addition (point 3).

What we verified

  • Premiums are unchanged. We built nine employees on the old code: sub-cent income (1,234.567, 964.995 with the health OOP, 650.555 on a DoBPŠ), a clawback that makes GROSS −1,800.25, a computed manual credit note, 25,000.129 above the maximum, and three agreements with the pension OOP above the maximum (16,900, 17,100, 19,000). For each employee, one payslip was confirmed and an identical one left in draft. After upgrading to this PR, we recomputed the drafts. All their lines are byte-identical to the old code (amount, quantity, rate and total of every line, 21 to 27 lines per payslip).
  • Negative GROSS and credit notes compute and are recorded with their signs (accident base −1800.246, pension charge −72).
  • The upgrade keeps everything. The lines of the nine confirmed payslips are unchanged, the MVP XML archived before the upgrade has the same sha256, and nothing was backfilled. The only new column is hr_payslip.l10n_sk_fund_assessment. None of the [FIX] l10n_sk_hr_payroll: retain individual social fund bases for MVP #37 names remain: l10n_sk_social_assessment, l10n_sk_health_assessment_snapshot, legacy_fund_assessment.py, the calendar, absence and day-source code, l10n_sk_fund_confirmed_at, and the refunded_id override.
  • The recording cannot be triggered over RPC. We ran a real server and called it over JSON-RPC. On a confirmed payslip, get_lines_dict with _l10n_sk_fund_capture forged as true, as {"supported": [id], "rows": {}} and as a pseudo-class dict left the evidence unchanged. write, create and copy with a default_ context are refused with "Fund evidence is generated by payroll calculation.", and _cssk_recorded_fund_bases cannot be called remotely.
  • No new refusals in compute_sheet. In the payroll path, the only raises left are the guards against writing the generated field. A cross-month slip, a custom quantity and invalid metadata all compute and stay unrecorded.
  • The policy behaves as agreed on OCA. We generated a real MVP original for the pre-upgrade month. Its XML is byte-identical to the archived one, and the warning names all nine payslips, posted once in the chatter. A corrective refuses. There is no caller flag, and AccessError is not swallowed: only FundEvidenceError is caught.
  • The JSON is 2.3–3.7 kB per payslip, with no birth number in it. The SK catalogues are complete and load: the Slovak field labels read back from the database, and the corrective refusal is raised in Slovak.
  • Your tests catch regressions. With the capability check loosened to bool(capture) and the correction refusal disabled, four of your tests fail. Restored, they pass.

Test counts with sk_SK. "Full set" means every SK payroll module on the OCA side (surcharges, garnishment, income allocation/settlement, RLFO, annual and monthly tax reports, parity), 17 test tags:

full set your set (OCA + MVP/VPP/health/ELDP)
19.0 before 453 tests, 0 failed, 3 errors —
#43 482 tests, 3 failed, 3 errors 247 tests, 0 failed, 0 errors
Enterprise before 253 tests, 2 failed, 22 errors
Enterprise with #43 264 tests, 2 failed, 24 errors

The 3 CE errors and the 24 Enterprise ones present before the PR (parity scenarios and TestHealth514 under sk_SK) are ours and unchanged by this PR.

Blocking

  1. On Enterprise, every corrective VPP now refuses, and every original warns about all of its payslips. Enterprise payslips have no _cssk_recorded_fund_bases yet, so _payslip_fund_records counts all of them as missing. TestVpp.test_corrective_full_replacement_and_retained_original and test_prefill_never_guesses_between_multiple_filed_candidates now fail on Enterprise with "Tento výkaz vyžaduje presné zaznamenané základy fondov … Payslip, Payslip". The owner's decision covers payslips that could carry records and don't. An engine with no recorder at all should behave exactly as it does today until its half lands. Please apply the policy only to payslips whose model implements the reader (no warning and no refusal otherwise). The two existing VPP tests then cover it on both engines. Please also add an engine-neutral test that a slip without the hook is neither warned about nor refused.

  2. Three of the new tests fail when l10n_sk_hr_payroll_surcharges_oca is installed, as it is in our full run and in any CI that installs the repository. Its minimum-wage top-up (§ 120) raises the fixture's full-time wage of 500 to 915:

    • test_non_round_premiums_pin_the_native_amounts: HEALTHEMPLOYER 100.64 ≠ 41.79
    • test_positive_base_with_zero_rounded_premium_is_not_missing: ('915', '12.81') ≠ ('0.06', '0')
    • test_subcent_input_reaches_actual_gross_without_rounding_away: 915.003 ≠ 500.123

    The low-income cases of test_arithmetic_matches_disclosed_reference_on_non_round_income still pass there, but they silently test 915 + x instead of 0.06 … 569.999. Please make the fixture independent of the minimum wage: remove MIN_WAGE_TOPUP from the test structure when it exists, or use incomes above the minimum and an agreement for the small amounts. The same fix carries over to Add Origin header to ORSF sign-in request #2.

A way out for corrections of older months

  1. On OCA, a corrective VPP for any month calculated before this upgrade can never be generated. Those payslips carry no recorded bases, and recomputing them to get some can change amounts that were already filed, so the refusal has no recovery route. Please add one: an explicit confirmation on the corrective declaration (for example a checkbox "File without recorded fund bases" with a required reason), which lets the correction fall back to gross like an original does, names the payslips in the warning, and records who confirmed it and when in the chatter. Without the confirmation the refusal stays as it is, and the framework keeps owning the policy (no caller flag).

Should fix

  1. The documentation is written for developers. doc/*.md becomes the user guide and the Apps description, and its readers are payroll accountants. "Direct get_lines_dict/_get_payslip_lines calls, including forged JSON context flags", "bridge" and "plural accessor" mean nothing to them. Please say what is recorded, when (each payslip calculation), where it shows (the warning in the declaration's chatter), and what to do when a filing refuses. The Czech page of the declaration base ("Plural čtečka", "patří bridge") needs the same rewrite. The developer notes can go in doc/DEVELOPER.md.

  2. Changelogs and README:

    • l10n_sk_hr_payroll_base/CHANGELOG.rst no longer parses. Your release heading uses = after the file's - level, and tools/check_changelogs.py reports "Title level inconsistent" at the Added/Fixed headings.
    • The 18.0 carry-over note belongs under [Unreleased] → Carry-over to 18.0. The OCA changelog already has that section; please add a bullet there instead of a subsection in the release.
    • The "Changed" entries ("Arithmetic corrections … are separate contributions") describe what did not change. Please drop them.
    • README.rst is generated from doc/en.md by our tooling, so the hand-added "Recorded payroll funds" sections will be overwritten. Please leave README.rst alone.
  3. The re-export changed eight existing Slovak translations unrelated to this PR: Draft "Koncept" → "Návrh" (core uses "Koncept"), "Vytvorené dňa" → "Vytvorené", "Naposledy upravené dňa" → "Naposledy upravené", "Vytvoril(a)" → "Vytvoril", and "Pracovná zmluva zamestnanca" → "Zmluva / verzia zamestnanca". Please keep the existing msgstr and add only the new entries.

Minor

  1. The recorded base keeps float artefacts: "-1800.2460000000005", "450.55499999999995". That is faithful to the float the rule used, but a declaration consumer must not report it as is. Note also that § 138 ods. 14 rounds the vymeriavací základ to the cent downwards, which today's rules do not do either. That belongs in the arithmetic FIX series (and if cent rounding is proposed there again, it is nadol, not half-up), but please say in the docstring that consumers round.
  2. fund_bases_warning is on no form, so the chatter post is the only place the warning shows. Its label is translated on the mixin but not on l10n.sk.mvp / vpp / health / eldp (read back empty in sk_SK). A banner on the declaration form would be clearer. If you add one, the Slovak label needs those modules' catalogues too.
  3. _collect_payslip_fund_bases checks the payslips' company twice (once before the loop and again inside it).

What we will do at merge: cs.po for the new strings (the declaration base picked up four inherited fields that have no Czech translation yet), the guide/topics.yaml entry, the regenerated pages, and the Enterprise half as planned, starting once points 1 to 3 are in.

We have seen your dependent fork PRs #3 (calendars), #4 (health profiles) and #5 (calendar calculation). We will review them once #43 is merged and they are forwarded here, in the order you propose. Our review of the arithmetic fix #2 is on that PR.

Keep signed rule values and a single compact profile in the OCA bridge, generic validation in the base, and original/corrective policy in the declaration framework. Do not stop native calculation for optional metadata, rewrite evidence during rule reads, copy birth numbers, or introduce never-upstream legacy columns. Keep arithmetic fixes, calendar features and lifecycle controls separate.

Validated clean stock OCA with all insurance forms: 246 tests, no failures/errors, one existing demo skip. Additional stock target: 25 tests. Engine-free base: 31 tests. Actual upstream-to-core upgrade preserves confirmed salary lines and two exact XML archives; new calculation records fourteen matching funds. Native SK field/error probes, POT/SK/CS catalogs and AST/runtime formula parity passed.

Assisted-by: OpenAI Codex
…d wages

Preserve unsupported-engine workflows, protect reasoned legacy approval, test optional wage top-ups and retain native translations.

Assisted-by: OpenAI Codex
@votrelec
votrelec force-pushed the feat/sk-payroll-fund-core branch from 7fd622f to b581c64 Compare November 11, 2026 14:48
@votrelec

Copy link
Copy Markdown
Contributor Author

Follow-up to the second review of #43: updated at b581c64a, rebased onto public sync afd668b6 / private source 653c353d.

  1. A missing/noncallable recorder hook now leaves the original engine workflow unchanged, including corrective declarations, with no new warning. A supported hook returning missing evidence still uses the explicit original/corrective policy. An engine-neutral test and native VPP integration cover both distinctions; AccessError is not swallowed.
  2. The reference TestRecordedFundPayroll structure alone excludes the optional MIN_WAGE_TOPUP, leaving production minimum-wage behavior untouched. The final full stock-OCA run with l10n_sk_hr_payroll_surcharges_oca installed passed 302 tests, zero failures/errors. A separate no-engine installation passed 34 tests. This does not claim Enterprise coverage.
  3. Draft legacy corrections have a framework-owned review action and reason. It checks write access and company scope, records actual reviewer/time and chatter, and binds approval to the report inputs, actual wage lines and employment-version facts. Edits invalidate approval. Repeating the same valid confirmation does not change its time or duplicate chatter; unchanged reason writes retain it. Generated values and context defaults cannot forge approval. The four insurance forms expose the warning/reason/action. Old payroll is not recomputed or backfilled.

Two actual HTTP passes under the native Payroll Officer verified rejection without approval, rejection of forged reviewer, review, idempotent retry, generation/XSD, unchanged original payslip and unchanged filed XML. The role is neither System Administrator nor Payroll Manager; stock OCA itself makes it imply HR Manager. Actual Slovak-default tests across the seven affected modules passed 253 tests, with loaded labels/errors and all four compiled forms checked. These suites overlap and are not summed.

The generated root README files are restored. Accountant-facing EN/SK (and shared CS) guides now describe the retained values, warning and explicit review; protocol/capability details are in DEVELOPER. The original eight existing SK translations are restored and the native export merge preserves them. Changelog RST hierarchy was corrected and parsed with docutils; carry-over is under Unreleased and negative Changed claims were removed. Raw recorded precision is documented as requiring consumer statutory rounding, separate from arithmetic FIX contributions. The duplicate outer company check was removed; the explicit approval action checks company scope independently.

The separate guide generator and Enterprise runtime were not available locally. Please proceed with the corresponding Enterprise mirror when this framework policy fits your integration. Dependent #2–#5 in the fork remain separate; I will forward/rebase them after source sync, with the same fixture correction and documented NET/TAXBASE/INCOMETAX impact in the OOP change.

@votrelec

Copy link
Copy Markdown
Contributor Author

Health statement follow-up is ready at votrelec#8 (cf2dd96), on the reviewed calendar/calculation dependency. This supplies actual retained assessment/profile XML and published UTF-8 text514, historical insurer and per-insurer payer snapshots, complete registered-person/source coverage and the N/O retention workflow.

The architecture keeps source semantics in the shared country base, invocation before new compute/capture in the engine, and wire/profile requirements in the form. It does not put an unconditional live-HR validator on historical profile reads. Missing exact coverage preserves known monetary evidence and follows the original-warning / explicitly audited legacy-O policy; the profile participates in the review digest. Frozen contract coverage prevents an employee-wide calendar from concealing a second unprocessed employment. The required Enterprise calls are documented for the mirror; I do not claim an Enterprise run.

The final Community suite passes 385, actual Slovak 358, no-engine 115. Separate independent rollback probes, two new PayrollOfficer HTTP workflows and a real old1.2.3→final1.4 upgrade pass, preserving filed bytes and source salary/fund evidence. Eight-patch tree restoration also passes.

The remaining cumulative-remuneration arithmetic and source/confirmation controls associated with #37 stay separate. The intention is cooperative calculation from native payslips and retained actual charges, with monthly OOP/caps applied once and no parallel payroll ledger or blanket ban on a second remuneration. I will forward the dependent statement/calendar contributions after the core/base source sync, removing duplicate dependency commits.

@votrelec

Copy link
Copy Markdown
Contributor Author

The next declaration follow-up is prepared at votrelec#9. It adds full corrective MVP filings and shared validation of filing-type and period projections, using the existing framework and engine-owned records. The diff is limited to declaration base and MVP, with 50 selected native tests (one optional registry case skipped) and a separate 14-case automated retake. It is temporarily stacked over the reviewed monthly foundation; after the #43 source sync I will forward the focused follow-up here under CONTRIBUTING. Any architectural guidance on that common validation hook is welcome.

@votrelec

Copy link
Copy Markdown
Contributor Author

A focused monthly tax-overview follow-up is ready for review: votrelec#10. It is stacked on votrelec#9 so the diff stays limited to the overview module. It adds signed bonus corrections, reviewed conditional form entries, retention of filed quarterly facts, and audited legacy filing chronology within the existing declaration workflow. A clean OCA Docker installation passes 37 tests, including the unchanged partial-order regression; the official XSD bytes are preserved. After #43 returns through the generated source sync, this can be forwarded as a focused upstream PR.

@votrelec

Copy link
Copy Markdown
Contributor Author

A focused health-calendar follow-up is ready for review: votrelec#11. It is stacked on votrelec#9 and changes only nine health paths. Reviewed concurrent-employer minimum notices now apply to insured agreements without granting OP eligibility; a minimum-only derived key is kept outside retained profiles so older posted monthly predecessors remain usable. Two EUR 200 instalments retain the correct combined EUR 3 employee premium and EUR 0.23 minimum supplement, avoiding a reproduced EUR 47.23 overcharge. Fresh public OCA tests pass 51/0/0, native Slovak labels/errors pass, and the mail patches and complete bundle were actually restored. After #43 returns through the generated source sync, this can be forwarded as a focused upstream PR.

@Rad0van

Rad0van commented Nov 13, 2026

Copy link
Copy Markdown
Member

Thank you. We applied both commits (23d95eb, b581c64) with git am -k --keep-cr onto the private 19.0 they were rebased on (653c353d), with stock OCA/payroll 19.0 and sk_SK loaded, and checked each point of our second review. All three blocking points are fixed, and so are the "should fix" and minor ones. One small thing remains, below; it does not change any figure, so we can merge once it is in (or merge now and take it as a follow-up, whichever you prefer).

What we verified

before (653c353d) with #43
OCA, every SK payroll module incl. l10n_sk_hr_payroll_surcharges_oca (17 test tags) 453 tests, 0 failed, 3 errors 488 tests, 0 failed, 3 errors
Enterprise, same set minus the two OCA-only modules 337 tests, 0 failed, 25 errors 354 tests, 0 failed, 25 errors

The errors are the same tests before and after (our parity scenarios and TestHealth514 under sk_SK); they are ours.

  1. Enterprise behaves as today. Only the OCA bridge defines _cssk_recorded_fund_bases, and the framework now skips a payslip whose model has no reader. test_corrective_full_replacement_and_retained_original and test_prefill_never_guesses_between_multiple_filed_candidates, which failed on Enterprise in round 2, pass, and so do your two new engine-neutral tests.
  2. The surcharges fixture is fixed. With l10n_sk_hr_payroll_surcharges_oca installed, the three tests that failed in round 2 pass.
  3. The legacy-correction review does what we asked. We also checked that your tests guard it. We weakened three things one at a time: the digest comparison, the write guard on the confirmation fields, and the "no reader is not missing" check. Each made its own tests fail: test_legacy_consent_expires_after_source_or_reason_changes, the three subtests of test_legacy_consent_is_not_a_caller_flag_or_a_forgeable_field, and both subtests of test_original_and_correction_without_a_reader_keep_existing_behaviour. Restored, they pass. We also rendered a corrective VPP in the browser with sk_SK. The banner and the Staršie mzdy bez uchovaných poistných základov group show, with Slovak labels.
  4. The user guides now speak to payroll accountants, and the protocol details are in DEVELOPER.md.
  5. All changelogs parse (tools/check_changelogs.py: 0 of 266), the carry-over is under [Unreleased], and the root README.rst files are untouched.
  6. No existing translation changed. We compared every changed .po entry by entry with 653c353d. The only dropped msgid is an obsolete duplicate of the ELDP l10n_sk_sp_vs help, and that removal is correct.
    7–9. The docstring says consumers round. The warning is on the four forms. The duplicate company check is gone.

One remaining point: a stale confirmation looks valid

The digest covers every stored scalar field of the payslip's employee version. In Odoo 19 that includes the employee's private address, marital status, number of children, home-to-work distance, and the version's write_date. So does version_changed, which repeats it. Here is what happens:

  • HR corrects an employee's private address between Potvrdiť and Generovať, or before a later regeneration.
  • The confirmation silently stops matching.
  • Generation refuses with the generic "Precise recorded fund bases are required…".
  • Meanwhile the form still shows Potvrdil and Potvrdené dňa.

Failing safe is right. But the accountant cannot tell from the message that the confirmation expired, or why. Please:

  • when fund_bases_confirmed_by is set but the digest no longer matches, raise a message that says so ("The confirmation by %(user)s on %(date)s no longer matches the payroll sources or the declaration's inputs; review them and confirm again"), and show the same state on the form (for example a non-stored computed flag hiding Potvrdil/Potvrdené dňa or adding a line to the banner);
  • drop write_date/create_date from the version facts (version_changed too). The field values already catch an edit, and the timestamps only add invalidations for changes that alter no value.

Narrowing the facts to the calculation inputs would be nicer still. But that list is engine-specific, so we would not ask for it here.

Nits, no action needed for merge

  • In the form, the Potvrdiť pôvodný výpočet z hrubej odmeny button sits in the label column of the group, and the banner is at the bottom of the sheet. A banner at the top, above the fields, would be seen before Generovať.
  • The chatter line shows the confirmation time as a raw UTC string (str(moment)). The Potvrdené dňa field shows it in the user's time zone.

What we will do at merge:

After the merge, we will take your fork #2 together with our Enterprise mirror of it, then #3–#11 in the order you propose once they are forwarded here.

@votrelec

Copy link
Copy Markdown
Contributor Author

Addressed the remaining confirmation feedback in 93825ec. Audit timestamps no longer invalidate consent. An expired confirmation now shows a warning, hides its old actor/date, and generation explains who confirmed it and when. Reconfirmation preserves the filed original. Native stock OCA verification: 21 tests, 0 failures/errors, including the timestamp-only edit and changed-version/reconfirmation flow. Native POT export, preserved Slovak catalogs, all four loaded forms and the actual translated expiry error also passed. Chatter confirmation times are localized. Your proposed merge-time handling of #44 and the generated documentation is fine.

@Rad0van

Rad0van commented Nov 16, 2026

Copy link
Copy Markdown
Member

Thank you, verified. On our current 19.0 the OCA suite passes 255/255 with Slovak loaded. The Enterprise run shows only a known error in our own Enterprise health tests, unrelated to this change. The expiry flow does what you describe. One small thing we'll handle at merge: the contract fingerprint still includes write_uid and create_uid, so a colleague saving an unrelated contract field (a note, for example) still expires the confirmation. We'll exclude all four log-access columns, not only the two timestamps. We'll also resolve the #44 changelog and documentation overlap as agreed. Porting now.

@Rad0van

Rad0van commented Nov 16, 2026

Copy link
Copy Markdown
Member

Merged into our 19.0 as 7e880561, your three commits unchanged. Where they met the #44 changelog and doc entries already on our branch, your versions went in as they were and the follow-up restores ours.

On top of it (841e8f3d):

  • the source digest leaves out all four log-access columns of the contract version, so a colleague's unrelated save no longer expires a confirmation; a regression test sits next to yours in l10n_sk_hr_payroll_vpp;
  • the Czech catalogue of l10n_cssk_payroll_declaration_base gets the fund-confirmation strings, and the Czech page the expired-confirmation note;
  • l10n_sk_hr_payroll_oca: the 19.0.1.24.6 stravné section and doc sections are back, and doc/DEVELOPER.md keeps the existing parameter and BASIC notes with your recording-integration section added below them;
  • pages and READMEs regenerated.

With sk_SK loaded, the OCA suite passes 256/256. The Enterprise run shows only the known error in our own Enterprise health tests. The change reaches this repository with the next sync. Closing here. The Enterprise writer and your stacked fork PRs can now be rebased on this.

@Rad0van Rad0van closed this Nov 16, 2026
Rad0van pushed a commit that referenced this pull request Nov 16, 2026
10 source commit(s) since 73d17127, 6 of which changed a module here.

Added (1): l10n_sk_vehicle_tax

* [IMP] payroll: record native fund evidence without changing premiums
  ece81c34 — l10n_cssk_payroll_declaration_base, l10n_sk_hr_payroll_base, l10n_sk_hr_payroll_mvp, l10n_sk_hr_payroll_oca

  Keep signed rule values and a single compact profile in the OCA bridge, generic validation in the base, and original/corrective policy in the declaration framework. Do not stop native calculation for optional metadata, rewrite evidence during rule reads, copy birth numbers, or introduce never-upstream legacy columns. Keep arithmetic fixes, calendar features and lifecycle controls separate.

  Validated clean stock OCA with all insurance forms: 246 tests, no failures/errors, one existing demo skip. Additional stock target: 25 tests. Engine-free base: 31 tests. Actual upstream-to-core upgrade preserves confirmed salary lines and two exact XML archives; new calculation records fourteen matching funds. Native SK field/error probes, POT/SK/CS catalogs and AST/runtime formula parity passed.

* [FIX] payroll: review historical corrections without recomputing filed wages
  11943eb8 — l10n_cssk_payroll_declaration_base, l10n_sk_hr_payroll_base, l10n_sk_hr_payroll_eldp, l10n_sk_hr_payroll_health, l10n_sk_hr_payroll_mvp, l10n_sk_hr_payroll_oca, l10n_sk_hr_payroll_vpp

  Preserve unsupported-engine workflows, protect reasoned legacy approval, test optional wage top-ups and retain native translations.

* [FIX] Explain expired legacy fund confirmations
  31f5985d — l10n_cssk_payroll_declaration_base, l10n_sk_hr_payroll_eldp, l10n_sk_hr_payroll_health, l10n_sk_hr_payroll_mvp, l10n_sk_hr_payroll_vpp

* [IMP] payroll declarations: who saved a version no longer expires a confirmation; Czech catalogue, December stravné notes and pages as in cssk-public #43
  841e8f3d — l10n_cssk_payroll_declaration_base, l10n_sk_hr_payroll_base, l10n_sk_hr_payroll_eldp, l10n_sk_hr_payroll_health, l10n_sk_hr_payroll_mvp, l10n_sk_hr_payroll_oca, l10n_sk_hr_payroll_vpp

  - l10n_cssk_payroll_declaration_base: the source digest of a legacy
    confirmation leaves out all four log-access columns of the contract
    version, not only the timestamps, so an unrelated save by a colleague
    (write_uid) does not expire it. Regression test in l10n_sk_hr_payroll_vpp.
  - l10n_cssk_payroll_declaration_base: Czech catalogue for the fund
    confirmation strings and the expired-confirmation note on the Czech page.
  - l10n_sk_hr_payroll_oca: the 19.0.1.24.6 December 2026 stravné section,
    its 18.0 carry-over line and the doc sections, which the contribution's
    base predated; DEVELOPER.md keeps the parameter and BASIC notes and adds
    the recording-integration section.
  - Generated pages and READMEs of the touched modules.

* [ADD] l10n_sk_vehicle_tax: calendar-year DMVv25 for L/M1/N1
  1c29116e — l10n_sk_vehicle_tax

  Slovak vehicle-tax returns from native fleet.vehicle facts, with dated
  liability, retained calculation snapshots and the published DMVv25 XML
  interface. The supported scope is the ordinary a/b taxpayer cases for
  L/M1/N1 vehicles; unsupported special cases are identified explicitly.

  Fleet import requires a documented actual holding/business-use start;
  Odoo's default acquisition date is not evidence of when tax liability
  began. The import adds prepared vehicles, lists every skipped plate with
  its reason in the chatter, keeps access errors as access errors and does
  not duplicate lines on repeat. The original XSD is pinned byte for byte.
  Statutory basis: zákon č. 361/2014 Z. z., §§ 2 and 8.

* [IMP] l10n_sk_vehicle_tax: year without separator, Czech catalogue, guide entry, release section and pages as in cssk-public #26
  29a267cd — account_financial_report_interactive, l10n_cssk_account_financial_report, l10n_cssk_accrual, l10n_cssk_cash_journal_base, l10n_cssk_core, l10n_cssk_mis_executive_summary, l10n_cssk_partner_balances, l10n_cz_account_cutoff, l10n_cz_cash_journal, l10n_cz_currency_revaluation, l10n_cz_fiscal_year_closing, l10n_cz_inventory_verification, l10n_cz_mis_reports, l10n_sk_account_cutoff, l10n_sk_base, l10n_sk_cash_journal, l10n_sk_currency_revaluation, l10n_sk_fiscal_year_closing, l10n_sk_inventory_verification, l10n_sk_mis_reports, l10n_sk_vehicle_tax, mis_builder_column_breakdown, mis_builder_kpi_details

207 modules in this repository.

Co-authored-by: votrelec <votrelec@users.noreply.github.com>
Rad0van pushed a commit that referenced this pull request Nov 16, 2026
4 source commit(s) since 0fed46f5, 1 of which changed a module here.

* [REF] l10n_sk_hr_payroll_base, l10n_sk_hr_payroll_oca: share the engine-free fund recorder
  e6b02f6c — l10n_sk_hr_payroll_base, l10n_sk_hr_payroll_oca

  The Enterprise bridge is to record the same fund bases the OCA bridge has
  recorded since #43. Copying fund_capture.py would leave two finalisations
  to drift apart, and the declarations compare what both engines store, so
  the engine-free half moves to l10n_sk_hr_payroll_base (which depends only
  on hr):

  - fund_capture.py (pure Python): the _FundCapture capability, one class for
    both engines so the isinstance check holds; finalize_fund_rows, which
    compares each record with its native line, signs by side, refuses
    duplicates and missing or invalid records, and merges the health minimum
    top-up under the engine's own rule code; the writer token.
  - the mixin: salary facts, the statutory profile through each engine's
    _l10n_sk_version(), the evidence assembly and its private store, the
    create/write/default-context guard and a reader skeleton. The skeleton is
    deliberately not named _cssk_recorded_fund_bases, so an engine only
    becomes readable when its bridge says so.

  The OCA bridge keeps its capture hooks, _l10n_sk_can_record_funds, the
  compute_sheet wrapper, refund pairing and direction, its identity
  (contract_id as before) and the stored field. Its hooks now collect
  (code, record, native total) and finalise once in localdict_hook; the
  native total is still taken when the rule ran.

  The private store now passes the guard with an in-process token instead of
  super(FundCapturePayslip, ...), so the base can do it; no other module
  overrides hr.payslip.write. Nothing user-visible changes: evidence written
  before and after the upgrade on the same database, for nine profiles and
  a refund, is byte-identical (jsonb text), and the existing OCA and
  declaration tests are untouched and green.

207 modules in this repository.
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