[MERGE] merged the branch containing a new restriction on deletion of invoice if it has an internal_number (if it has already been open). In that case, as it can lead to gap in numbering, people are supposed to make a credite note.
bzr revid: qdp-launchpad@openerp.com-20110324114352-089ttnroiyrszxvr
This commit is contained in:
@@ -362,13 +362,13 @@ class account_invoice(osv.osv):
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user