Kirti Savalia(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/7.0-opw-584197-ksa into 
lp:openobject-addons/7.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-opw-584197-ksa/+merge/142879

Hello,

Able to delete draft state invoice, cancel state invoice can not be deleted.

Thanks
KSA

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-opw-584197-ksa/+merge/142879
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/7.0-opw-584197-ksa.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py	2013-01-05 23:29:19 +0000
+++ account/account_invoice.py	2013-01-11 11:55:26 +0000
@@ -451,9 +451,9 @@
             context = {}
         invoices = self.read(cr, uid, ids, ['state','internal_number'], context=context)
         unlink_ids = []
-        for t in invoices:
-            if t['state'] in ('draft', 'cancel') and t['internal_number']== False:
-                unlink_ids.append(t['id'])
+        for invoice in invoices:
+            if invoice['state'] == 'cancel' and not invoice['internal_number'] or invoice['state'] == 'draft': 
+                unlink_ids.append(invoice['id'])
             else:
                 raise osv.except_osv(_('Invalid Action!'), _('You can not delete an invoice which is not cancelled. You should refund it instead.'))
         osv.osv.unlink(self, cr, uid, unlink_ids, context=context)

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to