[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',
|
||||
}
|
||||
|
||||
def unlink(self, cr, uid, ids):
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
invoices = self.read(cr, uid, ids, ['state'])
|
||||
unlink_ids = []
|
||||
for t in invoices:
|
||||
|
@ -292,7 +292,7 @@ class account_invoice(osv.osv):
|
|||
unlink_ids.append(t['id'])
|
||||
else:
|
||||
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
|
||||
|
||||
# def get_invoice_address(self, cr, uid, ids):
|
||||
|
|
|
@ -173,7 +173,7 @@ class account_voucher(osv.osv):
|
|||
return True
|
||||
|
||||
|
||||
def unlink(self, cr, uid, ids):
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
vouchers = self.read(cr, uid, ids, ['state'])
|
||||
unlink_ids = []
|
||||
for t in vouchers:
|
||||
|
@ -181,7 +181,7 @@ class account_voucher(osv.osv):
|
|||
unlink_ids.append(t['id'])
|
||||
else:
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -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 '/',
|
||||
}
|
||||
_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'])
|
||||
unlink_ids = []
|
||||
for s in productions:
|
||||
|
@ -445,7 +445,7 @@ class mrp_production(osv.osv):
|
|||
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)
|
||||
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||
|
||||
def location_id_change(self, cr, uid, ids, src, dest, context={}):
|
||||
if dest:
|
||||
|
@ -796,7 +796,7 @@ class mrp_procurement(osv.osv):
|
|||
'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'])
|
||||
unlink_ids = []
|
||||
for s in procurements:
|
||||
|
@ -804,7 +804,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']))
|
||||
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={}):
|
||||
if product_id:
|
||||
|
|
|
@ -95,7 +95,7 @@ class project_work(osv.osv):
|
|||
# delete entry from timesheet too while deleting entry to task.
|
||||
list_avail_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, [])
|
||||
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)
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ class sale_order(osv.osv):
|
|||
_order = 'name desc'
|
||||
|
||||
# Form filling
|
||||
def unlink(self, cr, uid, ids):
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
sale_orders = self.read(cr, uid, ids, ['state'])
|
||||
unlink_ids = []
|
||||
for s in sale_orders:
|
||||
|
@ -276,7 +276,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 !'))
|
||||
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):
|
||||
|
|
|
@ -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)]
|
||||
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 !'))
|
||||
stock_tracking()
|
||||
|
||||
|
|
Loading…
Reference in New Issue