[IMP] account: load the pieces of the currency in the cash register

bzr revid: stw@openerp.com-20120416113633-418a4s4h55hchwkr
This commit is contained in:
Stephane Wirtel 2012-04-16 13:36:33 +02:00
parent 24687ac6bc
commit 938ae552fa
2 changed files with 17 additions and 5 deletions

View File

@ -327,10 +327,21 @@ class account_cash_statement(osv.osv):
cash_box_line_pool.write(cr, uid, [end.id], {'number': 0})
return True
def button_load_cashbox_line(self, cr, uid, ids, context=None):
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()
@ -348,10 +359,12 @@ class account_journal_cashbox_line(osv.osv):
_name = 'account.journal.cashbox.line'
_rec_name = 'value'
_columns = {
'value' : fields.float('Value'),
'pieces': fields.float('Values', digits_compute=dp.get_precision('Account')),
'journal_id' : fields.many2one('account.journal', 'Journal', required=True, select=1),
}
_order = 'pieces asc'
account_journal_cashbox_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -507,7 +507,7 @@
<page string="Cash Box">
<field name="cashbox_line_ids" nolabel="1">
<tree string="CashBox Lines" editable="bottom">
<field name="value" />
<field name="pieces" />
</tree>
</field>
</page>
@ -2660,8 +2660,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
</field>
</page>
<page string="CashBox">
<button name="load_cashbox_lines" type="object" string="Load CashBox Lines" />
<field name="cashbox_line_ids" />
<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')]}">