diff --git a/l10n_sk_hr_payroll_oca/CHANGELOG.rst b/l10n_sk_hr_payroll_oca/CHANGELOG.rst index afef61a3..d0589ec9 100644 --- a/l10n_sk_hr_payroll_oca/CHANGELOG.rst +++ b/l10n_sk_hr_payroll_oca/CHANGELOG.rst @@ -5,11 +5,20 @@ Changelog Unreleased ========== +- **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. 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. @@ -104,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 @@ -121,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/__manifest__.py b/l10n_sk_hr_payroll_oca/__manifest__.py index 410dc6ab..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.2", + "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 b2e74549..d50406a3 100644 --- a/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md +++ b/l10n_sk_hr_payroll_oca/doc/DEVELOPER.md @@ -11,6 +11,24 @@ 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 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. 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..8e478a75 100644 --- a/l10n_sk_hr_payroll_oca/doc/en.md +++ b/l10n_sk_hr_payroll_oca/doc/en.md @@ -1,10 +1,12 @@ --- 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.26.1 family: l10n_sk_hr_payroll_base#engines --- + + 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..3c2ff516 100644 --- a/l10n_sk_hr_payroll_oca/doc/sk.md +++ b/l10n_sk_hr_payroll_oca/doc/sk.md @@ -1,10 +1,12 @@ --- 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.26.1 family: l10n_sk_hr_payroll_base#engines --- + + Ú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..9d6d3a5c 100644 --- a/l10n_sk_hr_payroll_oca/models/hr_payslip.py +++ b/l10n_sk_hr_payroll_oca/models/hr_payslip.py @@ -60,6 +60,17 @@ 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. 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 + def l10n_sk_basic_salary(self, contract, worked_days, scheduled_hours=None): """Compute BASIC through a cooperative country-level salary hook. @@ -80,7 +91,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 +101,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): @@ -272,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). @@ -299,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 7d3ea8c6..6e76e50a 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, @@ -901,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()