-
-
Notifications
You must be signed in to change notification settings - Fork 164
[17.0][FIX] payroll_account: Fix partner logic in hr_payslip_line for issue #221 #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[17.0][FIX] payroll_account: Fix partner logic in hr_payslip_line for issue #221 #223
Conversation
Currently translated at 100.0% (307 of 307 strings) Translation: payroll-14.0/payroll-14.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es_AR/
…one record [FIX] payroll: fix _compute_name singleton error
… payslip line views
Currently translated at 100.0% (304 of 304 strings) Translation: payroll-14.0/payroll-14.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es/
Currently translated at 100.0% (304 of 304 strings) Translation: payroll-14.0/payroll-14.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es_AR/
…ing name [IMP] payroll: Improve views, add child functionalities, allow compute of name [FIX] payroll: fix test expected values [IMP] payroll: [IMP] payroll: Improve views, add child functionalities, allow compute of name [IMP] payroll: Improve views, add child functionalities, allow compute of name [IMP] payroll: Improve views, add child functionalities, allow compute of name [IMP] payroll: Improve views, add child functionalities, allow compute of name [IMP] payroll: Add test coverage for new child view and flag [IMP] payroll: Improve views, add child functionalities, allow compute of name [IMP] payroll: change tab name [IMP] payroll: Add info alert in salary_rule form explaining functionality
Currently translated at 100.0% (313 of 313 strings) Translation: payroll-14.0/payroll-14.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es/
Currently translated at 100.0% (313 of 313 strings) Translation: payroll-14.0/payroll-14.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es_AR/
…cently created on top)
…comments that were not commented
…iews more sane in Firefox
[IMP] payroll: Move and refactor category sum function (now can be inherited) [IMP] payroll: _get_payslip_lines refactoring [IMP] payroll: move basebrowsableobject to own file [IMP] payroll: adapt compute method to new returned values [IMP] payroll: Add compute_date and use "verify" unused state - improve views and filters [IMP] payroll: Add compute_date and use "verify" unused state - improve views and filters [IMP] payroll: misc changes [FIX] payslip_change_state: Fix tests and exeptions acording new implementation [ADD] hr_payroll_cancel: Add mantainer keys [IMP] payroll: Change more detailes name for lines [IMP] all: Change repo description and contributors file. [IMP] payroll: change order [IMP] payroll: minor changes [IMP] payroll: minor changes
[IMP] payroll: Add hook method for accesing localdict
Currently translated at 100.0% (315 of 315 strings) Translation: payroll-14.0/payroll-14.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es/
Currently translated at 100.0% (315 of 315 strings) Translation: payroll-14.0/payroll-14.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es_AR/
[FIX] payroll: fix tests [FIX] payroll: fix tests [IMP] payroll: Add conditional button and computed method for setting [IMP] payroll: Add conditional button and computed method for setting [IMP] payroll: Move cancel test to payroll account [IMP] payroll: Add hr_payslio_cancel refund sheet code [FIX] payroll: tests change import [FIX] payroll: Remove account in tests, will add another test in account module [IMP] payroll_account: Add cancel tests for accounting module [FIX] payroll_account: Test remove [FIX] account_payroll: Fix tests
When calling _compute_payslip_line() call it on the payslip object and not recordset 'self'.
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/
[IMP] payroll_account: Remove folder migrations
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: payroll-17.0/payroll-17.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-17-0/payroll-17-0-payroll/
Currently translated at 100.0% (355 of 355 strings) Translation: payroll-17.0/payroll-17.0-payroll Translate-URL: https://translation.odoo-community.org/projects/payroll-17-0/payroll-17-0-payroll/it/
|
Hi @nimarosa, @appstogrow, |
a2b7624 to
11746ee
Compare
| if register_partner_id or acc_type in ("asset_receivable", "liability_payable"): | ||
| return register_partner_id.id | ||
| # Determine which account we're dealing with | ||
| acc_type = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selects the correct account (credit or debit)
then safely checks the account type (account_type) — if not found, returns False to avoid an error
account = (
self.salary_rule_id.account_credit if credit_account
else self.salary_rule_id.account_debit
)
acc_type = account and account.account_type or False
if not acc_type:
return False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @CristianoMafraJunior
Change applied but in different PR's (somehow I broke this one)
I appreciate it if you can do review for both 17.0 & 18.0
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
11746ee to
eec5d75
Compare
Description
This PR fixes the partner logic in
hr_payslip_line._get_partner_id()to address issue #221 where journal entries were created without proper partner information in Odoo 17.0+.Problem
The original logic had several issues:
address_home_idbut did not use a replacement. Odoo removed fieldaddress_home_idfrom modelhr.employeewhich was used in getting partner for employee inpayroll_accountto set partner in created journal entry.liability_currentaccount type in partner-required accountsSolution
Replaced the flawed logic with semantically-correct partner assignment using the proper partner source:
Changes
Core Logic (payroll_account/models/hr_payslip_line.py)
Business Logic
Test Coverage
Added
test_partner_logic_account_types()to verify:Fixes #221
Pull Request opened by Augment Code with guidance from the PR author