From b347a98ee0b576e6358391a06a2c0e40a3f77775 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 25 Sep 2008 11:01:25 +0530 Subject: [PATCH] bug fix: - modify name_get method on account_move_reconcile object - account move line bug fix bzr revid: mra@tinyerp.com-20080925053125-pdg0711nfnnhbf3f --- addons/account/account.py | 20 +++++++++++++------- addons/account/account_move_line.py | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 94086e86742..61c0a77be3b 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -924,15 +924,21 @@ class account_move_reconcile(osv.osv): {'reconcile_id': rec.id } ) return True + def name_get(self, cr, uid, ids, context=None): - result = {} + if not len(ids): + return [] + result = [] for r in self.browse(cr, uid, ids, context): total = reduce(lambda y,t: (t.debit or 0.0) - (t.credit or 0.0) + y, r.line_partial_ids, 0.0) if total: - result[r.id] = '%s (%.2f)' % (r.name, total) + name = '%s (%.2f)' % (r.name, total) + result.append((r.id,name)) else: - result[r.id] = r.name + result.append((r.id,r.name)) return result + + account_move_reconcile() #---------------------------------------------------------- @@ -1510,7 +1516,7 @@ class account_config_wizard(osv.osv_memory): } def install_account_chart(self, cr, uid,ids, context=None): - for res in self.read(cr,uid,ids): + for res in self.read(cr,uid,ids): id = res['charts'] def install(id): mod_obj = self.pool.get('ir.module.module') @@ -1558,7 +1564,7 @@ class account_config_wizard(osv.osv_memory): 'target':'new', } - + account_config_wizard() @@ -2036,8 +2042,8 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'res_model': 'ir.module.module.configuration.wizard', 'type': 'ir.actions.act_window', 'target':'new', - } - + } + wizard_multi_charts_accounts() diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index f9d2dea38cc..e55b6d54fee 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -629,7 +629,7 @@ class account_move_line(osv.osv): if raise_ex: raise osv.except_osv(_('Wrong Accounting Entry!'), _('Both Credit and Debit cannot be zero!')) - + account_obj = self.pool.get('account.account') if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']: raise osv.except_osv(_('Bad account!'), _('You can not use an inactive account!')) if update_check: