Skip to content

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

Open
amincheloh wants to merge 30 commits into
OCA:19.0from
amincheloh:19.0-mig-payroll_account
Open

[19.0][MIG] payroll_account: Migration to 19.0#294
amincheloh wants to merge 30 commits into
OCA:19.0from
amincheloh:19.0-mig-payroll_account

Conversation

@amincheloh

Copy link
Copy Markdown

Migration of payroll_account to 19.0.

Part of #216. Depends on payroll 19.0.1.0.0, already present in the 19.0 branch.

Main changes

Contracts are now employee versions (hr.contracthr.version)

  • analytic_account_id and journal_id are declared on hr.version.
  • Added a _get_whitelist_fields_from_template() override so both fields are
    copied when a contract template is applied to an employee — without it, core
    only propagates its own whitelist and the salary journal / analytic account of
    a template would be silently dropped.
  • hr_contract_view_form now inherits payroll.hr_contract_view_form (the
    contract template form) and adds an Accounting group after the contract
    group.
  • New hr_employee_view_form inheritance exposing both fields in the employee
    Payroll tab, right after struct_id, since contract data is edited from the
    employee form in 19.0.

Partner resolution on payslip lines

  • hr.employee.bank_account_id no longer exists; _get_partner_id() now falls
    back to primary_bank_account_id.partner_id when the employee has no work
    contact.

Salary rules

  • Removed the [('deprecated', '=', False)] domain from account_debit and
    account_credit: account.account.deprecated no longer exists in 19.0.

Misc

  • _()self.env._() with named interpolation parameters.
  • Dropped the obsolete 18.0.1.0.2 migration scripts.
  • Tests adapted to the version model (the version created with the employee is
    completed instead of creating an hr.contract, gendersex,
    bank_account_idbank_account_ids), plus a new test covering the bank
    account fallback in the partner logic.

Notes for reviewers

The branch replays the module history from 18.0; administrative commits
(Weblate, [BOT] post-merge updates, .pot and README regenerations) have been
squashed into their preceding functional commit as suggested by the migration
wiki.

Saran440 and others added 29 commits September 4, 2026 07:36
…or the 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.
…cumentation

[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
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
@OCA-git-bot OCA-git-bot added the mod:payroll_account Module payroll_account label Sep 4, 2026
@amincheloh
amincheloh force-pushed the 19.0-mig-payroll_account branch 2 times, most recently from 8160854 to d813f7b Compare September 4, 2026 16:12
@amincheloh
amincheloh force-pushed the 19.0-mig-payroll_account branch from d813f7b to f62b613 Compare September 4, 2026 16:47
@amincheloh

Copy link
Copy Markdown
Author

@nimarosa please review PR, thanks.

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.