← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~rruebner/server-env-tools/7.0_fix_mass_editing into lp:server-env-tools

 

Robert Rübner has proposed merging lp:~rruebner/server-env-tools/7.0_fix_mass_editing 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/~rruebner/server-env-tools/7.0_fix_mass_editing/+merge/204711

Hi all,

it is possible that the model_id in the for loop is an integer and no string in the overwritten search method in mass_editing.py. We have to ensure that the split call will be done on a string. In addition it is not good to cut the first and the last character of this string, I removed the cutting too.

Without this fix:
e. g. If you edit an email template and select "Search More..." for Field in the Dynamic Value Builder section an error "TypeError: 'int' object has no attribute '_getitem_'" will occur.

Regards
Robert
-- 
https://code.launchpad.net/~rruebner/server-env-tools/7.0_fix_mass_editing/+merge/204711
Your team Server Environment And Tools Core Editors is requested to review the proposed merge of lp:~rruebner/server-env-tools/7.0_fix_mass_editing into lp:server-env-tools.
=== modified file 'mass_editing/mass_editing.py'
--- mass_editing/mass_editing.py	2013-05-08 12:41:12 +0000
+++ mass_editing/mass_editing.py	2014-02-04 15:28:06 +0000
@@ -31,7 +31,10 @@
         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(',')))]
+                # it is possible that the model id is an integer and no string,
+                # so we have to ensure that the split call will be done with a
+                # string and without cutting the first and the last character
+                model_domain += [('model_id', 'in', map(int, str(domain[2]).split(',')))]
             else:
                 model_domain.append(domain)
         return super(ir_model_fields, self).search(cr, uid, model_domain, offset=offset, limit=limit, order=order, context=context, count=count)


Follow ups