From 18b66a6fae28819811e91b095b56230a2d9158f9 Mon Sep 17 00:00:00 2001 From: votrelec Date: Mon, 16 Nov 2026 22:48:05 +0100 Subject: [PATCH 1/2] Add cooperative monthly cash wage input for native payroll Assisted-by: OpenAI Codex --- l10n_sk_hr_payroll_oca/CHANGELOG.rst | 4 ++ l10n_sk_hr_payroll_oca/README.rst | 2 +- l10n_sk_hr_payroll_oca/__manifest__.py | 2 +- l10n_sk_hr_payroll_oca/doc/DEVELOPER.md | 7 +++ l10n_sk_hr_payroll_oca/doc/en.md | 8 +++- l10n_sk_hr_payroll_oca/doc/sk.md | 8 +++- l10n_sk_hr_payroll_oca/models/hr_payslip.py | 14 +++++- .../tests/test_sk_payroll.py | 48 +++++++++++++++++++ 8 files changed, 87 insertions(+), 6 deletions(-) diff --git a/l10n_sk_hr_payroll_oca/CHANGELOG.rst b/l10n_sk_hr_payroll_oca/CHANGELOG.rst index afef61a3..64c3bfed 100644 --- a/l10n_sk_hr_payroll_oca/CHANGELOG.rst +++ b/l10n_sk_hr_payroll_oca/CHANGELOG.rst @@ -5,6 +5,10 @@ Changelog Unreleased ========== +- **19.0.1.25.3 (2026-11-16):** expose a cooperative monthly cash-wage input hook. Integrations can compute + a payslip-specific monthly amount without editing its contract version; + native absence proration, hourly pay, insurance and tax remain in place. + - **19.0.1.22.0 (2026-11-09), DISCHARGED on 18.0 by 997c7bbb:** the employee social insurance cap is prorated for a part-month (§ 138 ods. 13, employer cap untouched); sick pay and the § 16a minimum count calendar days from the start of the incapacity (§ 8 zákona 462/2003); the health allowance is reduced for a part-month (§ 16 ods. 18). Carry-over to 18.0 diff --git a/l10n_sk_hr_payroll_oca/README.rst b/l10n_sk_hr_payroll_oca/README.rst index c97a50e8..1ffab4b7 100644 --- a/l10n_sk_hr_payroll_oca/README.rst +++ b/l10n_sk_hr_payroll_oca/README.rst @@ -80,7 +80,7 @@ Module facts ============ - **Technical name:** ``l10n_sk_hr_payroll_oca`` -- **Version:** 19.0.1.25.2 +- **Version:** 19.0.1.25.3 - **Edition:** Community and Enterprise - **Licence:** AGPL-3 - **Requires:** ``payroll``, ``l10n_sk_hr_payroll_base`` diff --git a/l10n_sk_hr_payroll_oca/__manifest__.py b/l10n_sk_hr_payroll_oca/__manifest__.py index 410dc6ab..588767b4 100644 --- a/l10n_sk_hr_payroll_oca/__manifest__.py +++ b/l10n_sk_hr_payroll_oca/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Slovakia - Payroll", - "version": "19.0.1.25.2", + "version": "19.0.1.25.3", "category": "Human Resources/Payroll", "summary": "Slovak payroll rules for the payroll engine", "countries": ["sk"], diff --git a/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md b/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md index b2e74549..536f5bdd 100644 --- a/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md +++ b/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md @@ -11,6 +11,13 @@ each segment's whole-period calendar divisor. Aggregate the wage into one monthly BASIC before evaluating monthly insurance and tax rules; this hook does not itself select or consolidate historical employment versions. +For a payslip-specific monthly wage input, override +`_l10n_sk_monthly_cash_wage(contract)`. Its default is the real contract wage. +The BASIC helper resolves this scalar once and applies its existing absence +and calendar proration; hourly pay does not use it. Keep source qualification, +input review and immutable evidence in the supplying integration. The hook +does not authorize changing a posted payslip or bypassing statutory checks. + The OCA WORK100 source includes scheduled absence time. The helper subtracts the common `l10n_sk_absence_codes()` once for both monthly and hourly wages. Leave compensation remains in its own salary rule and category. diff --git a/l10n_sk_hr_payroll_oca/doc/en.md b/l10n_sk_hr_payroll_oca/doc/en.md index e24d0cb6..6f3467b0 100644 --- a/l10n_sk_hr_payroll_oca/doc/en.md +++ b/l10n_sk_hr_payroll_oca/doc/en.md @@ -1,10 +1,16 @@ --- title: Slovak Payroll (OCA) summary: The Slovak monthly payslip for the OCA payroll app on Odoo Community — a complete salary structure for a pracovný pomer and the three dohody. -verified: 19.0.1.25.2 +verified: 19.0.1.25.3 family: l10n_sk_hr_payroll_base#engines --- +An integration can supply a reviewed monthly wage for an individual payslip +without editing its contract version. The ordinary absence and calendar +proration, insurance and tax calculation still apply. Hourly pay keeps its own +hourly input. The supplying integration owns input review and approval; this +extension point does not reopen posted payroll. + A complete Slovak salary structure for the OCA `payroll` app: four structures, one per employment form, sharing one rule set — social and health insurance, the tax base, the non-taxable part per taxpayer, the progressive income tax, the child tax bonus, holiday and obstacle pay at average earnings, employer sick pay, garnishments and the meal allowance. It also ships the dated rule parameters the rules read, Slovak time-off types with a *Slovak Payroll Code* and accrual plans, and the annual tax reconciliation. The Slovak fields appear on the employee form, *Payroll* tab, and on contract templates; the rule parameters are under *Payroll → Configuration → Rule Parameters*. Install it on purpose; it needs the OCA `payroll` module and works on Odoo Community. For posting to the general ledger add the OCA accounting bridge; for wage surcharges the surcharges family. diff --git a/l10n_sk_hr_payroll_oca/doc/sk.md b/l10n_sk_hr_payroll_oca/doc/sk.md index 001215b4..243f2d8a 100644 --- a/l10n_sk_hr_payroll_oca/doc/sk.md +++ b/l10n_sk_hr_payroll_oca/doc/sk.md @@ -1,10 +1,16 @@ --- title: Slovenské mzdy (OCA) summary: Slovenská mesačná výplatná páska pre aplikáciu OCA payroll v Odoo Community — úplná mzdová štruktúra pre pracovný pomer a tri dohody. -verified: 19.0.1.25.2 +verified: 19.0.1.25.3 family: l10n_sk_hr_payroll_base#engines --- +Rozšírenie môže pre jednu pásku poskytnúť overenú mesačnú mzdu bez zmeny +verzie pracovného vzťahu. Naďalej sa uplatní bežný pomer podľa času a absencií +aj natívny výpočet poistného a dane. Hodinová mzda používa svoj hodinový vstup. +Kontrolu a schválenie vstupu zabezpečuje príslušné rozšírenie; tento mechanizmus +sám neotvára zaúčtované mzdy. + Úplná slovenská mzdová štruktúra pre aplikáciu OCA `payroll`: štyri štruktúry, jedna na každú formu zamestnania, so spoločnými pravidlami — sociálne a zdravotné poistenie, základ dane, nezdaniteľná časť základu dane na daňovníka, progresívna daň z príjmu, daňový bonus na dieťa, náhrada mzdy za dovolenku a pri prekážkach v sume priemerného zárobku, náhrada príjmu pri PN, exekučné zrážky a stravné. Dodáva aj datované parametre, z ktorých pravidlá čítajú, slovenské typy voľna so *Slovenským mzdovým kódom* a plánmi nárokov a ročné zúčtovanie dane. Slovenské polia sú na karte zamestnanca v záložke mzdy a na šablónach zmlúv; parametre pravidiel sú v *Mzdy → Konfigurácia → Parametre pravidiel*. Inštaluje sa zámerne, vyžaduje modul OCA `payroll` a funguje v Odoo Community. Na zaúčtovanie do hlavnej knihy pridajte účtovný mostík pre OCA, na mzdové zvýhodnenia skupinu modulov príplatkov. diff --git a/l10n_sk_hr_payroll_oca/models/hr_payslip.py b/l10n_sk_hr_payroll_oca/models/hr_payslip.py index ddc8b1ed..4f5cb931 100644 --- a/l10n_sk_hr_payroll_oca/models/hr_payslip.py +++ b/l10n_sk_hr_payroll_oca/models/hr_payslip.py @@ -60,6 +60,15 @@ def _l10n_sk_version(self): self.ensure_one() return self.contract_id or self._get_employee_contracts()[:1] + def _l10n_sk_monthly_cash_wage(self, contract): + """Resolve the monthly wage input without changing the contract. + + Extensions can supply a payslip-specific input while retaining the + native absence, calendar, insurance and tax calculation. + """ + self.ensure_one() + return contract.wage + def l10n_sk_basic_salary(self, contract, worked_days, scheduled_hours=None): """Compute BASIC through a cooperative country-level salary hook. @@ -80,7 +89,8 @@ def l10n_sk_basic_salary(self, contract, worked_days, scheduled_hours=None): hours = worked_days.WORK100.number_of_hours # Never negative, even when inconsistent leave data exceeds WORK100. return round(max(0.0, hours - absence) * contract.l10n_sk_hourly_wage, 2) - result = contract.wage + monthly_wage = self._l10n_sk_monthly_cash_wage(contract) + result = monthly_wage if "WORK100" in worked_days.dict: scheduled = ( self.l10n_sk_scheduled_hours() @@ -89,7 +99,7 @@ def l10n_sk_basic_salary(self, contract, worked_days, scheduled_hours=None): ) paid_worked = worked_days.WORK100.number_of_hours - absence if scheduled and paid_worked < scheduled: - result = contract.wage * paid_worked / scheduled + result = monthly_wage * paid_worked / scheduled return result def l10n_sk_absence_codes(self): diff --git a/l10n_sk_hr_payroll_oca/tests/test_sk_payroll.py b/l10n_sk_hr_payroll_oca/tests/test_sk_payroll.py index 7d3ea8c6..e0a21b02 100644 --- a/l10n_sk_hr_payroll_oca/tests/test_sk_payroll.py +++ b/l10n_sk_hr_payroll_oca/tests/test_sk_payroll.py @@ -159,6 +159,54 @@ def test_basic_salary_rule_calls_cooperative_country_hook(self): self.assertEqual(payslip.get_salary_line_total("BASIC"), 1234.56) self.assertEqual(payslip.get_salary_line_total("GROSS"), 1234.56) + def test_monthly_cash_wage_input_runs_native_insurance_and_tax(self): + payslip = self._make_payslip( + self.contract_nodecl, self.employee_nodecl, + date(2026, 6, 1), date(2026, 6, 30), + ) + before = self.contract_nodecl.wage + with patch.object(type(payslip), "_l10n_sk_monthly_cash_wage", return_value=2500): + payslip.compute_sheet() + self.assertEqual(self.contract_nodecl.wage, before) + self.assertEqual(payslip.contract_id, self.contract_nodecl) + self.assertEqual(payslip.get_salary_line_total("BASIC"), 2500) + self.assertEqual(payslip.get_salary_line_total("GROSS"), 2500) + self.assertAlmostEqual(payslip.get_salary_line_total("SOCIALEMPLOYEETOTAL"), -360) + self.assertAlmostEqual(payslip.get_salary_line_total("HEALTH"), -125) + self.assertAlmostEqual(payslip.get_salary_line_total("TAXBASE"), 2140) + self.assertAlmostEqual(payslip.get_salary_line_total("INCOMETAX"), -406.60) + self.assertAlmostEqual(payslip.get_salary_line_total("NET"), 1733.40) + + def test_monthly_cash_wage_input_preserves_proration(self): + payslip = self._make_payslip( + self.contract_nodecl, self.employee_nodecl, + date(2026, 6, 1), date(2026, 6, 30), + ) + with patch.object(type(payslip), "_l10n_sk_monthly_cash_wage", return_value=2500): + for sign in (-1, 1): + worked = WorkedDays(self.employee_nodecl.id, { + "WORK100": SimpleNamespace(number_of_hours=88), + "DOVOLENKA": SimpleNamespace(number_of_hours=sign * 8), + }, self.env) + self.assertAlmostEqual(payslip.l10n_sk_basic_salary( + self.contract_nodecl, worked, scheduled_hours=176, + ), 2500 * 80 / 176) + empty = WorkedDays(self.employee_nodecl.id, {}, self.env) + self.assertEqual(payslip.l10n_sk_basic_salary(self.contract_nodecl, empty), 2500) + + def test_monthly_cash_wage_input_is_not_used_for_hourly_pay(self): + self.contract_nodecl.l10n_sk_hourly_wage = 20 + payslip = self._make_payslip( + self.contract_nodecl, self.employee_nodecl, + date(2026, 6, 1), date(2026, 6, 30), + ) + worked = WorkedDays(self.employee_nodecl.id, { + "WORK100": SimpleNamespace(number_of_hours=2.5), + }, self.env) + with patch.object(type(payslip), "_l10n_sk_monthly_cash_wage", + side_effect=AssertionError("A monthly input cannot replace hourly pay")): + self.assertEqual(payslip.l10n_sk_basic_salary(self.contract_nodecl, worked), 50) + def test_basic_salary_hook_preserves_segment_divisor_and_absence_signs(self): payslip = self._make_payslip( self.contract_nodecl, From 93bbfe122a65007b0927e4cd8045fa5ab9888b82 Mon Sep 17 00:00:00 2001 From: votrelec Date: Tue, 17 Nov 2026 00:22:22 +0100 Subject: [PATCH 2/2] [FIX] payroll: use the reviewed monthly wage for probable earnings 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 --- l10n_sk_hr_payroll_oca/CHANGELOG.rst | 15 ++++++++-- l10n_sk_hr_payroll_oca/README.rst | 2 +- l10n_sk_hr_payroll_oca/__manifest__.py | 2 +- l10n_sk_hr_payroll_oca/doc/DEVELOPER.md | 11 +++++++ l10n_sk_hr_payroll_oca/doc/en.md | 8 ++--- l10n_sk_hr_payroll_oca/doc/sk.md | 8 ++--- l10n_sk_hr_payroll_oca/models/hr_payslip.py | 9 ++++-- .../tests/test_sk_payroll.py | 29 +++++++++++++++++++ 8 files changed, 65 insertions(+), 19 deletions(-) diff --git a/l10n_sk_hr_payroll_oca/CHANGELOG.rst b/l10n_sk_hr_payroll_oca/CHANGELOG.rst index 64c3bfed..d0589ec9 100644 --- a/l10n_sk_hr_payroll_oca/CHANGELOG.rst +++ b/l10n_sk_hr_payroll_oca/CHANGELOG.rst @@ -5,15 +5,20 @@ Changelog Unreleased ========== -- **19.0.1.25.3 (2026-11-16):** expose a cooperative monthly cash-wage input hook. Integrations can compute +- **19.0.1.26.1 (2026-11-17):** expose a cooperative monthly cash-wage input hook. Integrations can compute a payslip-specific monthly amount without editing its contract version; - native absence proration, hourly pay, insurance and tax remain in place. + native absence proration, hourly pay, insurance and tax remain in place. The + probable-earnings fallback follows the supplied wage; a qualifying actual + quarter keeps its historical average. - **19.0.1.22.0 (2026-11-09), DISCHARGED on 18.0 by 997c7bbb:** the employee social insurance cap is prorated for a part-month (§ 138 ods. 13, employer cap untouched); sick pay and the § 16a minimum count calendar days from the start of the incapacity (§ 8 zákona 462/2003); the health allowance is reduced for a part-month (§ 16 ods. 18). Carry-over to 18.0 ~~~~~~~~~~~~~~~~~~ +- Port the monthly wage seam and probable-earnings fallback together; on 18.0 + the supplied employment record is ``hr.contract``. Keep the OCA-only scope. + - Not yet ported: recorded fund evidence, engine-neutral missing-reader policy and explicitly reviewed legacy corrections. Adapt contract/engine adapters and rerun signed, optional-module, refund and legacy-review scenarios. @@ -108,6 +113,9 @@ Fixed Carry-over to 18.0 ~~~~~~~~~~~~~~~~~~ +- Port the monthly wage seam and probable-earnings fallback together; on 18.0 + the supplied employment record is ``hr.contract``. Keep the OCA-only scope. + * Not yet on 18.0 (the recorded fund evidence itself is not ported there). [19.0.1.25.1] — 2026-11-16 @@ -125,6 +133,9 @@ Changed Carry-over to 18.0 ~~~~~~~~~~~~~~~~~~ +- Port the monthly wage seam and probable-earnings fallback together; on 18.0 + the supplied employment record is ``hr.contract``. Keep the OCA-only scope. + * Not yet on 18.0 (the recorded fund evidence itself is not ported there). [19.0.1.25.0] — 2026-11-11 diff --git a/l10n_sk_hr_payroll_oca/README.rst b/l10n_sk_hr_payroll_oca/README.rst index 1ffab4b7..c97a50e8 100644 --- a/l10n_sk_hr_payroll_oca/README.rst +++ b/l10n_sk_hr_payroll_oca/README.rst @@ -80,7 +80,7 @@ Module facts ============ - **Technical name:** ``l10n_sk_hr_payroll_oca`` -- **Version:** 19.0.1.25.3 +- **Version:** 19.0.1.25.2 - **Edition:** Community and Enterprise - **Licence:** AGPL-3 - **Requires:** ``payroll``, ``l10n_sk_hr_payroll_base`` diff --git a/l10n_sk_hr_payroll_oca/__manifest__.py b/l10n_sk_hr_payroll_oca/__manifest__.py index 588767b4..c953b778 100644 --- a/l10n_sk_hr_payroll_oca/__manifest__.py +++ b/l10n_sk_hr_payroll_oca/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Slovakia - Payroll", - "version": "19.0.1.25.3", + "version": "19.0.1.26.1", "category": "Human Resources/Payroll", "summary": "Slovak payroll rules for the payroll engine", "countries": ["sk"], diff --git a/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md b/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md index 536f5bdd..d50406a3 100644 --- a/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md +++ b/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md @@ -17,6 +17,17 @@ The BASIC helper resolves this scalar once and applies its existing absence and calendar proration; hourly pay does not use it. Keep source qualification, input review and immutable evidence in the supplying integration. The hook does not authorize changing a posted payslip or bypassing statutory checks. +The probable-hourly-earnings fallback uses this same input when the determining +quarter has insufficient worked time. A qualifying actual-quarter average +continues to use the retained historical earnings. + +The hook must be a pure function of the payslip and the contract it receives, +without side effects. Dated-segment integrations can call `super()` once per +segment, so the hook may be resolved more than once for a single payslip. + +This seam belongs to the OCA engine. Enterprise BASIC reads `payslip.paid_amount` +from worked-day amounts, which read the version wage directly; there is no +equivalent single hook in `l10n_sk_hr_payroll_ee` at present. The OCA WORK100 source includes scheduled absence time. The helper subtracts the common `l10n_sk_absence_codes()` once for both monthly and hourly wages. diff --git a/l10n_sk_hr_payroll_oca/doc/en.md b/l10n_sk_hr_payroll_oca/doc/en.md index 6f3467b0..8e478a75 100644 --- a/l10n_sk_hr_payroll_oca/doc/en.md +++ b/l10n_sk_hr_payroll_oca/doc/en.md @@ -1,15 +1,11 @@ --- title: Slovak Payroll (OCA) summary: The Slovak monthly payslip for the OCA payroll app on Odoo Community — a complete salary structure for a pracovný pomer and the three dohody. -verified: 19.0.1.25.3 +verified: 19.0.1.26.1 family: l10n_sk_hr_payroll_base#engines --- -An integration can supply a reviewed monthly wage for an individual payslip -without editing its contract version. The ordinary absence and calendar -proration, insurance and tax calculation still apply. Hourly pay keeps its own -hourly input. The supplying integration owns input review and approval; this -extension point does not reopen posted payroll. + A complete Slovak salary structure for the OCA `payroll` app: four structures, one per employment form, sharing one rule set — social and health insurance, the tax base, the non-taxable part per taxpayer, the progressive income tax, the child tax bonus, holiday and obstacle pay at average earnings, employer sick pay, garnishments and the meal allowance. It also ships the dated rule parameters the rules read, Slovak time-off types with a *Slovak Payroll Code* and accrual plans, and the annual tax reconciliation. The Slovak fields appear on the employee form, *Payroll* tab, and on contract templates; the rule parameters are under *Payroll → Configuration → Rule Parameters*. diff --git a/l10n_sk_hr_payroll_oca/doc/sk.md b/l10n_sk_hr_payroll_oca/doc/sk.md index 243f2d8a..3c2ff516 100644 --- a/l10n_sk_hr_payroll_oca/doc/sk.md +++ b/l10n_sk_hr_payroll_oca/doc/sk.md @@ -1,15 +1,11 @@ --- title: Slovenské mzdy (OCA) summary: Slovenská mesačná výplatná páska pre aplikáciu OCA payroll v Odoo Community — úplná mzdová štruktúra pre pracovný pomer a tri dohody. -verified: 19.0.1.25.3 +verified: 19.0.1.26.1 family: l10n_sk_hr_payroll_base#engines --- -Rozšírenie môže pre jednu pásku poskytnúť overenú mesačnú mzdu bez zmeny -verzie pracovného vzťahu. Naďalej sa uplatní bežný pomer podľa času a absencií -aj natívny výpočet poistného a dane. Hodinová mzda používa svoj hodinový vstup. -Kontrolu a schválenie vstupu zabezpečuje príslušné rozšírenie; tento mechanizmus -sám neotvára zaúčtované mzdy. + Úplná slovenská mzdová štruktúra pre aplikáciu OCA `payroll`: štyri štruktúry, jedna na každú formu zamestnania, so spoločnými pravidlami — sociálne a zdravotné poistenie, základ dane, nezdaniteľná časť základu dane na daňovníka, progresívna daň z príjmu, daňový bonus na dieťa, náhrada mzdy za dovolenku a pri prekážkach v sume priemerného zárobku, náhrada príjmu pri PN, exekučné zrážky a stravné. Dodáva aj datované parametre, z ktorých pravidlá čítajú, slovenské typy voľna so *Slovenským mzdovým kódom* a plánmi nárokov a ročné zúčtovanie dane. Slovenské polia sú na karte zamestnanca v záložke mzdy a na šablónach zmlúv; parametre pravidiel sú v *Mzdy → Konfigurácia → Parametre pravidiel*. diff --git a/l10n_sk_hr_payroll_oca/models/hr_payslip.py b/l10n_sk_hr_payroll_oca/models/hr_payslip.py index 4f5cb931..9d6d3a5c 100644 --- a/l10n_sk_hr_payroll_oca/models/hr_payslip.py +++ b/l10n_sk_hr_payroll_oca/models/hr_payslip.py @@ -64,7 +64,9 @@ def _l10n_sk_monthly_cash_wage(self, contract): """Resolve the monthly wage input without changing the contract. Extensions can supply a payslip-specific input while retaining the - native absence, calendar, insurance and tax calculation. + native absence, calendar, insurance and tax calculation. This must be + a pure function of the payslip and the supplied contract: dated wage + segments can resolve it more than once. """ self.ensure_one() return contract.wage @@ -282,7 +284,7 @@ def l10n_sk_average_hourly_earnings(self): replacements / náhrady) ÷ hours worked in that quarter, rounded to 4 decimals. If the employee did not work at least 21 days or 168 hours in the determining period (§134 ods. 3) the probable earnings (pravdepodobný - zárobok) are used instead — here the current contract wage over the + zárobok) are used instead — here the reviewed monthly wage over the month's scheduled hours. Finally the statutory floor applies: if the result is below the hourly minimum wage it is raised to it (§134 ods. 5). @@ -309,7 +311,8 @@ def l10n_sk_average_hourly_earnings(self): phz = round(gross / hours, 4) else: sched_hours = self.l10n_sk_scheduled_hours() - phz = round(self._l10n_sk_version().wage / sched_hours, 4) if sched_hours else 0.0 + contract = self._l10n_sk_version() + phz = round(self._l10n_sk_monthly_cash_wage(contract) / sched_hours, 4) if sched_hours else 0.0 return max(phz, min_hourly) def l10n_sk_scheduled_days(self): diff --git a/l10n_sk_hr_payroll_oca/tests/test_sk_payroll.py b/l10n_sk_hr_payroll_oca/tests/test_sk_payroll.py index e0a21b02..6e76e50a 100644 --- a/l10n_sk_hr_payroll_oca/tests/test_sk_payroll.py +++ b/l10n_sk_hr_payroll_oca/tests/test_sk_payroll.py @@ -949,6 +949,35 @@ def test_holiday_nahrada_no_proration_cut(self): # GROSS made whole (no cut) up to the 4-dp PHZ rounding: ~2000.00 self.assertAlmostEqual(line("GROSS"), 2000.0, places=1) + def test_probable_holiday_earnings_use_reviewed_monthly_wage(self): + contract, employee, _calendar = self._abs_setup() + self._make_leave(employee, "l10n_sk_leave_type_dovolenka", + date(2026, 6, 8), date(2026, 6, 12)) + with patch.object(type(self.env["hr.payslip"]), + "_l10n_sk_monthly_cash_wage", return_value=2500): + payslip = self._worked_payslip( + contract, employee, date(2026, 6, 1), date(2026, 6, 30)) + self.assertAlmostEqual(payslip.l10n_sk_average_hourly_earnings(), 14.2045) + self.assertEqual(contract.wage, 2000) + self.assertAlmostEqual(payslip.get_salary_line_total("BASIC"), 1931.82, places=2) + self.assertAlmostEqual(payslip.get_salary_line_total("DOVOLENKA_NAHRADA"), 568.18, places=2) + self.assertAlmostEqual(payslip.get_salary_line_total("GROSS"), 2500, places=2) + + def test_reviewed_monthly_wage_keeps_actual_quarter_average(self): + contract, employee, _calendar = self._abs_setup() + self._seed_prior_quarter(contract, employee) + self._make_leave(employee, "l10n_sk_leave_type_dovolenka", + date(2026, 6, 8), date(2026, 6, 12)) + with patch.object(type(self.env["hr.payslip"]), + "_l10n_sk_monthly_cash_wage", return_value=2500): + payslip = self._worked_payslip( + contract, employee, date(2026, 6, 1), date(2026, 6, 30)) + self.assertAlmostEqual(payslip.l10n_sk_average_hourly_earnings(), 11.3636) + self.assertEqual(contract.wage, 2000) + self.assertAlmostEqual(payslip.get_salary_line_total("BASIC"), 1931.82, places=2) + self.assertAlmostEqual(payslip.get_salary_line_total("DOVOLENKA_NAHRADA"), 454.54, places=2) + self.assertAlmostEqual(payslip.get_salary_line_total("GROSS"), 2386.36, places=2) + def test_unpaid_leave_prorates_basic(self): """5 unpaid-leave days: BASIC prorated, no náhrada, GROSS follows.""" contract, employee, _cal = self._abs_setup()