浏览代码

[FIX] made the search method of ir.model.fields v8 compatible closes #6

Serpent Consulting Services Pvt. Ltd 10 年之前
父节点
当前提交
55995277a5
共有 3 个文件被更改,包括 18 次插入2 次删除
  1. 4 0
      mass_editing/ChangeLog.txt
  2. 1 1
      mass_editing/__openerp__.py
  3. 13 1
      mass_editing/mass_editing.py

+ 4 - 0
mass_editing/ChangeLog.txt

@@ -1,6 +1,10 @@
 ===============================================================================
  Version Change Log (mass_editing)
 ===============================================================================
+1.5 * Apr 27, 2015 : Serpent Consulting Services Pvt Ltd
+	* Made the search() of ir.model.fields v8 compatible. Thanks to Jonathan Wilson of WillowIT 
+	  for the fix and Luke branch for reporting.
+ 
 1.4	* Dec 27, 2014 : Serpent Consulting Services
 	* Corrected the icon.jpg location and made as per v8 standard.
 

+ 1 - 1
mass_editing/__openerp__.py

@@ -20,7 +20,7 @@
 ##############################################################################
 {
     "name" : "Mass Editing",
-    "version" : "1.4",
+    "version" : "1.5",
     "author" : "Serpent Consulting Services Pvt. Ltd.",
     "category" : "Tools",
     "website" : "http://www.serpentcs.com",

+ 13 - 1
mass_editing/mass_editing.py

@@ -25,7 +25,7 @@ from lxml import etree
 class ir_model_fields(models.Model):
     _inherit = 'ir.model.fields'
 
-    @api.v7
+    @api.returns('self') #If we keep @api.v7, we have to add @api.v8 code too.
     def search(self, cr, uid, args, offset=0, limit=0, order=None, context=None, count=False):
         model_domain = []
         for domain in args:
@@ -35,6 +35,18 @@ class ir_model_fields(models.Model):
                 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)
 
+    
+#     @api.v8
+#     def search(self, args, offset=0, limit=0, order=None, 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(',')))]
+#             else:
+#                 model_domain.append(domain)
+#         return super(ir_model_fields, self).search(model_domain, offset=offset, limit=limit, order=order, count=count)
+
+
 ir_model_fields()
 
 class mass_object(models.Model):