@@ -451,8 +451,9 @@ class account_journal(osv.osv):
|
||||
'view_id': fields.many2one('account.journal.view', 'View', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tell Open ERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."),
|
||||
'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account'),
|
||||
'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account'),
|
||||
'centralisation': fields.boolean('Centralised counterpart', help="Check this box if you want that each entry doesn't create a counterpart but share the same counterpart for each entry of this journal."),
|
||||
'centralisation': fields.boolean('Centralised counterpart', help="Check this box if you want that each entry doesn't create a counterpart but share the same counterpart for each entry of this journal. This is used in fiscal year closing."),
|
||||
'update_posted': fields.boolean('Allow Cancelling Entries'),
|
||||
'group_invoice_lines': fields.boolean('Group invoice lines', help="If this box is cheked, the system will try to group the accouting lines when generating them from invoices."),
|
||||
'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="The sequence gives the display order for a list of journals", required=True),
|
||||
'user_id': fields.many2one('res.users', 'User', help="The responsible user of this journal"),
|
||||
'groups_id': fields.many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', 'Groups'),
|
||||
|
||||
@@ -61,6 +61,8 @@ class account_move_line(osv.osv):
|
||||
def create_analytic_lines(self, cr, uid, ids, context={}):
|
||||
for obj_line in self.browse(cr, uid, ids, context):
|
||||
if obj_line.analytic_account_id:
|
||||
if not obj_line.journal_id.analytic_journal_id:
|
||||
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name,))
|
||||
amt = (obj_line.credit or 0.0) - (obj_line.debit or 0.0)
|
||||
vals_lines={
|
||||
'name': obj_line.name,
|
||||
|
||||
@@ -267,6 +267,8 @@
|
||||
<field name="user_id" groups="base.group_extended"/>
|
||||
<newline/>
|
||||
<field name="centralisation"/>
|
||||
<field name="group_invoice_lines"/>
|
||||
|
||||
<field name="update_posted"/>
|
||||
<field name="entry_posted"/>
|
||||
</page>
|
||||
|
||||
@@ -68,7 +68,7 @@ class account_invoice(osv.osv):
|
||||
tt = type2journal.get(type_inv, 'sale')
|
||||
result = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=',tt)], context=context)
|
||||
if not result:
|
||||
raise osv.except_osv(_('No Analytic Journal !'),("You have to define an analytic journal of type '%s' !") % (tt,))
|
||||
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal of type '%s' !") % (tt,))
|
||||
return result[0]
|
||||
|
||||
def _get_type(self, cr, uid, context={}):
|
||||
@@ -448,7 +448,7 @@ class account_invoice(osv.osv):
|
||||
ait_obj = self.pool.get('account.invoice.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
acc_obj = self.pool.get('account.account')
|
||||
self.button_compute(cr, uid, ids, context={}, set_total=True)
|
||||
self.button_compute(cr, uid, ids, context={}, set_total=False)
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
if inv.move_id:
|
||||
continue
|
||||
@@ -598,14 +598,34 @@ class account_invoice(osv.osv):
|
||||
|
||||
date = inv.date_invoice or time.strftime('%Y-%m-%d')
|
||||
part = inv.partner_id.id
|
||||
|
||||
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})) ,iml)
|
||||
|
||||
if inv.journal_id.group_invoice_lines:
|
||||
line2 = {}
|
||||
for x, y, l in line:
|
||||
tmp = str(l['account_id'])
|
||||
tmp += '-'+str('tax_code_id' in l and l['tax_code_id'] or "False")
|
||||
tmp += '-'+str('product_id' in l and l['product_id'] or "False")
|
||||
tmp += '-'+str('analytic_account_id' in l and l['analytic_account_id'] or "False")
|
||||
|
||||
if tmp in line2:
|
||||
am = line2[tmp]['debit'] - line2[tmp]['credit'] + (l['debit'] - l['credit'])
|
||||
line2[tmp]['debit'] = (am > 0) and am or 0.0
|
||||
line2[tmp]['credit'] = (am < 0) and -am or 0.0
|
||||
line2[tmp]['tax_amount'] += l['tax_amount']
|
||||
line2[tmp]['analytic_lines'] += l['analytic_lines']
|
||||
else:
|
||||
line2[tmp] = l
|
||||
line = []
|
||||
for key, val in line2.items():
|
||||
line.append((0,0,val))
|
||||
|
||||
journal_id = inv.journal_id.id #self._get_journal(cr, uid, {'type': inv['type']})
|
||||
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
|
||||
if journal.centralisation:
|
||||
raise osv.except_osv(_('UserError'),
|
||||
_('Can not create invoice move on centralized journal'))
|
||||
|
||||
move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date}
|
||||
period_id=inv.period_id and inv.period_id.id or False
|
||||
if not period_id:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<report auto="True" id="payment_order1" model="payment.order" name="payement.order" rml="account_payment/report/order.rml" string="Payment Order"/>
|
||||
<report auto="True" id="payment_order1" model="payment.order" name="payment.order" rml="account_payment/report/order.rml" string="Payment Order"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -31,4 +31,4 @@ class payment_order(report_sxw.rml_parse):
|
||||
'time': time,
|
||||
|
||||
})
|
||||
report_sxw.report_sxw('report.payment.order', 'payement.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order,header=False)
|
||||
report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order,header=False)
|
||||
@@ -43,6 +43,7 @@ Basic Accounting, plus new things which available are:
|
||||
],
|
||||
|
||||
"update_xml" : [
|
||||
"security/ir.model.access.csv",
|
||||
"account_voucher_sequence.xml",
|
||||
"account_view.xml",
|
||||
"account_report.xml",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_account_voucher_user","account.voucher","model_account_voucher","account.group_account_user",1,0,0,0
|
||||
"access_account_voucher_line_user","account.voucher.line","model_account_voucher_line","account.group_account_user",1,0,0,0
|
||||
"access_account_voucher_manager","account.voucher","model_account_voucher","account.group_account_manager",1,1,1,1
|
||||
"access_account_voucher_line_manager","account.voucher.line","model_account_voucher_line","account.group_account_manager",1,1,1,1
|
||||
|
||||
|
@@ -25,9 +25,8 @@ from osv.osv import osv, orm
|
||||
from report.interface import report_rml
|
||||
#FIXME: use the one from tools and delete the one from report
|
||||
from report.int_to_text import int_to_text
|
||||
|
||||
def toxml(val):
|
||||
return val.replace('&', '&').replace('<','<').replace('>','>').decode('utf-8').encode('latin1', 'replace')
|
||||
from tools import to_xml as toxml
|
||||
from tools import ustr
|
||||
|
||||
class report_custom(report_rml):
|
||||
def __init__(self, name, table, tmpl, xsl):
|
||||
@@ -38,7 +37,7 @@ class report_custom(report_rml):
|
||||
lots = pool.get('auction.lots').browse(cr, uid, ids)
|
||||
auction = lots[0].auction_id
|
||||
|
||||
xml = '''<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
xml = '''<?xml version="1.0" encoding="UTF-8"?>
|
||||
<report>
|
||||
<auction>
|
||||
<name>%s</name>
|
||||
@@ -49,7 +48,7 @@ class report_custom(report_rml):
|
||||
for l in lots:
|
||||
# l['id_cont'] = str(i)
|
||||
if l['obj_price']==0:
|
||||
price_french = 'retir�'
|
||||
price_french = u'retiré'
|
||||
else:
|
||||
price_french = int_to_text(int(l['obj_price'] or 0.0))+' eur'
|
||||
i+=1
|
||||
@@ -59,10 +58,9 @@ class report_custom(report_rml):
|
||||
<lot_desc>%s</lot_desc>
|
||||
<price>%s</price>
|
||||
<obj_price>%s</obj_price>
|
||||
</object>''' % (i, l['obj_num'], toxml(l['name']), price_french, str(l['obj_price'] or '/'))
|
||||
</object>''' % (i, l['obj_num'], ustr(toxml(l['name'])), ustr(price_french), ustr(l['obj_price'] or '/'))
|
||||
xml += '</report>'
|
||||
|
||||
# file('/tmp/terp.xml','wb+').write(xml)
|
||||
return xml
|
||||
|
||||
report_custom('report.flagey.huissier', 'auction.lots', '', 'addons/auction/report/huissier.xsl')
|
||||
|
||||
@@ -111,13 +111,13 @@ class res_partner_job(osv.osv):
|
||||
return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
|
||||
|
||||
_name = 'res.partner.job'
|
||||
_description ='Contact Job Title'
|
||||
_description ='Contact Partner Function'
|
||||
_order = 'sequence_contact'
|
||||
_columns = {
|
||||
'name': fields.related('address_id','partner_id', type='many2one', relation='res.partner', string='Partner'),
|
||||
'address_id':fields.many2one('res.partner.address','Address'),
|
||||
'contact_id':fields.many2one('res.partner.contact','Contact', required=True, ondelete='cascade'),
|
||||
'function_id': fields.many2one('res.partner.function','Job Title'),
|
||||
'function_id': fields.many2one('res.partner.function','Partner Function'),
|
||||
'sequence_contact':fields.integer('Sequence',help='Order of importance of this address in the list of addresses of the linked contact'),
|
||||
'sequence_partner':fields.integer('Sequence',help='Order of importance of this job title in the list of job title of the linked partner'),
|
||||
'email': fields.char('E-Mail', size=240),
|
||||
|
||||
@@ -26,34 +26,51 @@ class abstract_quality_check(object):
|
||||
This Class provide...
|
||||
'''
|
||||
|
||||
#This float have to store the rating of the module.
|
||||
#Used to compute the final score (average of all scores).
|
||||
score = 0.0
|
||||
|
||||
#This char have to store the result.
|
||||
#Used to display the result of the test.
|
||||
result = ""
|
||||
|
||||
#This char have to store the result with more details.
|
||||
#Used to provide more details if necessary.
|
||||
result_details = ""
|
||||
|
||||
#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
|
||||
# #This float have to store the rating of the module.
|
||||
# #Used to compute the final score (average of all scores).
|
||||
# score = 0.0
|
||||
#
|
||||
# #This char have to store the result.
|
||||
# #Used to display the result of the test.
|
||||
# result = ""
|
||||
#
|
||||
# #This char have to store the result with more details.
|
||||
# #Used to provide more details if necessary.
|
||||
# result_details = ""
|
||||
#
|
||||
# #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
|
||||
|
||||
def __init__(self):
|
||||
'''
|
||||
this method should initialize the var
|
||||
'''
|
||||
raise 'Not Implemented'
|
||||
#This float have to store the rating of the module.
|
||||
#Used to compute the final score (average of all scores).
|
||||
self.score = 0.0
|
||||
|
||||
#This char have to store the result.
|
||||
#Used to display the result of the test.
|
||||
self.result = ""
|
||||
|
||||
#This char have to store the result with more details.
|
||||
#Used to provide more details if necessary.
|
||||
self.result_details = ""
|
||||
|
||||
#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.
|
||||
self.bool_installed_only = True
|
||||
|
||||
# raise 'Not Implemented'
|
||||
|
||||
def run_test(self, cr, uid, module_path=""):
|
||||
'''
|
||||
this method should do the test and fill the score, result and result_details var
|
||||
'''
|
||||
raise 'Not Implemented'
|
||||
# raise 'Not Implemented'
|
||||
|
||||
def get_objects(self, cr, uid, module):
|
||||
# This function returns all object of the given module..
|
||||
@@ -77,5 +94,30 @@ class abstract_quality_check(object):
|
||||
result_ids[obj] = ids
|
||||
return result_ids
|
||||
|
||||
def format_table(self, test='', header=[], data_list=[]):
|
||||
res_format = {}
|
||||
if test=='method':
|
||||
detail = ""
|
||||
detail += "\n===Method Test===\n"
|
||||
detail += ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-16s \n! %-20s \n! %-16s ') % (header[0].ljust(40), header[1].ljust(16), header[2].ljust(20), header[3].ljust(16))
|
||||
for res in data_list[1][0]:
|
||||
detail += ('\n|-\n| %s \n| %s \n| %s \n| %s ') % (res, data_list[1][0][res][0], data_list[1][0][res][1], data_list[1][0][res][2])
|
||||
res_format['summary'] = [data_list[0][0]]
|
||||
res_format['detail'] = [detail + '\n|}']
|
||||
elif test=='pylint':
|
||||
res_format['summary'] = data_list[0]
|
||||
res_format['detail'] = data_list[1]
|
||||
elif test=='speed':
|
||||
detail = ""
|
||||
detail += "\n===Speed Test===\n"
|
||||
detail += ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n! %-10s \n! %-10s \n! %-10s \n! %-20s') % (header[0].ljust(40), header[1].ljust(10), header[2].ljust(10), header[3].ljust(10), header[4].ljust(10), header[5].ljust(20))
|
||||
for data in data_list[1]:
|
||||
detail += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (data[0], data[1], data[2], data[3], data[4], data[5])
|
||||
res_format['summary'] = data_list[0]
|
||||
res_format['detail'] = [detail + '\n|}\n']
|
||||
return res_format
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -9,8 +9,20 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Result">
|
||||
<separator string="Summary" colspan="4"/>
|
||||
<field name="general_info" widget="text_wiki" nolabel="1" colspan="4" height="350" width="800"/>
|
||||
<notebook>
|
||||
<page string="Summary">
|
||||
<!-- <separator string="Summary" colspan="4"/>-->
|
||||
<field name="general_info" widget="text_wiki" nolabel="1" colspan="4" height="350" width="800"/>
|
||||
</page>
|
||||
<page string="Detail">
|
||||
<!-- <separator string="Detail" colspan="4"/>-->
|
||||
<field name="detail" widget="text_wiki" nolabel="1" colspan="4" height="350" width="800"/>
|
||||
</page>
|
||||
<page string="Verbose detail">
|
||||
<!-- <separator string="Verbose detail" colspan="4"/>-->
|
||||
<field name="verbose_detail" widget="text_wiki" nolabel="1" colspan="4" height="350" width="800"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -30,12 +30,13 @@ import pooler
|
||||
class quality_test(base_module_quality.abstract_quality_check):
|
||||
|
||||
def __init__(self):
|
||||
self.result = """
|
||||
===Method Test===:
|
||||
|
||||
This test checks if the module classes are raising exception when calling basic methods or no.
|
||||
|
||||
"""
|
||||
super(quality_test, self).__init__()
|
||||
# self.result = """
|
||||
#===Method Test===:
|
||||
#
|
||||
#This test checks if the module classes are raising exception when calling basic methods or no.
|
||||
#
|
||||
#"""
|
||||
self.bool_installed_only = True
|
||||
return None
|
||||
|
||||
@@ -46,7 +47,6 @@ This test checks if the module classes are raising exception when calling basic
|
||||
result = {}
|
||||
ok_count = 0
|
||||
ex_count = 0
|
||||
|
||||
for obj in obj_list:
|
||||
temp = []
|
||||
try:
|
||||
@@ -71,13 +71,18 @@ This test checks if the module classes are raising exception when calling basic
|
||||
temp.append('Exception')
|
||||
ex_count += 1
|
||||
result[obj] = temp
|
||||
self.result += ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-16s \n! %-20s \n! %-16s ') % ('Object Name'.ljust(40), 'search()'.ljust(16), 'fields_view_get()'.ljust(20), 'read()'.ljust(16))
|
||||
|
||||
for res in result:
|
||||
self.result += ('\n|-\n| %s \n| %s \n| %s \n| %s ') % (res, result[res][0],result[res][1], result[res][2])
|
||||
|
||||
self.result += '\n|}'
|
||||
# self.result += ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-16s \n! %-20s \n! %-16s ') % ('Object Name'.ljust(40), 'search()'.ljust(16), 'fields_view_get()'.ljust(20), 'read()'.ljust(16))
|
||||
header_list = ['Object Name', 'search()', 'fields_view_get', 'read']
|
||||
# for res in result:
|
||||
# self.result += ('\n|-\n| %s \n| %s \n| %s \n| %s ') % (res, result[res][0],result[res][1], result[res][2])
|
||||
# self.result += '\n|}'
|
||||
self.score = (ok_count + ex_count) and float(ok_count)/float(ok_count + ex_count) or 0.0
|
||||
summary = """\n ===Method Test===:
|
||||
|
||||
This test checks if the module classes are raising exception when calling basic methods or no.
|
||||
|
||||
""" + "Score: " + str(self.score) + "/10\n"
|
||||
self.result = self.format_table(test='method', header=header_list, data_list=[[summary],[result]])
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -30,12 +30,13 @@ from base_module_quality import base_module_quality
|
||||
class quality_test(base_module_quality.abstract_quality_check):
|
||||
|
||||
def __init__(self):
|
||||
self.result = """
|
||||
===Pylint Test===:
|
||||
|
||||
This test checks if the module satisfy the current coding standard used by OpenERP.
|
||||
|
||||
"""
|
||||
super(quality_test, self).__init__()
|
||||
# self.result = """
|
||||
#===Pylint Test===:
|
||||
#
|
||||
# This test checks if the module satisfy the current coding standard used by OpenERP.
|
||||
#
|
||||
#"""
|
||||
self.bool_installed_only = False
|
||||
return None
|
||||
|
||||
@@ -50,6 +51,8 @@ class quality_test(base_module_quality.abstract_quality_check):
|
||||
|
||||
n = 0
|
||||
score = 0.0
|
||||
detail = ""
|
||||
detail = "\n===Pylint Test===\n"
|
||||
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)
|
||||
@@ -64,13 +67,21 @@ class quality_test(base_module_quality.abstract_quality_check):
|
||||
|
||||
try:
|
||||
score += float(res[leftchar+1:rightchar])
|
||||
self.result += file + ": " + res[leftchar+1:rightchar] + "/10\n"
|
||||
# self.result += file + ": " + res[leftchar+1:rightchar] + "/10\n"
|
||||
detail += file + ": " + res[leftchar+1:rightchar] + "/10\n"
|
||||
except:
|
||||
score += 0
|
||||
self.result += file + ": Unable to parse the result. Check the details.\n"
|
||||
|
||||
# self.result += file + ": Unable to parse the result. Check the details.\n"
|
||||
detail += file + ": Unable to parse the result. Check the details.\n"
|
||||
self.result_details += res
|
||||
self.score = n and score / n or score
|
||||
summary ="""
|
||||
===Pylint Test===:
|
||||
|
||||
This test checks if the module satisfy the current coding standard used by OpenERP.
|
||||
|
||||
""" + "Score: " + str(self.score) + "/10\n"
|
||||
self.result = self.format_table(test='pylint', data_list=[[summary],[detail]])
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -34,74 +34,75 @@ from base_module_quality import base_module_quality
|
||||
class quality_test(base_module_quality.abstract_quality_check):
|
||||
|
||||
def __init__(self):
|
||||
self.result = """
|
||||
===Speed Test===:
|
||||
|
||||
This test checks the speed of the module.
|
||||
|
||||
"""
|
||||
super(quality_test, self).__init__()
|
||||
# self.result = """
|
||||
#===Speed Test===:
|
||||
#
|
||||
#This test checks the speed of the module.
|
||||
#
|
||||
#"""
|
||||
self.bool_installed_only = True
|
||||
return None
|
||||
|
||||
def run_test(self, cr, uid, module_path):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
module_name = module_path.split('/')[-1]
|
||||
self.result+=('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n! %-10s \n! %-10s \n! %-10s \n! %-20s') % ('Object Name'.ljust(40), 'Size (S)'.ljust(10), '1'.ljust(10), 'S/2'.ljust(10), 'S'.ljust(10), 'Complexity'.ljust(20))
|
||||
# self.result+=('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n! %-10s \n! %-10s \n! %-10s \n! %-20s') % ('Object Name'.ljust(40), 'Size-Number of Records (S)'.ljust(10), '1'.ljust(10), 'S/2'.ljust(10), 'S'.ljust(10), 'Complexity using query'.ljust(20))
|
||||
header_list = ['Object Name', 'Size-Number of Records (S)', '1', 'S/2', 'S', 'Complexity using query']
|
||||
obj_list = self.get_objects(cr, uid, module_name)
|
||||
obj_counter = 0
|
||||
score = 0
|
||||
obj_ids = self.get_ids(cr, uid, obj_list)
|
||||
detail = ""
|
||||
list1 = []
|
||||
for obj in obj_ids:
|
||||
obj_counter += 1
|
||||
ids = obj_ids[obj]
|
||||
ids = ids[:100]
|
||||
size = len(ids)
|
||||
if size:
|
||||
c1 = time.time()
|
||||
c1 = cr.count
|
||||
|
||||
pool.get(obj).read(cr, uid, ids[0])
|
||||
c2 = time.time()
|
||||
base_time = c2 - c1
|
||||
c1 = time.time()
|
||||
pool.get(obj).read(cr, uid, ids[0])
|
||||
code_base_complexity = cr.count - c1
|
||||
|
||||
pool.get(obj).read(cr, uid, ids[:size/2])
|
||||
c2 = time.time()
|
||||
halfsize_time = c2 - c1
|
||||
c1 = time.time()
|
||||
pool.get(obj).read(cr, uid, ids[:size/2])
|
||||
code_half_complexity = cr.count - c1
|
||||
|
||||
pool.get(obj).read(cr, uid, ids)
|
||||
c2 = time.time()
|
||||
size_time = c2 - c1
|
||||
pool.get(obj).read(cr, uid, ids)
|
||||
code_size_complexity = cr.count - c1
|
||||
|
||||
if size < 5:
|
||||
self.score += -2
|
||||
self.result += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (obj, size, base_time, halfsize_time, size_time, "Warning! Not enough demo data")
|
||||
# self.result += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (obj, size, code_base_complexity, code_half_complexity, code_size_complexity, "Warning! Not enough demo data")
|
||||
list = [obj, size, code_base_complexity, code_half_complexity, code_size_complexity, "Warning! Not enough demo data"]
|
||||
list1.append(list)
|
||||
else:
|
||||
tolerated_margin = 5/100
|
||||
complexity = "not recognized"
|
||||
if min(size_time,base_time,halfsize_time) != base_time:
|
||||
if code_size_complexity <= (code_base_complexity + size):
|
||||
complexity = "O(1)"
|
||||
score += 10
|
||||
|
||||
score = 10
|
||||
else:
|
||||
k1 = (halfsize_time - base_time)*1000 / ((size/2) - 1)
|
||||
k2 = (size_time - base_time)*1000 / ((size) - 1)
|
||||
tmp = k1 * tolerated_margin
|
||||
if (k1 - tmp) < k2 and k2 < (k1 + tmp):
|
||||
complexity = "O(n)"
|
||||
if round(tmp) == 0:
|
||||
complexity = "O(1)"
|
||||
score += 10
|
||||
else:
|
||||
score += 5
|
||||
else:
|
||||
complexity = "O(n²) or worst"
|
||||
score += 0
|
||||
|
||||
self.result += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (obj, size, base_time, halfsize_time, size_time, complexity)
|
||||
complexity = "O(n) or worst"
|
||||
score = 0
|
||||
# self.result += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (obj, size, code_base_complexity, code_half_complexity, code_size_complexity, complexity)
|
||||
list = [obj, size, code_base_complexity, code_half_complexity, code_size_complexity, complexity]
|
||||
list1.append(list)
|
||||
else:
|
||||
score += -5
|
||||
self.result += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (obj, size, "", "", "", "Warning! Object has no demo data")
|
||||
|
||||
|
||||
self.result += '\n|}\n'
|
||||
# self.result += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (obj, size, "", "", "", "Warning! Object has no demo data")
|
||||
list = [obj, size, "", "", "", "Warning! Object has no demo data"]
|
||||
list1.append(list)
|
||||
# self.result += '\n|}\n'
|
||||
self.score = obj_counter and score/obj_counter or 0.0
|
||||
summary = """
|
||||
===Speed Test===:
|
||||
|
||||
This test checks the speed of the module.
|
||||
|
||||
"""+ "Score: " + str(self.score) + "/10\n"
|
||||
self.result = self.format_table(test='speed', header=header_list, data_list=[[summary],list1])
|
||||
return None
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -56,9 +56,9 @@ class wiz_quality_check(osv.osv_memory):
|
||||
# general_info = ""
|
||||
_name = 'wizard.quality.check'
|
||||
|
||||
|
||||
def _check(self, cr, uid, data, context={}):
|
||||
string_ret = ""
|
||||
string_detail = ""
|
||||
from tools import config
|
||||
data['ids'] = data.get('module_id', False)
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
@@ -72,7 +72,7 @@ class wiz_quality_check(osv.osv_memory):
|
||||
if module_data[0].name == 'base':
|
||||
ad = tools.config['root_path']+'/addons'
|
||||
module_path = os.path.join(ad, module_data[0].name)
|
||||
item2 = 'base_module_quality.'+item+'.'+item
|
||||
item2 = 'base_module_quality.' + item +'.' + item
|
||||
x = __import__(item2)
|
||||
x2 = getattr(x, item)
|
||||
x3 = getattr(x2, item)
|
||||
@@ -81,9 +81,14 @@ class wiz_quality_check(osv.osv_memory):
|
||||
val.run_test(cr, uid, str(module_path))
|
||||
else:
|
||||
val.result += "The module has to be installed before running this test."
|
||||
string_ret += val.result
|
||||
string_ret += val.result['summary'][0]
|
||||
string_detail += val.result['detail'][0]
|
||||
self.string_detail = string_detail
|
||||
return string_ret
|
||||
|
||||
def _check_detail(self, cr, uid, data, context={}):
|
||||
return self.string_detail
|
||||
|
||||
# def _general_info(self, cr, uid, data, context={}):
|
||||
# return self.general_info
|
||||
|
||||
@@ -102,9 +107,12 @@ class wiz_quality_check(osv.osv_memory):
|
||||
#~ },
|
||||
_columns = {
|
||||
'general_info': fields.text('General Info', readonly="1",),
|
||||
'detail' : fields.text('Detail', readonly="1",),
|
||||
'verbose_detail' : fields.text('Verbose Detail', readonly="1",)
|
||||
}
|
||||
_defaults = {
|
||||
'general_info': _check
|
||||
'general_info': _check,
|
||||
'detail': _check_detail
|
||||
}
|
||||
|
||||
wiz_quality_check()
|
||||
|
||||
@@ -37,6 +37,7 @@ With this module:
|
||||
""",
|
||||
"demo_xml" : [],
|
||||
"update_xml" : [
|
||||
"security/ir.model.access.csv",
|
||||
"mrp_subproduct_view.xml",
|
||||
],
|
||||
"active": False,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_mrp_subproduct_user","mrp.subproduct","model_mrp_subproduct","mrp.group_mrp_user",1,0,0,0
|
||||
"access_mrp_subproduct_manager","mrp.subproduct","model_mrp_subproduct","mrp.group_mrp_manager",1,1,1,1
|
||||
|
@@ -33,7 +33,7 @@ class wiz_timebox_open(wizard.interface):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
ids = pool.get('project.gtd.timebox').search(cr, uid, [('user_id','=',uid),('type','=',tbtype)])
|
||||
if not len(ids):
|
||||
raise wizard.except_wizard('Error !', 'No timebox of the type "%s" defined !')
|
||||
raise wizard.except_wizard('Error !', 'No timebox of the type "%s" defined !' % (tbtype,))
|
||||
view_type = 'form,tree'
|
||||
if len(ids) >= 1:
|
||||
domain = "[('id','in',["+','.join(map(str,ids))+"])]"
|
||||
|
||||
@@ -3,4 +3,6 @@
|
||||
"wiki_groups_all","wiki.groups","model_wiki_groups",,1,0,0,0
|
||||
"wiki_wiki","wiki.wiki","model_wiki_wiki","base.group_user",1,1,1,1
|
||||
"wiki_groups","wiki.groups","model_wiki_groups","base.group_system",1,1,1,1
|
||||
"wiki_groups_link","wiki.groups.link","model_wiki_groups_link","base.group_system",1,1,1,1
|
||||
"wiki_wiki_history","wiki.wiki.history","model_wiki_wiki_history","base.group_user",1,0,1,0
|
||||
"wiki_wizard_wiki_history_show_diff","wizard.wiki.history.show_diff","model_wizard_wiki_history_show_diff","base.group_user",1,1,1,1
|
||||
|
||||
|
Reference in New Issue
Block a user