← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-account_modify-aag into lp:openobject-addons

 

Atik Agewan(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-account_modify-aag into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account_modify-aag/+merge/53430


Account: Now we can restrict the deletion of account.invoice if it has a number
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account_modify-aag/+merge/53430
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-account_modify-aag.
=== modified file 'account/invoice.py'
--- account/invoice.py	2011-03-07 06:12:02 +0000
+++ account/invoice.py	2011-03-15 12:53:30 +0000
@@ -362,13 +362,13 @@
     def unlink(self, cr, uid, ids, context=None):
         if context is None:
             context = {}
-        invoices = self.read(cr, uid, ids, ['state'], context=context)
+        invoices = self.read(cr, uid, ids, ['state','internal_number'], context=context)
         unlink_ids = []
         for t in invoices:
-            if t['state'] in ('draft', 'cancel'):
+            if t['state'] in ('draft', 'cancel') and t['internal_number']== False:
                 unlink_ids.append(t['id'])
             else:
-                raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) that are already opened or paid !'))
+                raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) that are already opened(or been in opened state ever) or paid!'))
         osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
         return True
 


Follow ups