Skip to content

[19.0][MIG] payroll_account: Migration to 19.0 - #282

Open
neoand wants to merge 70 commits into
OCA:19.0from
neoand:19.0-mig-payroll_account
Open

[19.0][MIG] payroll_account: Migration to 19.0#282
neoand wants to merge 70 commits into
OCA:19.0from
neoand:19.0-mig-payroll_account

Conversation

@neoand

@neoand neoand commented Aug 8, 2026

Copy link
Copy Markdown

Migration of payroll_account from 18.0 to 19.0.

Module history was replayed with git format-patch --keep-subject --stdout origin/19.0..origin/18.0 -- payroll_account | git am -3 (69 commits), and the migration itself is the single commit on top.

What Odoo 19 broke

Odoo 19 removed the hr_contract addon: contract data now lives on hr.version, which is exactly the model this module extends. The payroll module already made that jump on 19.0, so this migration follows the same pattern.

Change Fix
hr_contract addon is gone models/hr_contract.py: _inherit "hr.contract""hr.version"
Parent view hr_contract.hr_contract_view_form no longer exists Inherit payroll.hr_contract_view_form (model hr.version) and anchor the accounting fields after struct_id
hr.employee.gendersex Fixed in tests
hr.employee.bank_account_id (m2o) → bank_account_ids Fixed in tests

Tests now build the contract through employee.version_id.write() with contract_date_start, the pattern used by payroll/tests/common.py on 19.0.

The 18.0.1.0.2 migration scripts were dropped.

Testing

On odoo:19.0 Community:

Module payroll_account: 0 failed, 0 error(s) of 3 tests

Beyond the module's own suite, I checked the feature end-to-end on a fresh database: a payslip whose rules carry account_debit / account_credit, confirmed with action_payslip_done(), produces a balanced account.move posted on the journal configured on the version.

Entry MISC/2026/04/0001 | journal=Miscellaneous Operations | state=posted
ACCOUNT   LABEL          DEBIT       CREDIT
443000    Salary     12,000.00         0.00
201000    Salary          0.00    12,000.00
201000    ISR             0.00     1,200.00
443000    ISR         1,200.00         0.00
          TOTALS     13,200.00    13,200.00

I also re-ran a payslip-engine check on payroll alone before and after installing this module to confirm nothing regressed.

Note

Loading demo data changed in Odoo 19 — --without-demo is no longer enough and there is a new odoo module force-demo subcommand. Without demo data these tests fail on base.res_partner_12, which does exist in 19.0's demo. Worth knowing when reproducing locally.

@appstogrow @nimarosa


Assisted-by: Claude Opus 4.8

Disclosed per the OCA Generative AI / LLM Policy.
Developed and verified under my direction and review; I take responsibility for the contribution.

Saran440 and others added 30 commits August 8, 2026 12:57
Currently translated at 100.0% (24 of 24 strings)

Translation: payroll-14.0/payroll-14.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll_account/ca/
Currently translated at 16.6% (4 of 24 strings)

Translation: payroll-14.0/payroll-14.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll_account/es_AR/
Currently translated at 100.0% (24 of 24 strings)

Translation: payroll-14.0/payroll-14.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll_account/es_AR/
Currently translated at 100.0% (24 of 24 strings)

Translation: payroll-14.0/payroll-14.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll_account/es/
… payslip

Until now this module tried to confirm an empty account move. This caused
the account module to throw an exception. This causes problems in
other modules that may not know about payroll_account. For example
in other modules' tests.
Currently translated at 100.0% (24 of 24 strings)

Translation: payroll-14.0/payroll-14.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll_account/es_AR/
Currently translated at 100.0% (24 of 24 strings)

Translation: payroll-14.0/payroll-14.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll_account/es/
[14.0] [IMP] payroll: improve salary rules views and documentation

[14.0] [IMP] payroll: improve salary rules  and categories views

[14.0] [IMP] payroll: improve salary rules views and documentation

[14.0] [IMP] payroll: improve salary rules views and documentation

[IMP] payroll: fix repeated words

[14.0] [IMP] payroll: fix typos
[14.0] [IMP] payroll: change manifest category

[14.0] [IMP] payroll: add migration for new payslip and payslips objects

[14.0] [IMP] payroll: add migration for new payslip and payslips objects

[14.0] [IMP] payroll: add migration for new payslip and payslips objects
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: payroll-16.0/payroll-16.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-16-0/payroll-16-0-payroll_account/
Currently translated at 100.0% (21 of 21 strings)

Translation: payroll-16.0/payroll-16.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-16-0/payroll-16-0-payroll_account/fa/
Currently translated at 80.9% (17 of 21 strings)

Translation: payroll-16.0/payroll-16.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-16-0/payroll-16-0-payroll_account/it/
dreispt and others added 22 commits August 8, 2026 12:57
Currently translated at 100.0% (22 of 22 strings)

Translation: payroll-18.0/payroll-18.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-18-0/payroll-18-0-payroll_account/es_VE/
Currently translated at 100.0% (22 of 22 strings)

Translation: payroll-18.0/payroll-18.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-18-0/payroll-18-0-payroll_account/es/
Currently translated at 100.0% (22 of 22 strings)

Translation: payroll-18.0/payroll-18.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-18-0/payroll-18-0-payroll_account/tr/
In Odoo 17.0+, the address_home_id field was removed from hr.employee
and replaced with work_contact_id. This caused journal entries to be
created without proper partner information when no register partner
was configured.

This fix implements proper partner resolution logic:
- For asset_receivable and liability_current accounts: Use employee
  partner (work_contact_id with fallback to bank_account_id.partner_id)
- For liability_payable accounts: Use register partner
- For other account types: No partner assigned

Also includes proper null checks to prevent AttributeError when
accessing .id on empty Many2one fields.

Added minimal test coverage for the new partner logic to verify
correct partner assignment for different account types.

Fixes OCA#221
Currently translated at 100.0% (22 of 22 strings)

Translation: payroll-18.0/payroll-18.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-18-0/payroll-18-0-payroll_account/sl/
Currently translated at 100.0% (22 of 22 strings)

Translation: payroll-18.0/payroll-18.0-payroll_account
Translate-URL: https://translation.odoo-community.org/projects/payroll-18-0/payroll-18-0-payroll_account/sl/
@neoand
neoand force-pushed the 19.0-mig-payroll_account branch 4 times, most recently from a8a7b26 to 1b53a7f Compare August 11, 2026 10:32
Odoo 19 removed the `hr_contract` addon: contract data now lives on
`hr.version`, which is the model this module extends.

- models/hr_contract.py: _inherit "hr.contract" -> "hr.version", mirroring
  what the payroll module already does on 19.0
- views: inherit payroll.hr_contract_view_form (model hr.version) instead of
  the removed hr_contract.hr_contract_view_form, anchoring the accounting
  fields after struct_id
- tests: build the contract through employee.version_id.write() with
  contract_date_start (the pattern used by payroll/tests/common.py on 19.0);
  hr.employee.gender -> sex; hr.employee.bank_account_id -> bank_account_ids
- drop the 18.0.1.0.2 migration scripts
- adapt to 19.0 lint rules: odoo._() -> self.env._() and lazy %% formatting
  (translation-not-lazy, prefer-env-translation), following what the payroll
  module already does on this branch

Assisted-by: Claude Opus 4.8
@neoand
neoand force-pushed the 19.0-mig-payroll_account branch from 1b53a7f to df4caf9 Compare August 11, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.