[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
This commit is contained in:
Stephane Wirtel 2012-04-18 11:38:11 +02:00
parent 5eef94995f
commit 6cba88d946
2 changed files with 16 additions and 20 deletions

View File

@ -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):

View File

@ -2660,8 +2660,6 @@ action = pool.get('res.config').next(cr, uid, [], context)
</field>
</page>
<page string="CashBox">
<button name="button_load_cashbox_lines" type="object" string="Load CashBox Lines" />
<newline />
<group col="2" colspan="2" expand="1">
<field name="starting_details_ids" nolabel="1" colspan="2" attrs="{'readonly':[('state','!=','draft')]}">
<tree string = "Opening Balance" editable="bottom">