diff options
| author | mra (Open ERP) <mra@tinyerp.com> | 2009-01-16 14:33:55 +0530 |
|---|---|---|
| committer | mra (Open ERP) <mra@tinyerp.com> | 2009-01-16 14:33:55 +0530 |
| commit | 9b1c726b9df5e98c05ba9102904b3a5c5e9b0d9e (patch) | |
| tree | 57b17a9866f421235836c73755d1a87895ebc831 /addons/base_module_quality/wizard | |
| parent | b5800e1e21317740d25c89227e26aadcc2a306a6 (diff) | |
base_module_quality moved from addons to trunk-extra-addons
bzr revid: mra@tinyerp.com-20090116090355-ayit2uufsgdycjib
Diffstat (limited to 'addons/base_module_quality/wizard')
| -rw-r--r-- | addons/base_module_quality/wizard/__init__.py | 28 | ||||
| -rw-r--r-- | addons/base_module_quality/wizard/module_quality_check.py | 133 | ||||
| -rw-r--r-- | addons/base_module_quality/wizard/quality_save_report.py | 56 |
3 files changed, 0 insertions, 217 deletions
diff --git a/addons/base_module_quality/wizard/__init__.py b/addons/base_module_quality/wizard/__init__.py deleted file mode 100644 index 440ab8c63d9..00000000000 --- a/addons/base_module_quality/wizard/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved -# $Id$ -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import module_quality_check -import quality_save_report - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/base_module_quality/wizard/module_quality_check.py b/addons/base_module_quality/wizard/module_quality_check.py deleted file mode 100644 index f4d0ca78ddc..00000000000 --- a/addons/base_module_quality/wizard/module_quality_check.py +++ /dev/null @@ -1,133 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved -# $Id$ -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## -import wizard -import pooler -from osv import osv, fields - -import tools -import os - -from base_module_quality import base_module_quality - -#TODO: add cheks: do the class quality_check inherits the class abstract_quality_check? - - -class wiz_quality_check(osv.osv): - _name = 'wizard.quality.check' - _columns = { - 'name': fields.char('Rated Module', size=64, ), - 'final_score': fields.char('Final Score (%)', size=10,), - 'test_ids' : fields.one2many('quality.check.detail', 'quality_check_id', 'Tests',) - } -wiz_quality_check() - - -class quality_check_detail(osv.osv): - _name = 'quality.check.detail' - _columns = { - 'quality_check_id': fields.many2one('wizard.quality.check', 'Quality'), - 'name': fields.char('Name',size=128,), - 'score': fields.float('Score (%)',), - 'ponderation': fields.float('Ponderation',help='Some tests are more critical than others, so they have a bigger weight in the computation of final rating'), - 'note': fields.text('Note',), - 'summary': fields.text('Summary',), - 'detail' : fields.text('Details',), - 'state': fields.selection([('done','Done'),('skipped','Skipped'),], 'State', size=6, help='The test will be completed only if the module is installed or if the test may be processed on uninstalled module.'), - } -quality_check_detail() - - -class create_quality_check(wizard.interface): - - def _create_quality_check(self, cr, uid, data, context={}): - pool = pooler.get_pool(cr.dbname) - objs = [] - for id in data['ids']: - module_data = pool.get('ir.module.module').browse(cr, uid, id) - #list_folders = os.listdir(config['addons_path']+'/base_module_quality/') - abstract_obj = base_module_quality.abstract_quality_check() - score_sum = 0.0 - ponderation_sum = 0.0 - create_ids = [] - for test in abstract_obj.tests: - ad = tools.config['addons_path'] - if module_data.name == 'base': - ad = tools.config['root_path']+'/addons' - module_path = os.path.join(ad, module_data.name) - val = test.quality_test() - - if not val.bool_installed_only or module_data.state=="installed": - val.run_test(cr, uid, str(module_path)) - data = { - 'name': val.name, - 'score': val.score * 100, - 'ponderation': val.ponderation, - 'summary': val.result, - 'detail': val.result_details, - 'state': 'done', - 'note': val.note, - } - create_ids.append((0,0,data)) - score_sum += val.score * val.ponderation - ponderation_sum += val.ponderation - else: - data = { - 'name': val.name, - 'note': val.note, - 'score': 0, - 'state': 'skipped', - 'summary': _("The module has to be installed before running this test.") - } - create_ids.append((0,0,data)) - - final_score = str(score_sum / ponderation_sum * 100) + "%" - data = { - 'name': module_data.name, - 'final_score': final_score, - 'test_ids' : create_ids, - } - obj = pool.get('wizard.quality.check').create(cr, uid, data, context) - objs.append(obj) - return objs - - def _open_quality_check(self, cr, uid, data, context): - obj_ids = self._create_quality_check(cr, uid, data, context) - return { - 'domain': "[('id','in', ["+','.join(map(str,obj_ids))+"])]", - 'name': _('Quality Check'), - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'wizard.quality.check', - 'type': 'ir.actions.act_window' - } - - states = { - 'init' : { - 'actions' : [], - 'result': {'type':'action', 'action':_open_quality_check, 'state':'end'} - } - } - -create_quality_check("create_quality_check_wiz") - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/base_module_quality/wizard/quality_save_report.py b/addons/base_module_quality/wizard/quality_save_report.py deleted file mode 100644 index 40b6a00c724..00000000000 --- a/addons/base_module_quality/wizard/quality_save_report.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved -# $Id$ -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import wizard -from osv import osv -import pooler -from tools.translate import _ - -import base64 - -form_rep = '''<?xml version="1.0"?> -<form string="Standard entries"> - <field name="module_file"/> -</form>''' - - -fields_rep = { - 'module_file': {'string': 'Save report', 'type': 'binary', 'required': True}, -} - -def get_detail(self, cr, uid, datas, context={}): - data = pooler.get_pool(cr.dbname).get('quality.check.detail').browse(cr, uid, datas['id']) - data.detail = base64.encodestring(data.detail) - return {'module_file':data.detail} - -class save_report(wizard.interface): - states = { - 'init': { - 'actions': [get_detail], - 'result': {'type': 'form', 'arch':form_rep, 'fields':fields_rep, 'state':[('end','Cancel')]} - }, - } -save_report('quality_detail_save') - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - |
