From d172534a08d943cdf0da345bb032238ca43d0d1b Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Tue, 4 Jan 2011 18:10:45 +0530 Subject: [PATCH 1/3] [FIX]account: account bank statement - usability lp bug: https://launchpad.net/bugs/696914 fixed bzr revid: ara@tinyerp.com-20110104124045-7iyc6opd22ufqtww --- addons/account/account_bank_statement.py | 15 +++++++++++++++ addons/account/account_view.xml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index a42d35c59ed..0887c8b6c8a 100755 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -405,6 +405,19 @@ account_bank_statement() class account_bank_statement_line(osv.osv): + def onchange_partner_id(self, cr, uid, partner_id, type, context={}): + part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) + if not part.supplier and not part.customer : + type = 'general' + elif part.supplier == True and part.customer == True : + type = 'general' + else: + if part.supplier == True : + type = 'supplier' + if part.customer == True : + type = 'customer' + return type + def onchange_type(self, cr, uid, line_id, partner_id, type, context=None): res = {'value': {}} obj_partner = self.pool.get('res.partner') @@ -414,6 +427,8 @@ class account_bank_statement_line(osv.osv): return res account_id = False line = self.browse(cr, uid, line_id, context=context) + type=self.onchange_partner_id(cr, uid, partner_id=partner_id, type=type) + res.update({'value': {'type':type}}) if not line or (line and not line[0].account_id): part = obj_partner.browse(cr, uid, partner_id, context=context) if type == 'supplier': diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index b5b4e86bc5f..2eb66aac911 100755 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -574,8 +574,8 @@
- + From dd88dc5dd519261919dbe9dec928c06a0b4ce9c0 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 5 Jan 2011 11:47:06 +0530 Subject: [PATCH 2/3] [IMP]account: account bank statement - usability bzr revid: ara@tinyerp.com-20110105061706-ac8ottk7uylvmafz --- addons/account/account_bank_statement.py | 4 ++-- addons/account/account_view.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 0887c8b6c8a..f4a2451ce14 100755 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -416,7 +416,7 @@ class account_bank_statement_line(osv.osv): type = 'supplier' if part.customer == True : type = 'customer' - return type + return {'value': {'type': type}} def onchange_type(self, cr, uid, line_id, partner_id, type, context=None): res = {'value': {}} @@ -428,7 +428,7 @@ class account_bank_statement_line(osv.osv): account_id = False line = self.browse(cr, uid, line_id, context=context) type=self.onchange_partner_id(cr, uid, partner_id=partner_id, type=type) - res.update({'value': {'type':type}}) + res.update({'value': {'type':type['value']['type']}}) if not line or (line and not line[0].account_id): part = obj_partner.browse(cr, uid, partner_id, context=context) if type == 'supplier': diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 2eb66aac911..9891e7bc51b 100755 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -574,12 +574,12 @@ + - From 707b2780b49eac1a2f5bb1592abb7de879bf3001 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 5 Jan 2011 12:50:08 +0530 Subject: [PATCH 3/3] [IMP]account: account bank statement - usability bzr revid: ara@tinyerp.com-20110105072008-tan84dkar44plbls --- addons/account/account_bank_statement.py | 22 ++++++++++++++-------- addons/account/account_view.xml | 10 +++++----- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index f4a2451ce14..a2e641dc39c 100755 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -405,17 +405,25 @@ account_bank_statement() class account_bank_statement_line(osv.osv): - def onchange_partner_id(self, cr, uid, partner_id, type, context={}): - part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) - if not part.supplier and not part.customer : + 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 == True and part.customer == True : + elif part.supplier and part.customer: type = 'general' else: - if part.supplier == True : + if part.supplier == True: type = 'supplier' - if part.customer == True : + 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): @@ -427,8 +435,6 @@ class account_bank_statement_line(osv.osv): return res account_id = False line = self.browse(cr, uid, line_id, context=context) - type=self.onchange_partner_id(cr, uid, partner_id=partner_id, type=type) - res.update({'value': {'type':type['value']['type']}}) if not line or (line and not line[0].account_id): part = obj_partner.browse(cr, uid, partner_id, context=context) if type == 'supplier': diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 9891e7bc51b..77c0721db66 100755 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -565,7 +565,7 @@ - + @@ -575,7 +575,7 @@ - + @@ -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) + + - -