From 9025372c57bc12d9a10e03264289e050c0d987a5 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 31 Dec 2008 10:19:11 +0530 Subject: [PATCH 1/7] [correction]Added __terp__.py test on base_module_quality bzr revid: jvo@tinyerp.com-20081231044911-cepcng981kbikgu8 --- .../base_module_quality/terp_test/__init__.py | 24 ++++ .../terp_test/terp_test.py | 110 ++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 addons/base_module_quality/terp_test/__init__.py create mode 100644 addons/base_module_quality/terp_test/terp_test.py diff --git a/addons/base_module_quality/terp_test/__init__.py b/addons/base_module_quality/terp_test/__init__.py new file mode 100644 index 00000000000..79850888f41 --- /dev/null +++ b/addons/base_module_quality/terp_test/__init__.py @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). 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 . +# +############################################################################## + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_module_quality/terp_test/terp_test.py b/addons/base_module_quality/terp_test/terp_test.py new file mode 100644 index 00000000000..e3cb58d7a6b --- /dev/null +++ b/addons/base_module_quality/terp_test/terp_test.py @@ -0,0 +1,110 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). 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 . +# +############################################################################## + +import os +import tools + +from base_module_quality import base_module_quality +import pooler +import re + +class quality_test(base_module_quality.abstract_quality_check): + + def __init__(self): + ''' + This test checks the quality of __terp__.py file in the selected module. + ''' + super(quality_test, self).__init__() + self.bool_installed_only = True + return None + + def run_test(self, cr, uid, module_path, module_state): + no_terp = False + list_files = os.listdir(module_path) + for i in list_files: + path = os.path.join(module_path, i) + if os.path.isdir(path): + for j in os.listdir(path): + list_files.append(os.path.join(i, j)) + + n = 0 + score = 0.0 + feel_good_factor = 0 + feel_bad_factor = 0 + detail = "\n===TERP Test===\n" + summary = "\n===TERP Test===:\n" + error = False + + if '__terp__.py' not in list_files: + no_terp = True + + if no_terp: + summary += """ +The module does not contain the __terp__.py file.\n\n """ + header_list = "" + error = True + self.result = self.format_table(test='terp', data_list=[summary, detail, error]) + return None + + terp_file = os.path.join(module_path,'__terp__.py') + res = eval(tools.file_open(terp_file).read()) + + terp_keys = ['category', 'name', 'description', 'author', 'website', 'update_xml', 'init_xml', 'depends', 'version', 'active', 'installable', 'demo_xml'] + + for key in terp_keys: + if key in res: + feel_good_factor += 1 + if isinstance(res[key],(str,unicode)): + if not res[key]: + feel_bad_factor += 1 + else: + if key == 'description' and res[key] and len(str(res[key]))>=25: + feel_good_factor += 1 + if res['description'].count('\n') >= 4:# description contains minimum 5 lines + feel_good_factor += 1 + if key == 'website': + ptrn = re.compile('https?://[\w\.]*') # reg ex matching on temporary basis. + result = ptrn.search(str(res[key])) + if result: + feel_good_factor += 1 + else: + feel_bad_factor += 1 + + self.score = str(round((feel_good_factor * 10) / float(feel_good_factor + feel_bad_factor),2)) +# if not self.bool_installed_only or module_state=="installed": + summary += """ +This test checks if the module satisfies the current coding standard for __terp__.py file used by OpenERP. + +""" + "Score: " + str(self.score) + "/10\n" + +# else: +# summary += """ +#The module has to be installed before running this test.\n\n """ +# header_list = "" +# error = True + + detail += "__terp__.py : "+ str(self.score) + "/10\n" + self.result = self.format_table(test='terp', data_list=[summary, detail, error]) + return None + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From 10243911daeb29ee4592969fa74461149b153ebe Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 31 Dec 2008 11:58:33 +0530 Subject: [PATCH 2/7] [fix]Overdue report on non-addressial partners bzr revid: jvo@tinyerp.com-20081231062833-12ksxl8snkmd0psk --- addons/account/report/overdue.py | 16 +++++++++++++++- addons/account/report/overdue.rml | 12 +++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/addons/account/report/overdue.py b/addons/account/report/overdue.py index 736a4a78138..633fcd6a0a0 100644 --- a/addons/account/report/overdue.py +++ b/addons/account/report/overdue.py @@ -38,11 +38,25 @@ class Overdue(report_sxw.rml_parse): }) def _adr_get(self, partner, type): + res = [] res_partner = pooler.get_pool(self.cr.dbname).get('res.partner') res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address') addresses = res_partner.address_get(self.cr, self.uid, [partner.id], [type]) adr_id = addresses and addresses[type] or False - return adr_id and res_partner_address.read(self.cr, self.uid, [adr_id])[0] or False + result = { + 'name': False, + 'street': False, + 'city' : False, + 'zip' : False, + 'country_id' : False, + } + if adr_id: + result = res_partner_address.read(self.cr, self.uid, [adr_id]) + result[0]['country_id'] = result[0]['country_id'] and result[0]['country_id'][1] or False + return result + + res.append(result) + return res def _tel_get(self,partner): if not partner: diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml index aa0d111b28f..70f5fd09b25 100644 --- a/addons/account/report/overdue.rml +++ b/addons/account/report/overdue.rml @@ -90,16 +90,14 @@ - - - + [[ repeatIn(adr_get(o, 'invoice'),'addr') ]] [[ o.name ]] - [[ adr_get(o, 'invoice')['name'] ]] - [[ adr_get(o, 'invoice')['street'] ]] - [[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]] - [[ adr_get(o, 'invoice')['country_id'] and adr_get(o, 'invoice')['country_id'][1] ]] + [[ addr['name'] ]] + [[ addr['street'] ]] + [[ addr['zip'] ]] [[ addr['city'] ]] + [[ addr['country_id'] ]] From 26e5c8e26b3c28bc8a40d65d1eff33dab945dda1 Mon Sep 17 00:00:00 2001 From: "hda (Tiny)" Date: Wed, 31 Dec 2008 15:14:49 +0530 Subject: [PATCH 3/7] bugfix bzr revid: hda@tinyerp.com-20081231094449-t31awtrkdc7vj1f8 --- addons/account/account.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index f218e5b5bd7..c969496beae 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2070,10 +2070,12 @@ class wizard_multi_charts_accounts(osv.osv_memory): #create the account_account for this bank journal tmp = self.pool.get('res.partner.bank').name_get(cr, uid, [line.acc_no.id])[0][1] dig = obj_multi.code_digits + print ">>>>",dig + print ">>>",ref_acc_bank.code.ljust(dig,'0') vals={ 'name': line.acc_no.bank and line.acc_no.bank.name+' '+tmp or tmp, 'currency_id': line.currency_id and line.currency_id.id or False, - 'code': str(int(ref_acc_bank.code.ljust(dig,'0')) + current_num), + 'code': str(ref_acc_bank.code.ljust(dig,'0') + str(current_num)), 'type': 'other', 'user_type': account_template.user_type and account_template.user_type.id or False, 'reconcile': True, From 399fb0549d3cd094166f055ca8d0e27a88c0e060 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Wed, 31 Dec 2008 15:24:58 +0530 Subject: [PATCH 4/7] hr_holidays: improvements, bug fix bzr revid: mra@tinyerp.com-20081231095458-t82mtptmwna19p9p --- addons/hr_holidays/hr.py | 71 ++++++++++++++++++++++++++++--- addons/hr_holidays/hr_view.xml | 77 +++++++++++++++++++++++++--------- 2 files changed, 122 insertions(+), 26 deletions(-) diff --git a/addons/hr_holidays/hr.py b/addons/hr_holidays/hr.py index 0ec16766445..4e19e15f2ee 100644 --- a/addons/hr_holidays/hr.py +++ b/addons/hr_holidays/hr.py @@ -87,6 +87,31 @@ class hr_holidays(osv.osv): } _order = 'date_from desc' + def create(self, cr, uid, vals, *args, **kwargs): + id_holiday = super(hr_holidays, self).create(cr, uid, vals, *args, **kwargs) + self._create_log(cr, uid, [id_holiday]) + return id_holiday + + def _create_log(self, cr, uid, ids): + holidays_user_obj = self.pool.get('hr.holidays.per.user') + list_request = [] + holidays_data = self.browse(cr, uid, ids[0]) + datas = { + 'employee_id' : holidays_data.employee_id.id, + 'name' : holidays_data.state, + 'holiday_status' : holidays_data.holiday_status.id, + 'holiday_req_id' : holidays_data.id, + 'nb_holidays' : holidays_data.number_of_days + } + ids_log = self.pool.get('hr.holidays.log').create(cr, uid, datas) + ids_user_hdays = holidays_user_obj.search(cr, uid, [('employee_id', '=', holidays_data.employee_id.id),('holiday_status', '=', holidays_data.holiday_status.id)]) + for hdays in holidays_user_obj.browse(cr, uid, ids_user_hdays): + for req in hdays.history: + list_request.append(req.id) + list_request.append(ids_log) + holidays_user_obj.write(cr, uid, ids_user_hdays, {'history' : [(6,0,list_request)]}) + return True + def onchange_date_to(self, cr, uid, ids, date_from, date_to): result = {} if date_from: @@ -108,19 +133,19 @@ class hr_holidays(osv.osv): 'state':'draft', 'manager_id': False }) + self._create_log(cr, uid, ids) return True def holidays_validate(self, cr, uid, ids, *args): self.check_holidays(cr,uid,ids) - vals = { 'state':'validate', } ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) if ids2: vals['manager_id'] = ids2[0] - self.write(cr, uid, ids, vals) + self._create_log(cr, uid, ids) return True def holidays_confirm(self, cr, uid, ids, *args): @@ -132,6 +157,7 @@ class hr_holidays(osv.osv): 'state':'confirm', 'user_id': user, }) + self._create_log(cr, uid, ids) return True def holidays_refuse(self, cr, uid, ids, *args): @@ -140,6 +166,7 @@ class hr_holidays(osv.osv): 'state':'refuse', 'manager_id':ids2[0] }) + self._create_log(cr, uid, ids) return True def holidays_cancel(self, cr, uid, ids, *args): @@ -150,17 +177,22 @@ class hr_holidays(osv.osv): obj_holidays_per_user=self.pool.get('hr.holidays.per.user').browse(cr, uid,holiday_id[0]) self.pool.get('hr.holidays.per.user').write(cr,uid,obj_holidays_per_user.id,{'leaves_taken':obj_holidays_per_user.leaves_taken - record.number_of_days}) if record.case_id: - self.pool.get('crm.case').unlink(cr,uid,record.case_id.id) + if record.case_id.state <> 'draft': + raise osv.except_osv(_('Warning !'), + _('You can not cancel this holiday request. first You have to make its case in draft state.')) + else: + self.pool.get('crm.case').unlink(cr,uid,[record.case_id.id]) self.write(cr, uid, ids, { 'state':'cancel' }) - + self._create_log(cr, uid, ids) return True def holidays_draft(self, cr, uid, ids, *args): self.write(cr, uid, ids, { 'state':'draft' }) + self._create_log(cr, uid, ids) return True def check_holidays(self,cr,uid,ids): @@ -212,9 +244,17 @@ class hr_holidays_per_user(osv.osv): _description = "Holidays Per User" def _get_remaining_leaves(self, cr, uid, ids, field_name, arg=None, context={}): + obj_holiday = self.pool.get('hr.holidays') + days = 0.0 result = {} - for r in self.read(cr, uid, ids, ['max_leaves','leaves_taken']): - result[r['id']] = r['max_leaves'] - r['leaves_taken'] + for holiday_user in self.browse(cr, uid, ids): + ids_request = obj_holiday.search(cr, uid, [('employee_id', '=', holiday_user.employee_id.id),('state', '=', 'validate'),('holiday_status', '=', holiday_user.holiday_status.id)]) + if ids_request: + holidays = obj_holiday.browse(cr, uid, ids_request) + for holiday in holidays: + days += holiday.number_of_days + days = holiday_user.max_leaves - days + result[holiday_user.id] = days return result _columns = { @@ -226,6 +266,7 @@ class hr_holidays_per_user(osv.osv): 'active' : fields.boolean('Active'), 'notes' : fields.text('Notes'), 'remaining_leaves': fields.function(_get_remaining_leaves, method=True, string='Remaining Leaves', type='float'), + 'history' : fields.one2many('hr.holidays.log', 'holiday_user_id', 'History') } _defaults = { 'active' : lambda *a: True, @@ -239,5 +280,23 @@ class hr_holidays_per_user(osv.osv): hr_holidays_per_user() +class holiday_user_log(osv.osv): + _name = 'hr.holidays.log' + _description = 'hr.holidays.log' + _order = "holiday_req_id desc" + _columns = { + 'name' : fields.char('Action', size=64, readonly=True), + 'holiday_req_id' : fields.char('Holiday Request ID', size=64), + 'nb_holidays' : fields.float('Number of Holidays Requested'), + 'employee_id' : fields.many2one('hr.employee', 'Employee', readonly=True), + 'holiday_status' : fields.many2one("hr.holidays.status", "Holiday's Status", readonly=True), + 'holiday_user_id' : fields.many2one('hr.holidays.per.user', 'Holidays user'), + 'date': fields.datetime('Date'), + } + _defaults = { + 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), + } +holiday_user_log() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_holidays/hr_view.xml b/addons/hr_holidays/hr_view.xml index dcf73f3e9f9..cc940075097 100644 --- a/addons/hr_holidays/hr_view.xml +++ b/addons/hr_holidays/hr_view.xml @@ -8,7 +8,7 @@ hr.holidays form -
+ @@ -17,8 +17,8 @@ - + @@ -36,10 +36,10 @@ hr.holidays.tree - hr.holidays + hr.holidays tree - + @@ -51,10 +51,40 @@ + + + hr.holidays.log.form + hr.holidays.log + form + + + + + + + + + + >hr.holidays.log.tree + hr.holidays.log + tree + + + + + + + + + + + + + hr.holidays.status.form - hr.holidays.status + hr.holidays.status form
@@ -68,15 +98,15 @@ hr.holidays.status.tree - hr.holidays.status + hr.holidays.status tree - - + + @@ -98,17 +128,24 @@ hr.holidays.per.user form - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
@@ -122,7 +159,7 @@ - + From 4d98bb97bc773396c958ccb7266aac4cb120a998 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Wed, 31 Dec 2008 15:43:44 +0530 Subject: [PATCH 5/7] bug fix quality module bzr revid: mra@tinyerp.com-20081231101344-8948b16cxraej9nb --- .../terp_test/terp_test.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/base_module_quality/terp_test/terp_test.py b/addons/base_module_quality/terp_test/terp_test.py index e3cb58d7a6b..474513869f8 100644 --- a/addons/base_module_quality/terp_test/terp_test.py +++ b/addons/base_module_quality/terp_test/terp_test.py @@ -53,30 +53,30 @@ class quality_test(base_module_quality.abstract_quality_check): detail = "\n===TERP Test===\n" summary = "\n===TERP Test===:\n" error = False - + if '__terp__.py' not in list_files: no_terp = True - + if no_terp: - summary += """ + summary += """ The module does not contain the __terp__.py file.\n\n """ header_list = "" error = True self.result = self.format_table(test='terp', data_list=[summary, detail, error]) return None - + terp_file = os.path.join(module_path,'__terp__.py') res = eval(tools.file_open(terp_file).read()) terp_keys = ['category', 'name', 'description', 'author', 'website', 'update_xml', 'init_xml', 'depends', 'version', 'active', 'installable', 'demo_xml'] - + for key in terp_keys: if key in res: feel_good_factor += 1 if isinstance(res[key],(str,unicode)): if not res[key]: feel_bad_factor += 1 - else: + else: if key == 'description' and res[key] and len(str(res[key]))>=25: feel_good_factor += 1 if res['description'].count('\n') >= 4:# description contains minimum 5 lines @@ -87,22 +87,22 @@ The module does not contain the __terp__.py file.\n\n """ if result: feel_good_factor += 1 else: - feel_bad_factor += 1 - - self.score = str(round((feel_good_factor * 10) / float(feel_good_factor + feel_bad_factor),2)) + feel_bad_factor += 1 + + self.score = round((feel_good_factor * 10) / float(feel_good_factor + feel_bad_factor),2) # if not self.bool_installed_only or module_state=="installed": summary += """ This test checks if the module satisfies the current coding standard for __terp__.py file used by OpenERP. """ + "Score: " + str(self.score) + "/10\n" - + # else: -# summary += """ +# summary += """ #The module has to be installed before running this test.\n\n """ # header_list = "" # error = True - - detail += "__terp__.py : "+ str(self.score) + "/10\n" + + detail += "__terp__.py : "+ str(self.score) + "/10\n" self.result = self.format_table(test='terp', data_list=[summary, detail, error]) return None From c17b39b50c6a1ebdf6fe28767ee450e308ef6350 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 31 Dec 2008 11:51:30 +0100 Subject: [PATCH 6/7] =?UTF-8?q?[FIX]=20invoice=20on=20delivery=20including?= =?UTF-8?q?=20service=20+=20taxes=20crashes:=20"ProgrammingError:=20can't?= =?UTF-8?q?=20adapt"=20patch=20from=20Rapha=C3=ABl=20Valyi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lp bug: https://launchpad.net/bugs/312673 fixed bzr revid: christophe@cobalt-20081231105130-9zedy1uvcty0lb6w --- addons/sale/stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 0c6ec645150..9669366add3 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -158,6 +158,7 @@ class stock_picking(osv.osv): price_unit = sale_line.price_unit discount = sale_line.discount tax_ids = sale_line.tax_id + tax_ids = map(lambda x: x.id, tax_ids) account_analytic_id = self._get_account_analytic_invoice(cursor, user, picking, sale_line) From c9a001510cf57f3d6802337b949549acaa63398f Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Wed, 31 Dec 2008 16:35:45 +0530 Subject: [PATCH 7/7] quality module bzr revid: mra@tinyerp.com-20081231110545-5ph5aa0yndxwjttx --- addons/base_module_quality/base_module_quality.py | 5 ++++- addons/base_module_quality/method_test/method_test.py | 5 ++--- addons/base_module_quality/pylint_test/pylint_test.py | 5 ++--- addons/base_module_quality/speed_test/speed_test.py | 5 ++--- addons/base_module_quality/terp_test/terp_test.py | 10 ++++------ .../base_module_quality/wizard/module_quality_check.py | 3 ++- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/addons/base_module_quality/base_module_quality.py b/addons/base_module_quality/base_module_quality.py index 30b40de1a87..d6dd19d3524 100644 --- a/addons/base_module_quality/base_module_quality.py +++ b/addons/base_module_quality/base_module_quality.py @@ -70,6 +70,9 @@ class abstract_quality_check(object): #This variable is use to make result of test should have more weight (Some tests are more critical than others) self.ponderation = 0.0 + #Specify test got an error on module + self.error = False + self.tests = [] self.list_folders = os.listdir(config['addons_path']+'/base_module_quality/') for item in self.list_folders: @@ -138,7 +141,7 @@ class abstract_quality_check(object): res_format['summary'] = data_list[0] elif test=='terp': res_format['summary'] = data_list[0] - res_format['detail'] = data_list[1] + res_format['detail'] = data_list[1] return res_format def add_quatation(self, x, y): diff --git a/addons/base_module_quality/method_test/method_test.py b/addons/base_module_quality/method_test/method_test.py index 3d7f2650fad..57ca26c3295 100644 --- a/addons/base_module_quality/method_test/method_test.py +++ b/addons/base_module_quality/method_test/method_test.py @@ -48,7 +48,6 @@ class quality_test(base_module_quality.abstract_quality_check): result = {} ok_count = 0 ex_count = 0 - error = False for obj in obj_list: temp = [] try: @@ -91,8 +90,8 @@ This test checks if the module classes are raising exception when calling basic The module has to be installed before running this test.\n\n """ header_list = "" - error = True - self.result = self.format_table(test='method', header=header_list, data_list=[summary,result,error]) + self.error = True + self.result = self.format_table(test='method', header=header_list, data_list=[summary,result,self.error]) return None diff --git a/addons/base_module_quality/pylint_test/pylint_test.py b/addons/base_module_quality/pylint_test/pylint_test.py index c25b884d8e9..a99c7256e3d 100644 --- a/addons/base_module_quality/pylint_test/pylint_test.py +++ b/addons/base_module_quality/pylint_test/pylint_test.py @@ -54,7 +54,6 @@ class quality_test(base_module_quality.abstract_quality_check): score = 0.0 detail = "" detail = "\n===Pylint Test===\n" - error = False for file in list_files: if file.split('.')[-1] == 'py' and not file.endswith('__init__.py') and not file.endswith('__terp__.py'): file_path = os.path.join(module_path, file) @@ -89,8 +88,8 @@ This test checks if the module satisfies the current coding standard used by Ope The module has to be installed before running this test.\n\n """ header_list = "" - error = True - self.result = self.format_table(test='pylint', data_list=[summary,detail,error]) + self.error = True + self.result = self.format_table(test='pylint', data_list=[summary,detail,self.error]) return None diff --git a/addons/base_module_quality/speed_test/speed_test.py b/addons/base_module_quality/speed_test/speed_test.py index 7db0d572624..317bb12225b 100644 --- a/addons/base_module_quality/speed_test/speed_test.py +++ b/addons/base_module_quality/speed_test/speed_test.py @@ -55,7 +55,6 @@ class quality_test(base_module_quality.abstract_quality_check): obj_ids = self.get_ids(cr, uid, obj_list) detail = "" list1 = [] - error = False for obj in obj_ids: obj_counter += 1 ids = obj_ids[obj] @@ -110,8 +109,8 @@ This test checks the speed of the module. The module has to be installed before running this test.\n\n """ header_list = "" - error = True - self.result = self.format_table(test='speed', header=header_list, data_list=[summary,list1, error]) + self.error = True + self.result = self.format_table(test='speed', header=header_list, data_list=[summary,list1,self.error]) return None # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_module_quality/terp_test/terp_test.py b/addons/base_module_quality/terp_test/terp_test.py index 474513869f8..202c9705b6d 100644 --- a/addons/base_module_quality/terp_test/terp_test.py +++ b/addons/base_module_quality/terp_test/terp_test.py @@ -52,7 +52,6 @@ class quality_test(base_module_quality.abstract_quality_check): feel_bad_factor = 0 detail = "\n===TERP Test===\n" summary = "\n===TERP Test===:\n" - error = False if '__terp__.py' not in list_files: no_terp = True @@ -61,8 +60,8 @@ class quality_test(base_module_quality.abstract_quality_check): summary += """ The module does not contain the __terp__.py file.\n\n """ header_list = "" - error = True - self.result = self.format_table(test='terp', data_list=[summary, detail, error]) + self.error = True + self.result = self.format_table(test='terp', data_list=[summary, detail, self.error]) return None terp_file = os.path.join(module_path,'__terp__.py') @@ -94,8 +93,7 @@ The module does not contain the __terp__.py file.\n\n """ summary += """ This test checks if the module satisfies the current coding standard for __terp__.py file used by OpenERP. -""" + "Score: " + str(self.score) + "/10\n" - +""" # else: # summary += """ #The module has to be installed before running this test.\n\n """ @@ -103,7 +101,7 @@ This test checks if the module satisfies the current coding standard for __terp_ # error = True detail += "__terp__.py : "+ str(self.score) + "/10\n" - self.result = self.format_table(test='terp', data_list=[summary, detail, error]) + self.result = self.format_table(test='terp', data_list=[summary, detail, self.error]) return None diff --git a/addons/base_module_quality/wizard/module_quality_check.py b/addons/base_module_quality/wizard/module_quality_check.py index 3bf863764ac..af8331ff40e 100644 --- a/addons/base_module_quality/wizard/module_quality_check.py +++ b/addons/base_module_quality/wizard/module_quality_check.py @@ -77,7 +77,8 @@ class wiz_quality_check(osv.osv_memory): val = test.quality_test() val.run_test(cr, uid, str(module_path), str(module_data[0].state)) string_ret += val.result['summary'] #summary tab - string_ret += "Score: " + str(val.score) + "/10\n" #val.score = val.score * val.ponderation ??? + if not val.error: + string_ret += "Score: " + str(val.score) + "/10\n" #val.score = val.score * val.ponderation ??? string_detail += val.result['detail'] # detail tab score_sum += (val.add_quatation(val.score, 10) * val.ponderation) ponderation_sum += val.ponderation