Browse Source

Merge pull request #29 from saif-serpentcs/11.0

[IMP] Improved the Test case for the search method
Serpent Consulting Services Pvt. Ltd 7 years ago
parent
commit
f9b07605e3

+ 0 - 1
mass_editing/__init__.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 

+ 0 - 1
mass_editing/__manifest__.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 {

+ 2 - 4
mass_editing/hooks.py

@@ -1,9 +1,7 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 
 
 def uninstall_hook(cr, registry):
-    cr.execute("DELETE FROM ir_act_window WHERE res_model = \
-    'mass.editing.wizard'")
-    return True
+    cr.execute("""DELETE FROM ir_act_window WHERE
+    res_model = 'mass.editing.wizard'""")

+ 0 - 1
mass_editing/models/__init__.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 

+ 7 - 6
mass_editing/models/ir_model_fields.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 
@@ -16,12 +15,14 @@ class IrModelFields(models.Model):
         else:
             for domain in args:
                 if (len(domain) > 2 and domain[0] == 'model_id' and
-                        isinstance(domain[2], basestring) and
+                        isinstance(domain[2], str) and
                         list(domain[2][1:-1])):
-                    model_domain += [('model_id', 'in',
-                                      map(int, domain[2][1:-1].split(',')))]
+                    model_ids = list(map(int, domain[2][1:-1].split(',')))
+                    model_domain += [('model_id', 'in', model_ids)]
                 else:
                     model_domain.append(domain)
-        return super(IrModelFields, self).search(model_domain, offset=offset,
-                                                 limit=limit, order=order,
+        return super(IrModelFields, self).search(args=model_domain,
+                                                 offset=offset,
+                                                 limit=limit,
+                                                 order=order,
                                                  count=count)

+ 0 - 1
mass_editing/models/mass_object.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 

+ 2 - 3
mass_editing/static/src/js/mass_editing.js

@@ -6,8 +6,7 @@ odoo.define('mass_editing.mass_editing', function (require) {
     BasicModel.include({
         /**
          * parse the server values to javascript framwork
-         *
-         * @param {[string]} fieldNames
+         * @param {String} fieldNames
          * @param {Object} element the dataPoint used as parent for the created
          *   dataPoints
          * @param {Object} data the server data to parse
@@ -46,4 +45,4 @@ odoo.define('mass_editing.mass_editing', function (require) {
         },
     });
 
-});
+});

+ 0 - 1
mass_editing/tests/__init__.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 

+ 10 - 1
mass_editing/tests/test_mass_editing.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 
@@ -21,11 +20,21 @@ class TestMassEditing(common.TransactionCase):
         self.partner_model = model_obj.\
             search([('model', '=', 'res.partner')])
         self.user_model = model_obj.search([('model', '=', 'res.users')])
+        # Calling the Search method without context for
+        # the Search from the List view of the Fields.
         self.fields_model = self.env['ir.model.fields'].\
             search([('model_id', '=', self.partner_model.id),
                     ('name', 'in', ['email', 'phone', 'category_id', 'comment',
                                     'country_id', 'customer', 'child_ids',
                                     'title'])])
+        # Calling the Search method with context for the Search
+        # model_id field related fields in the fields_ids.
+        self.fields_model = self.env['ir.model.fields'].\
+            with_context({'mass_edit': True}).\
+            search([('model_id', '=', self.partner_model.id),
+                    ('name', 'in', ['email', 'phone', 'category_id', 'comment',
+                                    'country_id', 'customer', 'child_ids',
+                                    'title'])])
         self.mass = self._create_mass_editing(self.partner_model,
                                               self.fields_model)
         self.copy_mass = self.mass.copy()

+ 0 - 1
mass_editing/wizard/__init__.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 

+ 0 - 1
mass_editing/wizard/mass_editing_wizard.py

@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).