From a8b1d30fca6bd0597746a619161af2f362ebac60 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 26 Jan 2017 15:20:43 +0100 Subject: [PATCH] [FIX] hr: Bank account from employee not loaded on payment on expense The bank account didn't appear when selecting SEPA credit transfer in ACCOUNTING>PURCHASE>PAYMENTS to refund an employee. The bank account is taken from partner set with the field home_address_id. So the account holder have to be set on the bank_account_id of the employee with the home_address_id. opw:702881 --- addons/hr/hr.py | 4 ++++ addons/hr/hr_view.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index e87ae89af24..f9b536c6915 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -198,6 +198,10 @@ class hr_employee(osv.osv): @api.multi def write(self, vals): + if 'address_home_id' in vals: + account_id = vals.get('bank_account_id') or self.bank_account_id.id + if account_id: + self.env['res.partner.bank'].browse(account_id).partner_id = vals['address_home_id'] tools.image_resize_images(vals) return super(hr_employee, self).write(vals) diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index 41ee36fb9cd..c6399119b1a 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -62,7 +62,7 @@ - +