Skip to content

[ADD] l10n_sk_hr_payroll_health_registration: reviewed601 notices - #35

Closed
votrelec wants to merge 8 commits into
Data-Dance:19.0from
votrelec:feat/sk-health-registration
Closed

votrelec wants to merge 8 commits into
Data-Dance:19.0from
votrelec:feat/sk-health-registration

Conversation

@votrelec

@votrelec votrelec commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Employer registration changes need their own HR-event source, independently of monthly payslips. This adds l10n_sk_hr_payroll_health_registration for reviewed601 notices, using the common declaration, filing and submission-evidence workflow.

Dependency: #34. This branch is based on its current head 2a6ad9d645108952ffa14530c56e10799c956c4b. Once that contribution lands, I will rebase onto the source sync so the review diff contains only this addition. The registration-specific diff is git diff 2a6ad9d645108952ffa14530c56e10799c956c4b HEAD (30 files).

The new module installs without a payroll engine. It provides reviewed employee events with Z/K/X, source references, company/HR access, optional reviewed coverage-calendar links, original N and explicit full O batches, XML and ISO8859-2 text output, and durable original attachments/source history. Calendar checks use unioned intervals; same-employer employment suppresses2D. If country payroll is installed, the version effective on the event date supplies the known health exemption. Only a2D start is refused: termination on the date exemption begins and cancellation remain available.

The common declaration module gains two small hooks: _declaration_source_data retains the existing payslip default and allows an HR-event provider; private _declaration_write preserves the default ORM/access chain and lets a protected report retain workflow evidence without exposing a context bypass. The generate/reset/submit/archive orchestration remains shared. No second payroll ledger is introduced.

Generated facts cannot be supplied via public create/write/default values. Parent locks serialize edits; the state and access are re-read after acquiring the lock. New filing evidence requires unchanged generated source. A filed original cannot silently become a different new filing. Protected attachment content allows identical-content storage migration and leaves unrelated chatter attachments alone.

The interface follows MU12/14/2014, updated10December2025, in the ÚDZS Bulletin1/2026. The schema is explicitly derived from the published PDF, with the source hash, extraction corrections and resulting hash documented beside it. It is not claimed to be an independently downloaded authority XSD. A valid-baseline negative control identifies the published2S XML pattern issue; text601 is the supported alternative when its charset represents the names. No lossy transliteration is performed.

Validation on Odoo19 in Docker:

  • Follow-up concurrency audit reproduced a stale generator snapshot after a committed HR-event edit. The parent now advances a non-key version so the stale transaction retries. The shared calendar fix from#34 is included as well. The final clean public payroll/health assembly passes269 tests, including both real two-transaction cases. The earlier955 result precedes these guards.

  • HR-only installation:24 tests,0 failures/errors; the optional payroll eligibility case is skipped when that module is absent.

  • Clean public payroll/calendar/monthly-health/registration assembly:263 tests,0 failures/errors.

  • Final registration cases after source/retry and filed-identity checks:28 tests,0 failures/errors, including dated optional payroll facts.

  • Full assembly with accounting, monthly/annual tax and existing payroll correction adapters:955 tests,0 failures/errors. The later registration guard changes are covered by the focused28-test run; they do not alter salary calculations.

  • Actual HTTP HR-manager workflow repeated twice: employee onchange, original XML, full corrective text, retained/downloaded bytes, Slovak fields_get and a loaded Python UserError. No system-administrator account or authority transport was used.

  • Native Odoo POT export and Slovak merge: no untranslated active entries in the three affected module catalogs. Ruff0.13.0 format/check passes for the new module. The private documentation generator is unavailable in this public checkout, so no strict/generated-page build is claimed.

EN/SK documentation describes manual legal-event review, ePN notice responsibilities, source-calendar boundaries, assigned BIČ, explicit cancellations, corporate payers with IČO, the2S/charset limitation and separate authority acceptance. Actual irregular-income allocation and financial payroll corrections remain their own sources; this module does not infer or rewrite them merely because a notice was generated.

Follow-up review reproduced and fixed a filed-archive ownership gap after reset plus removal of working rows. Company, insurer, period, serial and correction identity now remain fixed. A native28-case run and two additional HR-manager HTTP/SK passes verify this boundary, including an unchanged date write. The failing reproduction is distinguished from the passing results; the earlier955 run is not claimed to cover this later guard.

@Rad0van

Rad0van commented Nov 10, 2026

Copy link
Copy Markdown
Member

Thanks. This review covers only the registration part: the diff on top of #34, which is the new module plus the _declaration_source_data and _declaration_write hooks in the declaration base. #35 cannot merge before #34, and if #34 is reshaped the way that review suggests, this branch will need a rebase. Most of what follows does not depend on that.

We fetched ÚDZS bulletin 1/2026 at the URL you cite, and both the PDF and the derived XSD match your SHA-256 values. We then checked the codec against F-511 and F-512 field by field. Header, payer row and body widths, the mandatory and optional flags, the one-of-three payer identifier, the RČ/BIČ alternative and the RRRRMMDD change date all agree. You also have the 2S schema defect right: the published pattern is 2S {1,2}.

On 19.0 under sk_SK we ran the SK and CZ declaration suites on Community, and the SK suites on Enterprise. The declaration-base refactor changes nothing for the existing declarations: CZ pvpoj, eldp, health, jmhz, onz and annual settlement, and SK mvp, vpp, eldp and health all give the same results as on 19.0. The new module itself has the failures listed below.

  1. Three tests fail when Slovak is loaded.

    • test_changed_payer_source_requires_regeneration_but_preserves_old_filing
    • test_dated_exemption_blocks_start_but_allows_end_and_cancellation
    • test_original_retry_keeps_wire_identity_and_non_vat_payer_dic

    All three use assertRaisesRegex against the English message, and the sk.po you ship translates it (for example "source changed" becomes "Podklad oznámenia sa zmenil…"). Please assert on the exception type plus a language-neutral marker, or run those assertions with lang='en_US' in the context.

  2. The concurrency test cannot clean up on Enterprise. test_concurrency.py commits a company and then deletes it in its cleanup (tests/test_concurrency.py:97-99). Enterprise hr_payroll creates hr.payroll.note rows per company with a RESTRICT foreign key, so the cleanup fails with hr_payroll_note_company_id_fkey, and the committed rows are left in the database. Please reuse an existing company, or remove the dependent rows explicitly. Also wrap the test in mute_logger('odoo.sql_db'): the expected serialization failure is logged at ERROR. The same applies to the calendar concurrency test in [ADD] l10n_sk_hr_payroll_health: shared assessments and current text514 #34.

  3. Untested refusals. Coverage of the new module is 92%, but some of the lines that are missed are exactly the guards that protect a filing:

    • a correction source from another company or insurer, or one that was never submitted (models/registration.py:212);
    • a regular batch that sets amends_id (231);
    • a bank account that does not belong to the company (223);
    • submit without generated evidence, and submit with an attachment that is not the batch's own (365, 376);
    • the calendar/company scope check (476);
    • a missing source reference (485);
    • the 2S rejection on the XML path (336).

    Each needs only a short test.

  4. 2P and 2S have no calendar check. _wire_values checks the endpoints of 2/2D/2Y/2N against the reviewed calendar, but 2P and 2S pass with no source check because the calendar has no kind for them (see [ADD] l10n_sk_hr_payroll_health: shared assessments and current text514 #34, point 5). If [ADD] l10n_sk_hr_payroll_health: shared assessments and current text514 #34 adds those kinds, please extend the endpoint check here as well. Otherwise, document in the module that these two codes rely only on employer_notice_reviewed.

  5. The ir.attachment override applies to every attachment in the database. HealthRegistrationAttachment.write and unlink (models/registration.py:611-670) run on every attachment write or delete that touches those keys. The filter is cheap, and you were careful about storage migration (unchanged content passes). Still, a write of store_fname alone, as done by maintenance scripts that move filestore files, is refused for these attachments. Please confirm that this is intended, and add a test showing that ir.attachment.force_storage() still works with a filed 601 present.

  6. Schema pinning convention. Our statutory modules keep data/SCHEMA_VERSION (file size, md5 and the refresh procedure) together with a test that no schema sits unpinned. Here the pin is a SHA-256 constant in wire601.py plus schemas/README.md, which is equivalent in substance. For consistency, please add data/SCHEMA_VERSION with the refresh steps, which are: fetch the bulletin, extract pages 25–44, normalise the two extraction artefacts, re-hash. Also state there that the XSD is a transcription, not an authority download, which the README already says.

  7. Missing spaces before digits. The same problem as in [ADD] l10n_sk_hr_payroll_health: shared assessments and current text514 #34 appears in user-facing strings and therefore in sk.po:

    • msgids: "generating601.", "The601 text framing is invalid.", "code2S", "needs1–99999 events", "contain8–15 characters", "batch601";
    • the docs: "VšZP25, Dôvera24 and Union27", "text601";
    • the commit title: "reviewed601 notices".
  8. Docs and catalogue.

    • The module is in no topic of guide/topics.yaml, which our docs generator requires. Please add it next to l10n_sk_hr_payroll_health.
    • l10n_cssk_payroll_declaration_base/doc/cs.md still says verified: 19.0.1.5.1 while the manifest is now 19.0.1.6.0. The en and sk pages were bumped, but the Czech one was not. We will regenerate the README and the HTML pages ourselves.
  9. Commits and headers.

    • The last commit, "Retry health registration generation after concurrent event edits", has no [FIX] tag.
    • The new files carry Copyright 2026 votrelec, while the manifest author is Data Dance s.r.o., votrelec. Please align them.
  10. Declaration-base hooks. No change needed. _declaration_source_data and the private _declaration_write are a clean split, the existing reports keep their behaviour, and moving the four separate assignments in action_submit into one write is fine. The base module's docs list the new module, but none of the new hooks: the two here, and _declaration_attachment_metadata / _declaration_generated_message from [ADD] l10n_sk_hr_payroll_health: shared assessments and current text514 #34. Please add a short developer note for other declaration authors, either in doc/en.md (and sk/cs) or in a DEVELOPER.md like the one in l10n_sk_hr_payroll_oca.

@votrelec

Copy link
Copy Markdown
Contributor Author

Registration review 6769032498 is addressed in the ready dependent contribution votrelec#7 at e82da27, based on the reviewed calendar/core architecture (#43). This preserves the already prepared local fixes and avoids bringing the superseded #34 evidence implementation back into the branch. After the core/calendar source sync I will update this upstream PR with the dependency commits removed.

The update includes the refusal and force_storage cases, explicit test language, committed-cursor cleanup, schema provenance/SCHEMA_VERSION, 2P/2S calendar endpoints, readable user strings, aligned guide versions/copyright and a developer note for the four common hooks. Topic placement is stated in the PR description for your generator source. Unrelated HR-base catalogue export differences were removed after a separate review.

The three-module Community regression passes 100 tests; actual default-Slovak registration passes 36, with loaded field/error probes. Two real HR-manager HTTP workflows pass, preserving retained XML/text and correction history with no retry duplicates. RST, native POT/SK, exact schema pins and full patch restoration pass. The Enterprise cleanup is included, but I do not claim an Enterprise runtime test.

@Rad0van

Rad0van commented Nov 17, 2026

Copy link
Copy Markdown
Member

Closing this one as superseded, as you noted: the 601 registration notices continue in your votrelec#7, built on the recorded fund core (#43, now merged). We will review it there once it comes upstream. Thank you.

@Rad0van Rad0van closed this Nov 17, 2026
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