bzr revid: hmo@tinyerp.com-20081106153911-eug0498q1bvu4uc5
This commit is contained in:
Harshad Modi 2008-11-06 21:09:11 +05:30
parent 1e5c8304ee
commit 19b5efde0d
3 changed files with 12 additions and 6 deletions

View File

@ -410,6 +410,15 @@ class mrp_production(osv.osv):
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/',
}
_order = 'date_planned asc, priority desc';
def unlink(self, cr, uid, ids):
productions = self.read(cr, uid, ids, ['state'])
unlink_ids = []
for s in productions:
if s['state'] in ['draft','cancel']:
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!' % s['state']))
return osv.osv.unlink(self, cr, uid, unlink_ids)
def location_id_change(self, cr, uid, ids, src, dest, context={}):
if dest:
@ -780,8 +789,7 @@ class mrp_procurement(osv.osv):
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!' % s['state']))
osv.osv.unlink(self, cr, uid, unlink_ids)
return True
return osv.osv.unlink(self, cr, uid, unlink_ids)
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
if product_id:

View File

@ -207,8 +207,7 @@ class purchase_order(osv.osv):
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!' % s['state']))
osv.osv.unlink(self, cr, uid, unlink_ids)
return True
return osv.osv.unlink(self, cr, uid, unlink_ids)
def button_dummy(self, cr, uid, ids, context={}):
return True

View File

@ -261,8 +261,7 @@ class sale_order(osv.osv):
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sale Order(s) which are already confirmed !'))
osv.osv.unlink(self, cr, uid, unlink_ids)
return True
return osv.osv.unlink(self, cr, uid, unlink_ids)
def onchange_shop_id(self, cr, uid, ids, shop_id):
v={}