[19.0][MIG] payroll: migrate
Scope:
- payroll only
Depends on:
- None
Summary:
- Migrate to Odoo 19.
- Follows OCA 19.0 migration tasks (version bump, security field rename, tz API).
Pre-commit:
- Ran locally before opening; auto-fixes committed.
Tests:
- Local install example:
./odoo/odoo-bin -c odoo.conf -d odoo_payroll_dev -i payroll --log-level=info --stop-after-init - OCA CI will validate on upstream infra.
- Translation best practice in Odoo is to keep placeholders inside the translatable string and interpolate after translation. That pattern looks like
self.env._("… %(name)s …") % {"name": value}. - pylint-odoo ports a logging “not‑lazy” rule to translations and flags this interpolation as
W8301, but there is no “lazy‑args” form for_(), so the warning is a stylistic false positive for Odoo’s i18n pattern. To remain translator‑friendly and still pass the hook, I added precise, per‑line disables only on the exact interpolation lines (# pylint: disable=translation-not-lazy). - Ruff’s
UP031prefers.format/f‑strings over%formatting. For translatable strings, the percent style with named placeholders is a better fit for Odoo’s extraction and translation workflows. I therefore added per‑line# noqa: UP031where interpolation occurs after translation to avoid fighting the formatter and to stay consistent with OCA modules.
- Odoo 19 drops the separate hr_contract module; “contracts” are now timeline versions inside core HR via the hr.version model. hr.employee _inherits hr.version (current version in employee.version_id), with multiple versions capturing effective changes via date_version + contract_date_start/contract_date_end.
- I replaced hr.contract usages with hr.version: fields like date_start/date_end → date_version/contract_date_start/contract_date_end, and selection via employee._get_contracts(date_start, date_end), considering only overlapping versions.
- Views/security were adjusted to target hr.version (contract templates), while hr.contract.type remains in hr for employment type metadata.
- To preserve payroll features, I extend hr.version (not hr.contract) to carry payroll-specific fields (e.g., struct_id, schedule_pay) and keep existing flows working on the new model.
@kaynnan @WesleyOliveira98 @marcelsavegnago @CristianoMafraJunior pre-commit and tests are green; please test on RunBoat and review/approve.
The commit message should be only: [MIG] payroll: Migration to 19.0 970eaf7
I have changed the commit message to the one specified, thank you.
Demo data installation fails:
./odoo/odoo-bin -c odoo.conf -d odoo_payroll_dev -i payroll --with-demo --log-level=info --stop-after-init
It still has a reference to the "hr.contract" model that was removed in Odoo v19.0