payroll icon indicating copy to clipboard operation
payroll copied to clipboard

[19.0][MIG] payroll: migrate

Open tishmen opened this issue 2 months ago • 5 comments

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.

tishmen avatar Oct 16 '25 16:10 tishmen

  • 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 UP031 prefers .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: UP031 where interpolation occurs after translation to avoid fighting the formatter and to stay consistent with OCA modules.

tishmen avatar Oct 16 '25 20:10 tishmen

  • 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.

tishmen avatar Oct 17 '25 00:10 tishmen

@kaynnan @WesleyOliveira98 @marcelsavegnago @CristianoMafraJunior pre-commit and tests are green; please test on RunBoat and review/approve.

tishmen avatar Oct 17 '25 00:10 tishmen

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.

tishmen avatar Oct 19 '25 09:10 tishmen

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

realsaiko avatar Nov 19 '25 10:11 realsaiko