From 601ae1d14c923398d2a625dc45d4eb65d7b29865 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Mon, 15 Feb 2010 12:25:32 +0530 Subject: [PATCH] [FIX]: fix a problem of 0 amount entries lp bug: https://launchpad.net/bugs/522011 fixed bzr revid: mga@tinyerp.com-20100215065532-i8h80qycoc5uvnoh --- addons/account_voucher/voucher.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 6fd5204d318..fcfcdda0829 100755 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -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