prompt: 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/models/ir_model_fields.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
  24 
  25 
  26 class IrModelFields(orm.Model):
  27     _inherit = 'ir.model.fields'
  28 
  29     def search(
  30             self, cr, uid, args, offset=0, limit=0, order=None, context=None,
  31             count=False):
  32         model_domain = []
  33         for domain in args:
  34             if domain[0] == 'model_id' and domain[2]\
  35                     and type(domain[2]) != list:
  36                 model_domain += [(
  37                     'model_id', 'in', map(int, domain[2][1:-1].split(',')))]
  38             else:
  39                 model_domain.append(domain)
  40         return super(IrModelFields, self).search(
  41             cr, uid, model_domain, offset=offset, limit=limit, order=order,
  42             context=context, count=count)
  43
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/mass_editing/models/ir_model_fields.py b/mass_editing/models/ir_model_fields.py
  --- a/mass_editing/models/ir_model_fields.py
  +++ b/mass_editing/models/ir_model_fields.py
  @@ -31,12 +31,14 @@
               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(IrModelFields, self).search(
               cr, uid, model_domain, offset=offset, limit=limit, order=order,
  -            context=context, count=count)
  +            context=context, count=count
  +        )
  
verification_info: {"golden_diff": "diff --git a/mass_editing/models/ir_model_fields.py b/mass_editing/models/ir_model_fields.py\n--- a/mass_editing/models/ir_model_fields.py\n+++ b/mass_editing/models/ir_model_fields.py\n@@ -31,12 +31,14 @@\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(IrModelFields, self).search(\n             cr, uid, model_domain, offset=offset, limit=limit, order=order,\n-            context=context, count=count)\n+            context=context, count=count\n+        )\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\n\n\nclass IrModelFields(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(IrModelFields, self).search(\n            cr, uid, model_domain, offset=offset, limit=limit, order=order,\n            context=context, count=count)\n", "path": "mass_editing/models/ir_model_fields.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\n\n\nclass IrModelFields(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(IrModelFields, self).search(\n            cr, uid, model_domain, offset=offset, limit=limit, order=order,\n            context=context, count=count\n        )\n", "path": "mass_editing/models/ir_model_fields.py"}]}