payroll icon indicating copy to clipboard operation
payroll copied to clipboard

[18.0][17.0] payroll_account: partner logic for employee partner

Open hussain opened this issue 2 months ago • 2 comments

payroll_account

Odoo removed field address_home_id from model hr.employee which was used in getting partner for employee in payroll_account to set partner in created journal entry.

Current code in 17 & 18

# payroll_account/models/hr_payslip_line.py

    def _get_partner_id(self, credit_account):
        ...
        # use partner of salary rule or fallback on employee's address
        register_partner_id = self.salary_rule_id.register_id.partner_id
        ...

To Reproduce

Affected versions: 17.0 & 18.0

Steps to reproduce the behavior:

  1. Create a payslip and confirm it (with all required rules to accounting mapping for net rule)
  2. Journal entry is created without partner in journal entry line to record amount liability

Expected behavior Employee partner is set in journal entry line.

Proposal

Odoo introduced new field work_contact_id which is automatically created partner per employee and field is hidden in employee view. This can be used, and it is in employee bank_account_id domain filter.

hussain avatar Oct 12 '25 19:10 hussain

I'm working on a PR for both 17.0 & 18.0 since this is a production issue for us.

hussain avatar Oct 12 '25 19:10 hussain

PR #222 for 17.0 PR #223 for 18.0

hussain avatar Oct 16 '25 11:10 hussain