From: Stephane Wirtel Date: Wed, 18 Apr 2012 09:38:11 +0000 (+0200) Subject: [FIX] account: Remove the button to load the definition of the currencies in the... X-Git-Tag: 7.0-server~830^2~196^2~16 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=6cba88d9465761861786e5148b88adfd4b92ac16;p=odoo%2Fodoo.git [FIX] account: Remove the button to load the definition of the currencies in the cash register and replace it by an on_change which returns an one2many with the right values - Not compatible with the GTK client bzr revid: stw@openerp.com-20120418093811-ycfyi4l69lhgbn1s --- diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 2b191e8..4dffb72 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -274,9 +274,24 @@ class account_cash_statement(osv.osv): if count: journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context) raise osv.except_osv(_('Error !'), (_('The Account Journal %s is opened by an other Cash Register !') % (journal.name,))) + else: + proxy_line = self.pool.get('account.cashbox.line') + + values = dict(starting_details_ids=[], ending_details_ids=[]) + + journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context) + + for line in journal.cashbox_line_ids: + values['starting_details_ids'].append({'pieces' : line.pieces}) + values['ending_details_ids'].append({'pieces' : line.pieces}) + return { 'value' : values } else: return { - 'balance_start': balance_start + 'value' : { + 'balance_start': balance_start, + 'starting_details_ids': [], + 'ending_details_ids' : [], + } } return super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context=context) @@ -353,23 +368,6 @@ class account_cash_statement(osv.osv): cash_box_line_pool.write(cr, uid, [end.id], {'number': 0}) return True - def button_load_cashbox_lines(self, cr, uid, ids, context=None): - if not ids: - return False - - proxy_line = self.pool.get('account.cashbox.line') - - for record in self.browse(cr, uid, ids, context=context): - - proxy_line.unlink(cr, uid, [line.id for line in record.starting_details_ids], context=context) - proxy_line.unlink(cr, uid, [line.id for line in record.ending_details_ids], context=context) - - for cash in record.journal_id.cashbox_line_ids: - proxy_line.create(cr, uid, {'pieces' : cash.pieces, 'starting_id' : record.id }, context=context) - proxy_line.create(cr, uid, {'pieces' : cash.pieces, 'ending_id' : record.id}, context=context) - - return True - account_cash_statement() class account_journal(osv.osv): diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 57ff02b..c88c23e 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2660,8 +2660,6 @@ action = pool.get('res.config').next(cr, uid, [], context) -