[FIX]: fix a small problem in voucher for opening a voucher

bzr revid: mga@tinyerp.com-20100815124812-2fsaw7y6hznhfxg4
This commit is contained in:
Mantavya Gajjar 2010-08-15 18:18:12 +05:30
parent 3682534f8d
commit 5fdc544309
1 changed files with 13 additions and 3 deletions

View File

@ -292,19 +292,29 @@ class account_voucher(osv.osv):
if total != 0:
res = {
'amount':total
'amount':total,
'state':voucher.state
}
self.write(dbcr, uid, ids, res)
else:
raise osv.except_osv(_('Invalid amount !'), _('You can not create Pro-Forma voucher with Total amount <= 0 !'))
return True
def write(self, cr, uid, ids, vals, context={}):
res = super(account_voucher, self).write(cr, uid, ids, vals, context)
if not 'state' in vals.keys():
self.open_voucher(cr, uid, ids, context)
return res
def voucher_recheck(self, cr, uid, ids, context={}):
self.open_voucher(cr, uid, ids, context)
#self.open_voucher(cr, uid, ids, context)
self.write(cr, uid, ids, {'state':'recheck'}, context)
return True
def proforma_voucher(self, cr, uid, ids, context={}):
#self.open_voucher(cr, uid, ids, context)
self.action_move_line_create(cr, uid, ids)
self.write(cr, uid, ids, {'state':'posted'})
return True