diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index a42d35c59ed..a2e641dc39c 100755 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -405,6 +405,27 @@ account_bank_statement() class account_bank_statement_line(osv.osv): + def onchange_partner_id(self, cr, uid, ids, partner_id, context=None): + obj_partner = self.pool.get('res.partner') + if context is None: + context = {} + if not partner_id: + return {} + part = obj_partner.browse(cr, uid, partner_id, context=context) + if not part.supplier and not part.customer: + type = 'general' + elif part.supplier and part.customer: + type = 'general' + else: + if part.supplier == True: + type = 'supplier' + if part.customer == True: + type = 'customer' + res_type = self.onchange_type(cr, uid, ids, partner_id=partner_id, type=type, context=context) + if res_type['value'] and res_type['value'].get('account_id', False): + return {'value': {'type': type, 'account_id': res_type['value']['account_id']}} + return {'value': {'type': type}} + def onchange_type(self, cr, uid, line_id, partner_id, type, context=None): res = {'value': {}} obj_partner = self.pool.get('res.partner') diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index b5b4e86bc5f..77c0721db66 100755 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -565,7 +565,7 @@ - + @@ -574,12 +574,12 @@
+ + - - @@ -2633,7 +2633,7 @@ action = self.pool.get('res.config').next(cr, uid, [], context) - + @@ -2642,12 +2642,12 @@ action = self.pool.get('res.config').next(cr, uid, [], context) + + - -