payroll
payroll copied to clipboard
[18.0][17.0] payroll_account: partner logic for employee partner
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:
- Create a payslip and confirm it (with all required rules to accounting mapping for net rule)
- 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.
I'm working on a PR for both 17.0 & 18.0 since this is a production issue for us.
PR #222 for 17.0 PR #223 for 18.0