We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Bug] mass_editing - Search in ir.model.fields not working
I setup the mass_editing for res.partner then i go to:
Settings -> Technical -> Database Structure -> Fields
and go to the Filter with ('model_id','=',61) where 61 is the id of res.partner in res.model. By typ "res.partner" and select "Partner" from the suggestion.

Then i get the following error:
File "[..]/mass_editing/mass_editing.py", line 34, in search
    model_domain += [('model_id', 'in', map(int, domain[2][1:-1].split(',')))]
TypeError: 'int' object has no attribute '**getitem**'


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mass_editing/mass_editing.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    This module uses OpenERP, Open Source Management Solution Framework.
5 #    Copyright (C):
6 #        2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
7 #
8 #    This program is free software: you can redistribute it and/or modify
9 #    it under the terms of the GNU General Public License as published by
10 #    the Free Software Foundation, either version 3 of the License, or
11 #    (at your option) any later version.
12 #
13 #    This program is distributed in the hope that it will be useful,
14 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #    GNU General Public License for more details.
17 #
18 #    You should have received a copy of the GNU General Public License
19 #    along with this program.  If not, see <http://www.gnu.org/licenses/>
20 #
21 ##############################################################################
22 
23 from openerp.osv import orm, fields, osv
24 from openerp.tools.translate import _
25 
26 
27 class ir_model_fields(orm.Model):
28     _inherit = 'ir.model.fields'
29 
30     def search(
31             self, cr, uid, args, offset=0, limit=0, order=None, context=None,
32             count=False):
33         model_domain = []
34         for domain in args:
35             if domain[0] == 'model_id' and domain[2]\
36                     and type(domain[2]) != list:
37                 model_domain += [(
38                     'model_id', 'in', map(int, domain[2][1:-1].split(',')))]
39             else:
40                 model_domain.append(domain)
41         return super(ir_model_fields, self).search(
42             cr, uid, model_domain, offset=offset, limit=limit, order=order,
43             context=context, count=count)
44 
45 ir_model_fields()
46 
47 
48 class mass_object(orm.Model):
49     _name = "mass.object"
50 
51     _columns = {
52         'name': fields.char("Name", size=64, required=True, select=1),
53         'model_id': fields.many2one(
54             'ir.model', 'Model', required=True, select=1),
55         'field_ids': fields.many2many(
56             'ir.model.fields', 'mass_field_rel', 'mass_id', 'field_id',
57             'Fields'),
58         'ref_ir_act_window': fields.many2one(
59             'ir.actions.act_window', 'Sidebar Action', readonly=True,
60             help="Sidebar action to make this template available on records \
61                  of the related document model"),
62         'ref_ir_value': fields.many2one(
63             'ir.values', 'Sidebar Button', readonly=True,
64             help="Sidebar button to open the sidebar action"),
65         'model_ids': fields.many2many('ir.model', string='Model List')
66     }
67 
68     _sql_constraints = [
69         ('name_uniq', 'unique (name)', _('Name must be unique!')),
70     ]
71 
72     def onchange_model(self, cr, uid, ids, model_id, context=None):
73         if context is None:
74             context = {}
75         if not model_id:
76             return {'value': {'model_ids': [(6, 0, [])]}}
77         model_ids = [model_id]
78         model_obj = self.pool.get('ir.model')
79         active_model_obj = self.pool.get(model_obj.browse(
80             cr, uid, model_id).model)
81         if active_model_obj._inherits:
82             for key, val in active_model_obj._inherits.items():
83                 found_model_ids = model_obj.search(
84                     cr, uid, [('model', '=', key)], context=context)
85                 model_ids += found_model_ids
86         return {'value': {'model_ids': [(6, 0, model_ids)]}}
87 
88     def create_action(self, cr, uid, ids, context=None):
89         vals = {}
90         action_obj = self.pool.get('ir.actions.act_window')
91         ir_values_obj = self.pool.get('ir.values')
92         for data in self.browse(cr, uid, ids, context=context):
93             src_obj = data.model_id.model
94             button_name = _('Mass Editing (%s)') % data.name
95             vals['ref_ir_act_window'] = action_obj.create(cr, uid, {
96                 'name': button_name,
97                 'type': 'ir.actions.act_window',
98                 'res_model': 'mass.editing.wizard',
99                 'src_model': src_obj,
100                 'view_type': 'form',
101                 'context': "{'mass_editing_object' : %d}" % (data.id),
102                 'view_mode': 'form,tree',
103                 'target': 'new',
104                 'auto_refresh': 1,
105                 }, context)
106             vals['ref_ir_value'] = ir_values_obj.create(cr, uid, {
107                 'name': button_name,
108                 'model': src_obj,
109                 'key2': 'client_action_multi',
110                 'value': (
111                     "ir.actions.act_window,"
112                     + str(vals['ref_ir_act_window'])),
113                 'object': True,
114                 }, context)
115         self.write(cr, uid, ids, {
116             'ref_ir_act_window': vals.get('ref_ir_act_window', False),
117             'ref_ir_value': vals.get('ref_ir_value', False),
118             }, context)
119         return True
120 
121     def unlink_action(self, cr, uid, ids, context=None):
122         for template in self.browse(cr, uid, ids, context=context):
123             try:
124                 if template.ref_ir_act_window:
125                     self.pool.get('ir.actions.act_window').unlink(
126                         cr, uid, template.ref_ir_act_window.id, context)
127                 if template.ref_ir_value:
128                     ir_values_obj = self.pool.get('ir.values')
129                     ir_values_obj.unlink(
130                         cr, uid, template.ref_ir_value.id, context)
131             except:
132                 raise osv.except_osv(
133                     _("Warning"),
134                     _("Deletion of the action record failed."))
135         return True
136 
137     def unlink(self, cr, uid, ids, context=None):
138         self.unlink_action(cr, uid, ids, context)
139         return super(mass_object, self).unlink(cr, uid, ids, context)
140 
141     def copy(self, cr, uid, record_id, default=None, context=None):
142         if default is None:
143             default = {}
144         default.update({'name': '', 'field_ids': []})
145         return super(mass_object, self).copy(
146             cr, uid, record_id, default, context)
147 
148 mass_object()
149 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
150
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mass_editing/mass_editing.py b/mass_editing/mass_editing.py
--- a/mass_editing/mass_editing.py
+++ b/mass_editing/mass_editing.py
@@ -32,10 +32,11 @@
             count=False):
         model_domain = []
         for domain in args:
-            if domain[0] == 'model_id' and domain[2]\
-                    and type(domain[2]) != list:
-                model_domain += [(
-                    'model_id', 'in', map(int, domain[2][1:-1].split(',')))]
+            if (len(domain) > 2 and domain[0] == 'model_id'
+                    and isinstance(domain[2], basestring)):
+                model_domain += [
+                    ('model_id', 'in', map(int, domain[2][1:-1].split(',')))
+                ]
             else:
                 model_domain.append(domain)
         return super(ir_model_fields, self).search(

{"golden_diff": "diff --git a/mass_editing/mass_editing.py b/mass_editing/mass_editing.py\n--- a/mass_editing/mass_editing.py\n+++ b/mass_editing/mass_editing.py\n@@ -32,10 +32,11 @@\n             count=False):\n         model_domain = []\n         for domain in args:\n-            if domain[0] == 'model_id' and domain[2]\\\n-                    and type(domain[2]) != list:\n-                model_domain += [(\n-                    'model_id', 'in', map(int, domain[2][1:-1].split(',')))]\n+            if (len(domain) > 2 and domain[0] == 'model_id'\n+                    and isinstance(domain[2], basestring)):\n+                model_domain += [\n+                    ('model_id', 'in', map(int, domain[2][1:-1].split(',')))\n+                ]\n             else:\n                 model_domain.append(domain)\n         return super(ir_model_fields, self).search(\n", "issue": "[Bug] mass_editing - Search in ir.model.fields not working\nI setup the mass_editing for res.partner then i go to:\nSettings -> Technical -> Database Structure -> Fields\nand go to the Filter with ('model_id','=',61) where 61 is the id of res.partner in res.model. By typ \"res.partner\" and select \"Partner\" from the suggestion.\n\nThen i get the following error:\nFile \"[..]/mass_editing/mass_editing.py\", line 34, in search\n    model_domain += [('model_id', 'in', map(int, domain[2][1:-1].split(',')))]\nTypeError: 'int' object has no attribute '**getitem**'\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n#    This module uses OpenERP, Open Source Management Solution Framework.\n#    Copyright (C):\n#        2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)\n#\n#    This program is free software: you can redistribute it and/or modify\n#    it under the terms of the GNU General Public License as published by\n#    the Free Software Foundation, either version 3 of the License, or\n#    (at your option) any later version.\n#\n#    This program is distributed in the hope that it will be useful,\n#    but WITHOUT ANY WARRANTY; without even the implied warranty of\n#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n#    GNU General Public License for more details.\n#\n#    You should have received a copy of the GNU General Public License\n#    along with this program.  If not, see <http://www.gnu.org/licenses/>\n#\n##############################################################################\n\nfrom openerp.osv import orm, fields, osv\nfrom openerp.tools.translate import _\n\n\nclass ir_model_fields(orm.Model):\n    _inherit = 'ir.model.fields'\n\n    def search(\n            self, cr, uid, args, offset=0, limit=0, order=None, context=None,\n            count=False):\n        model_domain = []\n        for domain in args:\n            if domain[0] == 'model_id' and domain[2]\\\n                    and type(domain[2]) != list:\n                model_domain += [(\n                    'model_id', 'in', map(int, domain[2][1:-1].split(',')))]\n            else:\n                model_domain.append(domain)\n        return super(ir_model_fields, self).search(\n            cr, uid, model_domain, offset=offset, limit=limit, order=order,\n            context=context, count=count)\n\nir_model_fields()\n\n\nclass mass_object(orm.Model):\n    _name = \"mass.object\"\n\n    _columns = {\n        'name': fields.char(\"Name\", size=64, required=True, select=1),\n        'model_id': fields.many2one(\n            'ir.model', 'Model', required=True, select=1),\n        'field_ids': fields.many2many(\n            'ir.model.fields', 'mass_field_rel', 'mass_id', 'field_id',\n            'Fields'),\n        'ref_ir_act_window': fields.many2one(\n            'ir.actions.act_window', 'Sidebar Action', readonly=True,\n            help=\"Sidebar action to make this template available on records \\\n                 of the related document model\"),\n        'ref_ir_value': fields.many2one(\n            'ir.values', 'Sidebar Button', readonly=True,\n            help=\"Sidebar button to open the sidebar action\"),\n        'model_ids': fields.many2many('ir.model', string='Model List')\n    }\n\n    _sql_constraints = [\n        ('name_uniq', 'unique (name)', _('Name must be unique!')),\n    ]\n\n    def onchange_model(self, cr, uid, ids, model_id, context=None):\n        if context is None:\n            context = {}\n        if not model_id:\n            return {'value': {'model_ids': [(6, 0, [])]}}\n        model_ids = [model_id]\n        model_obj = self.pool.get('ir.model')\n        active_model_obj = self.pool.get(model_obj.browse(\n            cr, uid, model_id).model)\n        if active_model_obj._inherits:\n            for key, val in active_model_obj._inherits.items():\n                found_model_ids = model_obj.search(\n                    cr, uid, [('model', '=', key)], context=context)\n                model_ids += found_model_ids\n        return {'value': {'model_ids': [(6, 0, model_ids)]}}\n\n    def create_action(self, cr, uid, ids, context=None):\n        vals = {}\n        action_obj = self.pool.get('ir.actions.act_window')\n        ir_values_obj = self.pool.get('ir.values')\n        for data in self.browse(cr, uid, ids, context=context):\n            src_obj = data.model_id.model\n            button_name = _('Mass Editing (%s)') % data.name\n            vals['ref_ir_act_window'] = action_obj.create(cr, uid, {\n                'name': button_name,\n                'type': 'ir.actions.act_window',\n                'res_model': 'mass.editing.wizard',\n                'src_model': src_obj,\n                'view_type': 'form',\n                'context': \"{'mass_editing_object' : %d}\" % (data.id),\n                'view_mode': 'form,tree',\n                'target': 'new',\n                'auto_refresh': 1,\n                }, context)\n            vals['ref_ir_value'] = ir_values_obj.create(cr, uid, {\n                'name': button_name,\n                'model': src_obj,\n                'key2': 'client_action_multi',\n                'value': (\n                    \"ir.actions.act_window,\"\n                    + str(vals['ref_ir_act_window'])),\n                'object': True,\n                }, context)\n        self.write(cr, uid, ids, {\n            'ref_ir_act_window': vals.get('ref_ir_act_window', False),\n            'ref_ir_value': vals.get('ref_ir_value', False),\n            }, context)\n        return True\n\n    def unlink_action(self, cr, uid, ids, context=None):\n        for template in self.browse(cr, uid, ids, context=context):\n            try:\n                if template.ref_ir_act_window:\n                    self.pool.get('ir.actions.act_window').unlink(\n                        cr, uid, template.ref_ir_act_window.id, context)\n                if template.ref_ir_value:\n                    ir_values_obj = self.pool.get('ir.values')\n                    ir_values_obj.unlink(\n                        cr, uid, template.ref_ir_value.id, context)\n            except:\n                raise osv.except_osv(\n                    _(\"Warning\"),\n                    _(\"Deletion of the action record failed.\"))\n        return True\n\n    def unlink(self, cr, uid, ids, context=None):\n        self.unlink_action(cr, uid, ids, context)\n        return super(mass_object, self).unlink(cr, uid, ids, context)\n\n    def copy(self, cr, uid, record_id, default=None, context=None):\n        if default is None:\n            default = {}\n        default.update({'name': '', 'field_ids': []})\n        return super(mass_object, self).copy(\n            cr, uid, record_id, default, context)\n\nmass_object()\n# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:\n", "path": "mass_editing/mass_editing.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n#    This module uses OpenERP, Open Source Management Solution Framework.\n#    Copyright (C):\n#        2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)\n#\n#    This program is free software: you can redistribute it and/or modify\n#    it under the terms of the GNU General Public License as published by\n#    the Free Software Foundation, either version 3 of the License, or\n#    (at your option) any later version.\n#\n#    This program is distributed in the hope that it will be useful,\n#    but WITHOUT ANY WARRANTY; without even the implied warranty of\n#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n#    GNU General Public License for more details.\n#\n#    You should have received a copy of the GNU General Public License\n#    along with this program.  If not, see <http://www.gnu.org/licenses/>\n#\n##############################################################################\n\nfrom openerp.osv import orm, fields, osv\nfrom openerp.tools.translate import _\n\n\nclass ir_model_fields(orm.Model):\n    _inherit = 'ir.model.fields'\n\n    def search(\n            self, cr, uid, args, offset=0, limit=0, order=None, context=None,\n            count=False):\n        model_domain = []\n        for domain in args:\n            if (len(domain) > 2 and domain[0] == 'model_id'\n                    and isinstance(domain[2], basestring)):\n                model_domain += [\n                    ('model_id', 'in', map(int, domain[2][1:-1].split(',')))\n                ]\n            else:\n                model_domain.append(domain)\n        return super(ir_model_fields, self).search(\n            cr, uid, model_domain, offset=offset, limit=limit, order=order,\n            context=context, count=count)\n\nir_model_fields()\n\n\nclass mass_object(orm.Model):\n    _name = \"mass.object\"\n\n    _columns = {\n        'name': fields.char(\"Name\", size=64, required=True, select=1),\n        'model_id': fields.many2one(\n            'ir.model', 'Model', required=True, select=1),\n        'field_ids': fields.many2many(\n            'ir.model.fields', 'mass_field_rel', 'mass_id', 'field_id',\n            'Fields'),\n        'ref_ir_act_window': fields.many2one(\n            'ir.actions.act_window', 'Sidebar Action', readonly=True,\n            help=\"Sidebar action to make this template available on records \\\n                 of the related document model\"),\n        'ref_ir_value': fields.many2one(\n            'ir.values', 'Sidebar Button', readonly=True,\n            help=\"Sidebar button to open the sidebar action\"),\n        'model_ids': fields.many2many('ir.model', string='Model List')\n    }\n\n    _sql_constraints = [\n        ('name_uniq', 'unique (name)', _('Name must be unique!')),\n    ]\n\n    def onchange_model(self, cr, uid, ids, model_id, context=None):\n        if context is None:\n            context = {}\n        if not model_id:\n            return {'value': {'model_ids': [(6, 0, [])]}}\n        model_ids = [model_id]\n        model_obj = self.pool.get('ir.model')\n        active_model_obj = self.pool.get(model_obj.browse(\n            cr, uid, model_id).model)\n        if active_model_obj._inherits:\n            for key, val in active_model_obj._inherits.items():\n                found_model_ids = model_obj.search(\n                    cr, uid, [('model', '=', key)], context=context)\n                model_ids += found_model_ids\n        return {'value': {'model_ids': [(6, 0, model_ids)]}}\n\n    def create_action(self, cr, uid, ids, context=None):\n        vals = {}\n        action_obj = self.pool.get('ir.actions.act_window')\n        ir_values_obj = self.pool.get('ir.values')\n        for data in self.browse(cr, uid, ids, context=context):\n            src_obj = data.model_id.model\n            button_name = _('Mass Editing (%s)') % data.name\n            vals['ref_ir_act_window'] = action_obj.create(cr, uid, {\n                'name': button_name,\n                'type': 'ir.actions.act_window',\n                'res_model': 'mass.editing.wizard',\n                'src_model': src_obj,\n                'view_type': 'form',\n                'context': \"{'mass_editing_object' : %d}\" % (data.id),\n                'view_mode': 'form,tree',\n                'target': 'new',\n                'auto_refresh': 1,\n                }, context)\n            vals['ref_ir_value'] = ir_values_obj.create(cr, uid, {\n                'name': button_name,\n                'model': src_obj,\n                'key2': 'client_action_multi',\n                'value': (\n                    \"ir.actions.act_window,\"\n                    + str(vals['ref_ir_act_window'])),\n                'object': True,\n                }, context)\n        self.write(cr, uid, ids, {\n            'ref_ir_act_window': vals.get('ref_ir_act_window', False),\n            'ref_ir_value': vals.get('ref_ir_value', False),\n            }, context)\n        return True\n\n    def unlink_action(self, cr, uid, ids, context=None):\n        for template in self.browse(cr, uid, ids, context=context):\n            try:\n                if template.ref_ir_act_window:\n                    self.pool.get('ir.actions.act_window').unlink(\n                        cr, uid, template.ref_ir_act_window.id, context)\n                if template.ref_ir_value:\n                    ir_values_obj = self.pool.get('ir.values')\n                    ir_values_obj.unlink(\n                        cr, uid, template.ref_ir_value.id, context)\n            except:\n                raise osv.except_osv(\n                    _(\"Warning\"),\n                    _(\"Deletion of the action record failed.\"))\n        return True\n\n    def unlink(self, cr, uid, ids, context=None):\n        self.unlink_action(cr, uid, ids, context)\n        return super(mass_object, self).unlink(cr, uid, ids, context)\n\n    def copy(self, cr, uid, record_id, default=None, context=None):\n        if default is None:\n            default = {}\n        default.update({'name': '', 'field_ids': []})\n        return super(mass_object, self).copy(\n            cr, uid, record_id, default, context)\n\nmass_object()\n# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:\n", "path": "mass_editing/mass_editing.py"}]}