Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-opw-576398-port-mma into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-576398-port-mma/+merge/132276

Hello,

I have improved warning message which raises while deleting a cancelled invoice.

It throws this warning and invoice is in cancel state,
"You can not delete an invoice which is open or paid. We suggest you to refund 
it instead."

Now it would display as,
"You can not delete an invoice which is open(or been in opened state ever) or 
paid. We suggest you to refund it instead."

Also I reset invoice number while putting cancelled invoice into draft state so 
it can be
deleted when needed from draft state.

Code is forward port from 6.1

Thanks
Mayur


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-576398-port-mma/+merge/132276
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-opw-576398-port-mma.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py	2012-10-29 09:17:13 +0000
+++ account/account_invoice.py	2012-10-31 10:06:31 +0000
@@ -427,11 +427,11 @@
             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 cannot delete an invoice which is open or paid. You should refund it instead.'))
+                raise osv.except_osv(_('Invalid action !'), _('You can not delete an invoice which is open(or been in opened state ever) or paid. We suggest you to refund it instead.'))
         osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
         return True
 

=== modified file 'account/i18n/account.pot'
--- account/i18n/account.pot	2012-08-17 12:06:06 +0000
+++ account/i18n/account.pot	2012-10-31 10:06:31 +0000
@@ -2635,7 +2635,7 @@
 #. module: account
 #: code:addons/account/account_invoice.py:392
 #, python-format
-msgid "You can not delete an invoice which is open or paid. We suggest you to refund it instead."
+msgid "You can not delete an invoice which is open(or been in opened state ever) or paid. We suggest you to refund it instead."
 msgstr ""
 
 #. module: account

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to