[FIX] hr: not set partner of a bank account to False
Steps to reproduce: ------------------- - install `account` module; - create an employee; - add a bank account; - add a related user and save; - remove the user and save; Issue: ------ A traceback occurs. Cause: ------ We synchronize the `partner_id` of the `bank_account` with the `work_contact_id`. If the latter is `False`, this triggers an error. Solution: --------- Do not trigger the logic that updates the `partner_id` of the `bank_account` if the value is `False`. This keeps the logic that the `partner_id` field in the `res.partner.bank` model is required. opw-3558983 closes odoo/odoo#139570 X-original-commit: c19574e26d8814a745152489eb16915f13b2a6c0 Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com> Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
@@ -415,7 +415,8 @@ class HrEmployeePrivate(models.Model):
|
||||
if vals['work_contact_id'] != bank_account.partner_id.id:
|
||||
if bank_account.allow_out_payment:
|
||||
bank_account.sudo().allow_out_payment = False
|
||||
bank_account.partner_id = vals['work_contact_id']
|
||||
if vals['work_contact_id']:
|
||||
bank_account.partner_id = vals['work_contact_id']
|
||||
self.message_unsubscribe(self.work_contact_id.ids)
|
||||
if vals['work_contact_id']:
|
||||
self._message_subscribe([vals['work_contact_id']])
|
||||
|
||||
Reference in New Issue
Block a user