[IMP] mrp: simplify code

bzr revid: rco@openerp.com-20111216135205-q3d8zmb80t77d2v4
This commit is contained in:
Raphael Collet 2011-12-16 14:52:05 +01:00
parent 2f90d02a0d
commit acbde0f84a
1 changed files with 4 additions and 7 deletions

View File

@ -498,13 +498,10 @@ class mrp_production(osv.osv):
]
def unlink(self, cr, uid, ids, context=None):
unlink_ids = []
for production in self.read(cr, uid, ids, ['state'], context=context):
if production['state'] in ['draft','cancel']:
unlink_ids.append(production['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete a manufacturing order in the state \'%s\'!') % production['state'])
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
for production in self.browse(cr, uid, ids, context=context):
if production.state not in ('draft', 'cancel'):
raise osv.except_osv(_('Invalid action !'), _('Cannot delete a manufacturing order in state \'%s\'') % production.state)
return super(mrp_production, self).unlink(cr, uid, ids, context=context)
def copy(self, cr, uid, id, default=None, context=None):
if default is None: