← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~grupoesoc/server-env-tools/7.0-fix-1302547 into lp:server-env-tools

 

Yajo has proposed merging lp:~grupoesoc/server-env-tools/7.0-fix-1302547 into lp:server-env-tools.

Requested reviews:
  Server Environment And Tools Core Editors (server-env-tools-core-editors)

For more details, see:
https://code.launchpad.net/~grupoesoc/server-env-tools/7.0-fix-1302547/+merge/214517

Fix bug #1302547.
-- 
https://code.launchpad.net/~grupoesoc/server-env-tools/7.0-fix-1302547/+merge/214517
Your team Server Environment And Tools Core Editors is requested to review the proposed merge of lp:~grupoesoc/server-env-tools/7.0-fix-1302547 into lp:server-env-tools.
=== modified file 'super_calendar/super_calendar.py'
--- super_calendar/super_calendar.py	2013-01-11 16:43:17 +0000
+++ super_calendar/super_calendar.py	2014-04-07 11:54:06 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
 #    Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
 #
@@ -25,7 +25,7 @@
 from mako.template import Template
 from datetime import datetime
 from openerp import tools
-from openerp.tools import safe_eval as eval
+from openerp.tools.safe_eval import safe_eval
 
 def _models_get(self, cr, uid, context=None):
     obj = self.pool.get('ir.model')
@@ -44,20 +44,25 @@
     def generate_calendar_records(self, cr, uid, ids, context=None):
         configurator_ids = self.search(cr, uid, [])
         super_calendar_pool = self.pool.get('super.calendar')
-        
+
         # removing old records
         super_calendar_ids = super_calendar_pool.search(cr, uid, [], context=context)
         super_calendar_pool.unlink(cr, uid, super_calendar_ids, context=context)
-        
+
         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 [], context=context)
+                current_record_ids = current_pool.search(
+                    cr,
+                    uid,
+                    line.domain and safe_eval(line.domain) or [],
+                    context=context)
+
                 for current_record_id in current_record_ids:
                     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'), 
+                        raise osv.except_osv(_('Error'),
                             _("The 'User' field of record %s (%s) does not refer to res.users")
                             % (current_record[line.description_field_id.name], line.name.model))
                     if (((line.description_field_id
@@ -116,7 +121,7 @@
         'user_field_id': fields.many2one('ir.model.fields', 'User field',
             domain="['&',('ttype', '=', 'many2one'),('model_id', '=', name)]"),
         }
-        
+
 
 class super_calendar(orm.Model):
     _name = 'super.calendar'

=== modified file 'users_ldap_groups/users_ldap_groups.py'
--- users_ldap_groups/users_ldap_groups.py	2013-07-23 11:21:53 +0000
+++ users_ldap_groups/users_ldap_groups.py	2014-04-07 11:54:06 +0000
@@ -83,7 +83,7 @@
     conf_all=self.read(cr, uid, conf['id'], ['only_ldap_groups'])
     if(conf_all['only_ldap_groups']):
         logger.debug('deleting all groups from user %d' % user_id)
-        userobj.write(cr, uid, user_id, {'groups_id': [(5, )]})
+        userobj.write(cr, uid, [user_id], {'groups_id': [(5, )]})
 
     for mapping in mappingobj.read(cr, uid, mappingobj.search(cr, uid, 
             [('ldap_id', '=', conf['id'])]), []):
@@ -93,6 +93,6 @@
                 mapping['value'], conf, self, logger):
             logger.debug('adding user %d to group %s' % 
                     (user_id, mapping['group'][1]))
-            userobj.write(cr, uid, user_id, 
+            userobj.write(cr, uid, [user_id], 
                     {'groups_id': [(4, mapping['group'][0])]})
     return user_id


Follow ups