diff --git a/addons/account/invoice.py b/addons/account/invoice.py index d9f54bcdac3..5b96d44135f 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -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): diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 423cf911632..d5a4f987562 100755 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -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 diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index f9f78c49083..ef73e0ff540 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -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: diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 0472d77d4e5..37e238edab0 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -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) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 58852e00d8b..4e3d384a057 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -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): diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 368591c94a2..8282cbede23 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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()