[FIX] Calendar - Override _name_search to convert virtual_id to real_id
[odoo/odoo.git] / addons / calendar / calendar.py
index 52ed2ef..22d5695 100644 (file)
@@ -1397,6 +1397,13 @@ class calendar_event(osv.Model):
             'flags': {'form': {'action_buttons': True, 'options': {'mode': 'edit'}}}
         }
 
+    def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None):
+        for arg in args:
+            if arg[0] == 'id':
+                for n, calendar_id in enumerate(arg[2]):
+                    arg[2][n] = calendar_id.split('-')[0]
+        return super(calendar_event, self)._name_search(cr, user, name=name, args=args, operator=operator, context=context, limit=limit, name_get_uid=name_get_uid)
+
     def write(self, cr, uid, ids, values, context=None):
         def _only_changes_to_apply_on_real_ids(field_names):
             ''' return True if changes are only to be made on the real ids'''