From 545b61459c3067f944dea0b0a3e0054840f159bb Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Fri, 11 Jan 2013 17:25:29 +0100 Subject: [PATCH] [FIX] orm methods --- super_calendar/super_calendar.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/super_calendar/super_calendar.py b/super_calendar/super_calendar.py index 5bb0156f3..5cffa8918 100644 --- a/super_calendar/super_calendar.py +++ b/super_calendar/super_calendar.py @@ -45,16 +45,15 @@ class super_calendar_configurator(orm.Model): super_calendar_pool = self.pool.get('super.calendar') # removing old records - super_calendar_ids = super_calendar_pool.search(cr, uid, []) - super_calendar_pool.unlink(cr, uid, super_calendar_ids) + super_calendar_ids = super_calendar_pool.search(cr, uid, [], context=context) + super_calendar_pool.unlink(cr, uid, super_calendar_ids, context=context) - for configurator_id in configurator_ids: - configurator = self.browse(cr, uid, configurator_id) + for configurator in self.browse(cr, uid, configurator_ids, context): for line in configurator.line_ids: current_pool = self.pool.get(line.name.model) - current_record_ids = current_pool.search(cr, uid, line.domain and eval(line.domain) or []) + current_record_ids = current_pool.search(cr, uid, line.domain and eval(line.domain) or [], context=context) for current_record_id in current_record_ids: - current_record = current_pool.browse(cr, uid, current_record_id) + current_record = current_pool.browse(cr, uid, current_record_id, context=context) if line.user_field_id and \ current_record[line.user_field_id.name] and current_record[line.user_field_id.name]._table_name != 'res.users': raise osv.except_osv(_('Error'), @@ -85,7 +84,7 @@ class super_calendar_configurator(orm.Model): 'res_id': line.name.model+','+str(current_record['id']), 'model_id': line.name.id, } - super_calendar_pool.create(cr, uid, super_calendar_values) + super_calendar_pool.create(cr, uid, super_calendar_values, context=context) self._logger.info('Calendar generated') return True