[FIX]: fix a problem of 0 amount entries

lp bug: https://launchpad.net/bugs/522011 fixed

bzr revid: mga@tinyerp.com-20100215065532-i8h80qycoc5uvnoh
This commit is contained in:
Mantavya Gajjar
2010-02-15 12:25:32 +05:30
parent 4fc1c14b33
commit 601ae1d14c
+6 -3
View File
@@ -170,8 +170,11 @@ class account_voucher(osv.osv):
total=0
for i in obj[0].payment_ids:
total+=i.amount
self.write(cr,uid,ids,{'amount':total})
self.write(cr, uid, ids, {'state':'proforma'})
if total!=0:
self.write(cr,uid,ids,{'amount':total})
self.write(cr, uid, ids, {'state':'proforma'})
else:
raise osv.except_osv('Invalid action !', 'You can not post to Pro-Forma a voucher with Total amount = 0')
return True
def proforma_voucher(self, cr, uid, ids, context={}):
@@ -196,7 +199,7 @@ class account_voucher(osv.osv):
if t['state'] in ('draft', 'cancel'):
unlink_ids.append(t['id'])
else:
raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !')
raise osv.except_osv('Invalid action !', 'Cannot delete Voucher(s) which are already opened or paid !')
osv.osv.unlink(self, cr, uid, unlink_ids)
return True