diff --git a/addons/account/account.py b/addons/account/account.py index ac82f7fe026..54354b4ea90 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1144,6 +1144,7 @@ class account_move(osv.osv): return amount def _centralise(self, cr, uid, move, mode, context=None): + assert(mode in ('debit', 'credit'), 'Invalid Mode') #to prevent sql injection if context is None: context = {} @@ -1191,10 +1192,7 @@ class account_move(osv.osv): else: line_id2 = 0 - cr.execute('SELECT SUM('+mode+') '\ - 'FROM account_move_line '\ - 'WHERE move_id=%s AND id<>%s', - (move.id, line_id2)) + cr.execute('SELECT SUM(%s) FROM account_move_line WHERE move_id=%%s AND id!=%%s' % (mode,), (move.id, line_id2)) result = cr.fetchone()[0] or 0.0 cr.execute('update account_move_line set '+mode2+'=%s where id=%s', (result, line_id)) return True diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 6de3dabaa28..0e46944a436 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -45,7 +45,7 @@ class account_bank_statement(osv.osv): 'type': 'ir.actions.act_window', 'target': 'new', 'nodestroy': True - } + } def _default_journal_id(self, cr, uid, context={}): if context.get('journal_id', False): @@ -556,9 +556,9 @@ account_bank_statement_reconcile_line() class account_bank_statement_line(osv.osv): - def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, - context={}): + def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context={}): res = {'value': {}} + if not partner_id: return res line = self.browse(cursor, user, line_id) @@ -591,6 +591,10 @@ class account_bank_statement_line(osv.osv): balance = res_currency_obj.compute(cursor, user, company_currency_id, currency_id, balance, context=context) res['value']['amount'] = balance + + if context.get('amount', 0) > 0: + res['value']['amount'] = context.get('amount') + return res def _reconcile_amount(self, cursor, user, ids, name, args, context=None): diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index bceb1b3c857..fc10c58cc8f 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -349,11 +349,15 @@ + + - + + + @@ -363,7 +367,7 @@ - + diff --git a/addons/account/account_report.xml b/addons/account/account_report.xml index 6480178d1ae..fc622d8f0c0 100644 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -34,7 +34,7 @@ string="Taxes Report"/>
- + - + @@ -353,9 +353,10 @@ - - - + + + + @@ -364,16 +365,18 @@ + + + + + - - - - - - - - - + + + + + + @@ -394,6 +397,24 @@ + + account.bank.statement.select + account.bank.statement + search + + + + + + + + + + + + + + account.bank.statement.tree account.bank.statement @@ -453,6 +474,7 @@ + @@ -462,7 +484,7 @@ - + @@ -1000,6 +1022,7 @@ +