[FIX] unlink take the context in parameter
lp bug: https://launchpad.net/bugs/319172 fixed bzr revid: christophe@tinyerp.com-20090121112121-ul99ohzlcfw161ge
This commit is contained in:
parent
e9b151ef2b
commit
22651c2c4f
|
@ -284,7 +284,7 @@ class account_invoice(osv.osv):
|
||||||
'reference_type': lambda *a: 'none',
|
'reference_type': lambda *a: 'none',
|
||||||
}
|
}
|
||||||
|
|
||||||
def unlink(self, cr, uid, ids):
|
def unlink(self, cr, uid, ids, context=None):
|
||||||
invoices = self.read(cr, uid, ids, ['state'])
|
invoices = self.read(cr, uid, ids, ['state'])
|
||||||
unlink_ids = []
|
unlink_ids = []
|
||||||
for t in invoices:
|
for t in invoices:
|
||||||
|
@ -292,7 +292,7 @@ class account_invoice(osv.osv):
|
||||||
unlink_ids.append(t['id'])
|
unlink_ids.append(t['id'])
|
||||||
else:
|
else:
|
||||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) which are already opened or paid !'))
|
raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) which are already opened or paid !'))
|
||||||
osv.osv.unlink(self, cr, uid, unlink_ids)
|
osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# def get_invoice_address(self, cr, uid, ids):
|
# def get_invoice_address(self, cr, uid, ids):
|
||||||
|
|
|
@ -173,7 +173,7 @@ class account_voucher(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def unlink(self, cr, uid, ids):
|
def unlink(self, cr, uid, ids, context=None):
|
||||||
vouchers = self.read(cr, uid, ids, ['state'])
|
vouchers = self.read(cr, uid, ids, ['state'])
|
||||||
unlink_ids = []
|
unlink_ids = []
|
||||||
for t in vouchers:
|
for t in vouchers:
|
||||||
|
@ -181,7 +181,7 @@ class account_voucher(osv.osv):
|
||||||
unlink_ids.append(t['id'])
|
unlink_ids.append(t['id'])
|
||||||
else:
|
else:
|
||||||
raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !')
|
raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !')
|
||||||
osv.osv.unlink(self, cr, uid, unlink_ids)
|
osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -437,7 +437,7 @@ class mrp_production(osv.osv):
|
||||||
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/',
|
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/',
|
||||||
}
|
}
|
||||||
_order = 'date_planned asc, priority desc';
|
_order = 'date_planned asc, priority desc';
|
||||||
def unlink(self, cr, uid, ids):
|
def unlink(self, cr, uid, ids, context=None):
|
||||||
productions = self.read(cr, uid, ids, ['state'])
|
productions = self.read(cr, uid, ids, ['state'])
|
||||||
unlink_ids = []
|
unlink_ids = []
|
||||||
for s in productions:
|
for s in productions:
|
||||||
|
@ -445,7 +445,7 @@ class mrp_production(osv.osv):
|
||||||
unlink_ids.append(s['id'])
|
unlink_ids.append(s['id'])
|
||||||
else:
|
else:
|
||||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!' % s['state']))
|
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)
|
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||||
|
|
||||||
def location_id_change(self, cr, uid, ids, src, dest, context={}):
|
def location_id_change(self, cr, uid, ids, src, dest, context={}):
|
||||||
if dest:
|
if dest:
|
||||||
|
@ -796,7 +796,7 @@ class mrp_procurement(osv.osv):
|
||||||
'procure_method': lambda *a: 'make_to_order',
|
'procure_method': lambda *a: 'make_to_order',
|
||||||
}
|
}
|
||||||
|
|
||||||
def unlink(self, cr, uid, ids):
|
def unlink(self, cr, uid, ids, context=None):
|
||||||
procurements = self.read(cr, uid, ids, ['state'])
|
procurements = self.read(cr, uid, ids, ['state'])
|
||||||
unlink_ids = []
|
unlink_ids = []
|
||||||
for s in procurements:
|
for s in procurements:
|
||||||
|
@ -804,7 +804,7 @@ class mrp_procurement(osv.osv):
|
||||||
unlink_ids.append(s['id'])
|
unlink_ids.append(s['id'])
|
||||||
else:
|
else:
|
||||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!' % s['state']))
|
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!' % s['state']))
|
||||||
return osv.osv.unlink(self, cr, uid, unlink_ids)
|
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||||
|
|
||||||
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
|
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
|
||||||
if product_id:
|
if product_id:
|
||||||
|
|
|
@ -95,7 +95,7 @@ class project_work(osv.osv):
|
||||||
# delete entry from timesheet too while deleting entry to task.
|
# delete entry from timesheet too while deleting entry to task.
|
||||||
list_avail_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, [])
|
list_avail_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, [])
|
||||||
if timesheet_id in list_avail_ids:
|
if timesheet_id in list_avail_ids:
|
||||||
obj = self.pool.get('hr.analytic.timesheet').unlink(cr, uid, [timesheet_id], *args)
|
obj = self.pool.get('hr.analytic.timesheet').unlink(cr, uid, [timesheet_id], *args, **kwargs)
|
||||||
|
|
||||||
return super(project_work,self).unlink(cr, uid, ids, *args, **kwargs)
|
return super(project_work,self).unlink(cr, uid, ids, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ class sale_order(osv.osv):
|
||||||
_order = 'name desc'
|
_order = 'name desc'
|
||||||
|
|
||||||
# Form filling
|
# Form filling
|
||||||
def unlink(self, cr, uid, ids):
|
def unlink(self, cr, uid, ids, context=None):
|
||||||
sale_orders = self.read(cr, uid, ids, ['state'])
|
sale_orders = self.read(cr, uid, ids, ['state'])
|
||||||
unlink_ids = []
|
unlink_ids = []
|
||||||
for s in sale_orders:
|
for s in sale_orders:
|
||||||
|
@ -276,7 +276,7 @@ class sale_order(osv.osv):
|
||||||
unlink_ids.append(s['id'])
|
unlink_ids.append(s['id'])
|
||||||
else:
|
else:
|
||||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sale Order(s) which are already confirmed !'))
|
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sale Order(s) which are already confirmed !'))
|
||||||
return osv.osv.unlink(self, cr, uid, unlink_ids)
|
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||||
|
|
||||||
|
|
||||||
def onchange_shop_id(self, cr, uid, ids, shop_id):
|
def onchange_shop_id(self, cr, uid, ids, shop_id):
|
||||||
|
|
|
@ -307,7 +307,7 @@ class stock_tracking(osv.osv):
|
||||||
res = [(r['id'], r['name']+' ['+(r['serial'] or '')+']') for r in self.read(cr, uid, ids, ['name','serial'], context)]
|
res = [(r['id'], r['name']+' ['+(r['serial'] or '')+']') for r in self.read(cr, uid, ids, ['name','serial'], context)]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def unlink(self, cr ,uid, ids):
|
def unlink(self, cr ,uid, ids, context=None):
|
||||||
raise osv.except_osv(_('Error'), _('You can not remove a lot line !'))
|
raise osv.except_osv(_('Error'), _('You can not remove a lot line !'))
|
||||||
stock_tracking()
|
stock_tracking()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue