From ba65e11add69215f9147a5825f234841b5c6defe Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Mon, 15 Feb 2010 11:58:47 +0530 Subject: [PATCH] [MERGE]: merging from the branch https://bugs.launchpad.net/openobject-addons/+bug/522011 bzr revid: mga@tinyerp.com-20100215062847-q4z0nr7bidckhmmh --- 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 1b1258b8630..d9d370d8a1d 100755 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -171,8 +171,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={}): @@ -197,7 +200,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