summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Maniet <arthurmaniet@me.com>2015-02-16 11:22:05 +0100
committerArthur Maniet <arthurmaniet@me.com>2015-02-16 11:55:45 +0100
commitd1be21dfdf14c0af2bfcb7108ca5ab63b3b0306c (patch)
tree7d277eb9f18abaa4021507b18f2c42756b2cb0b9
parenta7e0b7393040f84cd95aea3d44b387e054c95add (diff)
[IMP] account: feature that links bank accounts to partners upon bank statement closing.
Retreive additional informations to write on the res.partner.bank by using the onchange_partner_id, instead of only writing the partner_id
-rw-r--r--addons/account/account_bank_statement.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index f605ad3147d..12188b8860d 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -419,7 +419,11 @@ class account_bank_statement(osv.osv):
for statement in self.browse(cr, uid, ids, context=context):
for st_line in statement.line_ids:
if st_line.bank_account_id and st_line.partner_id and st_line.bank_account_id.partner_id.id != st_line.partner_id.id:
- self.pool.get('res.partner.bank').write(cr, uid, [st_line.bank_account_id.id], {'partner_id': st_line.partner_id.id}, context=context)
+ # Update the partner informations of the bank account, possibly overriding existing ones
+ bank_obj = self.pool.get('res.partner.bank')
+ bank_vals = bank_obj.onchange_partner_id(cr, uid, [st_line.bank_account_id.id], st_line.partner_id.id, context=context)['value']
+ bank_vals.update({'partner_id': st_line.partner_id.id})
+ bank_obj.write(cr, uid, [st_line.bank_account_id.id], bank_vals, context=context)
class account_bank_statement_line(osv.osv):