From dfb4a39b6b67bc6ff7adc7c538b76eeb8019fa50 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Wed, 24 Dec 2008 19:21:31 +0530 Subject: [PATCH] base module quality bzr revid: mra@tinyerp.com-20081224135131-7keeqeyqf168g5e1 --- addons/base_module_quality/__terp__.py | 2 +- .../base_module_quality.py | 26 ++++++++++++++++--- .../base_module_quality_wizard.xml | 2 +- .../method_test/method_test.py | 11 ++------ .../security/ir.model.access.csv | 2 ++ .../speed_test/speed_test.py | 17 +++--------- 6 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 addons/base_module_quality/security/ir.model.access.csv diff --git a/addons/base_module_quality/__terp__.py b/addons/base_module_quality/__terp__.py index 4a4d5b9fc60..5588ab05780 100644 --- a/addons/base_module_quality/__terp__.py +++ b/addons/base_module_quality/__terp__.py @@ -34,7 +34,7 @@ This module's aim is to check the quality of other modules. """, "init_xml" : [], - "update_xml" : ["base_module_quality_wizard.xml"], + "update_xml" : ["base_module_quality_wizard.xml", "security/ir.model.access.csv",], "category" : "Tiny Specific Modules/Base module quality", "active": False, "installable": True diff --git a/addons/base_module_quality/base_module_quality.py b/addons/base_module_quality/base_module_quality.py index 195e345e8ef..ef4a0c3c515 100644 --- a/addons/base_module_quality/base_module_quality.py +++ b/addons/base_module_quality/base_module_quality.py @@ -19,7 +19,7 @@ # along with this program. If not, see . # ############################################################################## - +import pooler class abstract_quality_check(object): ''' @@ -41,11 +41,11 @@ class abstract_quality_check(object): #This bool defines if the test can be run only if the module is installed. #True => the module have to be installed. #False => the module can be uninstalled. - bool_installed_only = True + bool_installed_only = True def __init__(self): ''' - this method should initialize the var + this method should initialize the var ''' raise 'Not Implemented' @@ -55,7 +55,27 @@ class abstract_quality_check(object): ''' raise 'Not Implemented' + def get_objects(self, cr, uid, module): + # This function returns all object of the given module.. + pool = pooler.get_pool(cr.dbname) + ids2 = pool.get('ir.model.data').search(cr, uid, [('module','=', module), ('model','=','ir.model')]) + model_list = [] + model_data = pool.get('ir.model.data').browse(cr, uid, ids2) + for model in model_data: + model_list.append(model.res_id) + obj_list = [] + for mod in pool.get('ir.model').browse(cr, uid, model_list): + obj_list.append(str(mod.model)) + return obj_list + def get_ids(self, cr, uid, object_list): + #This method return dictionary with ids of records of object for module + pool = pooler.get_pool(cr.dbname) + result_ids = {} + for obj in object_list: + ids = pool.get(obj).search(cr, uid, []) + result_ids[obj] = ids + return result_ids # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_module_quality/base_module_quality_wizard.xml b/addons/base_module_quality/base_module_quality_wizard.xml index c99b949be35..b49c17667a7 100644 --- a/addons/base_module_quality/base_module_quality_wizard.xml +++ b/addons/base_module_quality/base_module_quality_wizard.xml @@ -16,7 +16,7 @@