bzr revid: fp@tinyerp.com-20090115150039-q1dazerz8m9bhm55
This commit is contained in:
Fabien Pinckaers 2009-01-15 16:00:39 +01:00
commit 45feff81ca
16 changed files with 83 additions and 92 deletions

View File

@ -289,8 +289,6 @@ class account_account(osv.osv):
'check_history': fields.boolean('Display History', 'check_history': fields.boolean('Display History',
help="Check this box if you want to print all entries when printing the General Ledger, "\ help="Check this box if you want to print all entries when printing the General Ledger, "\
"otherwise it will only print its balance."), "otherwise it will only print its balance."),
'merge_invoice': fields.boolean('Merge Invoice Entries',help="Check this box if you want that all lines of "\
"a customer or supplier invoice using this account are created in one line only"),
} }
def _default_company(self, cr, uid, context={}): def _default_company(self, cr, uid, context={}):
@ -448,8 +446,8 @@ class account_journal(osv.osv):
'active': fields.boolean('Active'), 'active': fields.boolean('Active'),
'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."), '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_credit_account_id': fields.many2one('account.account', 'Default Credit Account', domain="[('type','!=','view')]"),
'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account'), 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]"),
'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."), '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'), '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."), '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."),
@ -1901,8 +1899,8 @@ class account_fiscal_position_account_template(osv.osv):
_rec_name = 'position_id' _rec_name = 'position_id'
_columns = { _columns = {
'position_id': fields.many2one('account.fiscal.position.template', 'Fiscal Position', required=True, ondelete='cascade'), 'position_id': fields.many2one('account.fiscal.position.template', 'Fiscal Position', required=True, ondelete='cascade'),
'account_src_id': fields.many2one('account.account.template', 'Account Source', required=True), 'account_src_id': fields.many2one('account.account.template', 'Account Source', domain=[('type','<>','view')], required=True),
'account_dest_id': fields.many2one('account.account.template', 'Account Destination', required=True) 'account_dest_id': fields.many2one('account.account.template', 'Account Destination', domain=[('type','<>','view')], required=True)
} }
account_fiscal_position_account_template() account_fiscal_position_account_template()

View File

@ -28,7 +28,7 @@
</form> </form>
</field> </field>
<separator colspan="4" string="States"/> <separator colspan="4" string="States"/>
<field name="state" select="1"/> <field name="state" select="1" readonly="1"/>
<group col="2" colspan="2"> <group col="2" colspan="2">
<button name="create_period" states="draft" string="Create Monthly Periods" type="object"/> <button name="create_period" states="draft" string="Create Monthly Periods" type="object"/>
<button name="create_period3" states="draft" string="Create 3 Months Periods" type="object"/> <button name="create_period3" states="draft" string="Create 3 Months Periods" type="object"/>
@ -130,7 +130,6 @@
<field name="reconcile"/> <field name="reconcile"/>
<field name="active" select="2"/> <field name="active" select="2"/>
<field name="check_history"/> <field name="check_history"/>
<field name="merge_invoice" select="2"/>
<newline/> <newline/>
<newline/> <newline/>
<field colspan="4" name="tax_ids" domain="[('parent_id','=',False)]"/> <field colspan="4" name="tax_ids" domain="[('parent_id','=',False)]"/>

View File

@ -182,7 +182,7 @@ class account_invoice(osv.osv):
'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]} ), 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]} ),
'period_id': fields.many2one('account.period', 'Force Period', help="Keep empty to use the period of the validation date."), 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation date."),
'account_id': fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The partner account used for this invoice."), 'account_id': fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The partner account used for this invoice."),
'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}), 'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}),
@ -431,7 +431,6 @@ class account_invoice(osv.osv):
def action_move_create(self, cr, uid, ids, *args): def action_move_create(self, cr, uid, ids, *args):
ait_obj = self.pool.get('account.invoice.tax') ait_obj = self.pool.get('account.invoice.tax')
cur_obj = self.pool.get('res.currency') cur_obj = self.pool.get('res.currency')
acc_obj = self.pool.get('account.account')
self.button_compute(cr, uid, ids, context={}, set_total=False) self.button_compute(cr, uid, ids, context={}, set_total=False)
for inv in self.browse(cr, uid, ids): for inv in self.browse(cr, uid, ids):
if inv.move_id: if inv.move_id:
@ -479,11 +478,7 @@ class account_invoice(osv.osv):
# create one move line for the total and possibly adjust the other lines amount # create one move line for the total and possibly adjust the other lines amount
total = 0 total = 0
total_currency = 0 total_currency = 0
key_line=[]
for i in iml: for i in iml:
if 'account_id' in i and 'taxes' in i:
if not (i['account_id'],i['taxes']) in key_line:
key_line.append((i['account_id'],i['taxes']))
if inv.currency_id.id != company_currency: if inv.currency_id.id != company_currency:
i['currency_id'] = inv.currency_id.id i['currency_id'] = inv.currency_id.id
i['amount_currency'] = i['price'] i['amount_currency'] = i['price']
@ -504,36 +499,6 @@ class account_invoice(osv.osv):
acc_id = inv.account_id.id acc_id = inv.account_id.id
name = inv['name'] or '/' name = inv['name'] or '/'
iml_temp=[]
move_list=[]
for item in key_line:
move_temp={}
if acc_obj.browse(cr,uid,item[0]).merge_invoice:
repeat=False
for move_line in iml:
if (move_line.has_key('account_id') and move_line['account_id']==item[0]) and ('taxes' in move_line and move_line['taxes']==item[1]):
move_list.append(move_line)
if repeat:
for key in move_line:
if key in ['name','amount_currency','price_unit','price','quantity']:
if key=='name':
move_temp[key]=move_temp[key] + "," +move_line[key]
else:
move_temp[key] +=move_line[key]
else:
for key in move_line:
move_temp[key]=move_line[key]
repeat=True
if move_temp:
iml_temp.append(move_temp)
if len(iml_temp)<len(move_list):
for old_elem in move_list:
iml.remove(old_elem)
for new_elem in iml_temp:
iml.append(new_elem)
totlines = False totlines = False
if inv.payment_term: if inv.payment_term:
totlines = self.pool.get('account.payment.term').compute(cr, totlines = self.pool.get('account.payment.term').compute(cr,

View File

@ -76,8 +76,8 @@ class account_fiscal_position_account(osv.osv):
_rec_name = 'position_id' _rec_name = 'position_id'
_columns = { _columns = {
'position_id': fields.many2one('account.fiscal.position', 'Fiscal Position', required=True, ondelete='cascade'), 'position_id': fields.many2one('account.fiscal.position', 'Fiscal Position', required=True, ondelete='cascade'),
'account_src_id': fields.many2one('account.account', 'Account Source', required=True), 'account_src_id': fields.many2one('account.account', 'Account Source', domain=[('type','<>','view')], required=True),
'account_dest_id': fields.many2one('account.account', 'Account Destination', required=True) 'account_dest_id': fields.many2one('account.account', 'Account Destination', domain=[('type','<>','view')], required=True)
} }
account_fiscal_position_account() account_fiscal_position_account()

View File

@ -159,7 +159,6 @@ class account_report(osv.osv):
('other','Others')], ('other','Others')],
'Type', required=True), 'Type', required=True),
'expression': fields.char('Expression', size=240, required=True), 'expression': fields.char('Expression', size=240, required=True),
# 'expression_status': fields.char('Status expression', size=240, required=True),
'badness_limit' :fields.float('Badness Indicator Limit', digits=(16,2),help='This Value depicts the limit of badness.'), 'badness_limit' :fields.float('Badness Indicator Limit', digits=(16,2),help='This Value depicts the limit of badness.'),
'goodness_limit' :fields.float('Goodness Indicator Limit', digits=(16,2),help='This Value depicts the limit of goodness.'), 'goodness_limit' :fields.float('Goodness Indicator Limit', digits=(16,2),help='This Value depicts the limit of goodness.'),
'parent_id': fields.many2one('account.report.report', 'Parent'), 'parent_id': fields.many2one('account.report.report', 'Parent'),
@ -204,10 +203,7 @@ class account_report(osv.osv):
return self.name_get(cr, user, ids, context=context) return self.name_get(cr, user, ids, context=context)
_constraints = [ _constraints = [
#TODO Put an expression to valid expression and expression_status #TODO Put an expression to valid expression
]
_sql_constraints = [
('code_uniq', 'unique (code)', 'The code of the report entry must be unique !')
] ]
account_report() account_report()

View File

@ -25,8 +25,7 @@
'name': 'Base module quality', 'name': 'Base module quality',
'version': '1.0', 'version': '1.0',
'category': 'Tiny Specific Modules/Base module quality', 'category': 'Tiny Specific Modules/Base module quality',
'description': """" 'description': """This module's aim is to check the quality of other modules.
This module's aim is to check the quality of other modules.
It defines a wizard on the list of modules in OpenERP, which allow you to evaluate them on different criteria such as: the respect of OpenERP coding standards, the speed efficiency... It defines a wizard on the list of modules in OpenERP, which allow you to evaluate them on different criteria such as: the respect of OpenERP coding standards, the speed efficiency...

View File

@ -23,6 +23,7 @@ import pooler
import os import os
import osv import osv
from tools import config from tools import config
from tools.translate import _
class abstract_quality_check(object): class abstract_quality_check(object):
''' '''
@ -52,24 +53,28 @@ class abstract_quality_check(object):
#Used to provide more details if necessary. #Used to provide more details if necessary.
self.result_details = "" self.result_details = ""
#This bool defines if the test can be run only if the module is installed. #This bool defines if the test can be run only if the module
#is installed.
#True => the module have to be installed. #True => the module have to be installed.
#False => the module can be uninstalled. #False => the module can be uninstalled.
self.bool_installed_only = True self.bool_installed_only = True
#This variable is use to make result of test should have more weight (Some tests are more critical than others) #This variable is used to give result of test more weight,
#because some tests are more critical than others.
self.ponderation = 1.0 self.ponderation = 1.0
#Specify test got an error on module #Specify test got an error on module
self.error = False self.error = False
#The tests have to subscribe itselfs in this list, that contains all the test that have to be performed. #The tests have to subscribe itselfs in this list, that contains
#all the test that have to be performed.
self.tests = [] self.tests = []
self.list_folders = os.listdir(config['addons_path']+'/base_module_quality/') self.list_folders = os.listdir(config['addons_path'] +
'/base_module_quality/')
for item in self.list_folders: for item in self.list_folders:
self.item = item self.item = item
path = config['addons_path']+'/base_module_quality/'+item path = config['addons_path']+'/base_module_quality/'+item
if os.path.exists(path+'/'+item+'.py') and item not in ['report', 'wizard', 'security']: if os.path.exists(path + '/' + item + '.py') and item not in ['report', 'wizard', 'security']:
item2 = 'base_module_quality.' + item +'.' + item item2 = 'base_module_quality.' + item +'.' + item
x = __import__(item2) x = __import__(item2)
x2 = getattr(x, item) x2 = getattr(x, item)
@ -87,7 +92,8 @@ class abstract_quality_check(object):
def get_objects(self, cr, uid, module): def get_objects(self, cr, uid, module):
# This function returns all object of the given module.. # This function returns all object of the given module..
pool = pooler.get_pool(cr.dbname) pool = pooler.get_pool(cr.dbname)
ids2 = pool.get('ir.model.data').search(cr, uid, [('module','=', module), ('model','=','ir.model')]) ids2 = pool.get('ir.model.data').search(cr, uid,
[('module', '=', module), ('model', '=', 'ir.model')])
model_list = [] model_list = []
model_data = pool.get('ir.model.data').browse(cr, uid, ids2) model_data = pool.get('ir.model.data').browse(cr, uid, ids2)
for model in model_data: for model in model_data:

View File

@ -2,6 +2,7 @@
<openerp> <openerp>
<data> <data>
<!--<wizard id="base_module_quality" model="ir.module.module" name="base.module.quality" string="Check the Quality of module"/>--> <!--<wizard id="base_module_quality" model="ir.module.module" name="base.module.quality" string="Check the Quality of module"/>-->
<wizard id="quality_detail_save" model="ir.module.module" name="quality_detail_save" string="Report Save" menu="False"/>
<record id="view_wizard_quality_check_tree" model="ir.ui.view"> <record id="view_wizard_quality_check_tree" model="ir.ui.view">
<field name="name">Results of Quality Checks</field> <field name="name">Results of Quality Checks</field>
@ -45,7 +46,8 @@
<field name="state" readonly="1"/> <field name="state" readonly="1"/>
</page> </page>
<page string="Detail"> <page string="Detail">
<field name="detail" widget="html_tag" nolabel="1" colspan="4" readonly="1"/> <button name="%(quality_detail_save)d" string="Save Report" type="action"/>
<field name="detail" widget="text_html" nolabel="1" colspan="4" readonly="1"/>
</page> </page>
</notebook> </notebook>
</form> </form>

View File

@ -22,6 +22,7 @@
import os import os
import tools import tools
from tools.translate import _
from base_module_quality import base_module_quality from base_module_quality import base_module_quality
import pooler import pooler
@ -30,9 +31,6 @@ import re
class quality_test(base_module_quality.abstract_quality_check): class quality_test(base_module_quality.abstract_quality_check):
def __init__(self): def __init__(self):
# '''
# This test checks the quality of __terp__.py file in the selected module.
# '''
super(quality_test, self).__init__() super(quality_test, self).__init__()
self.name = _("Terp Test") self.name = _("Terp Test")
self.note = _("This test checks if the module satisfies the current coding standard used by OpenERP.") self.note = _("This test checks if the module satisfies the current coding standard used by OpenERP.")
@ -94,16 +92,15 @@ class quality_test(base_module_quality.abstract_quality_check):
feel_bad_factor += 1 feel_bad_factor += 1
else: else:
if not res[key]: if not res[key]:
feel_bad_factor += 1 feel_bad_factor += 1
if key == 'installable' and not res[key]: # installable tag is provided and True if key == 'installable' and not res[key]: # installable tag is provided and False
feel_bad_factor +=1 feel_bad_factor +=1
else: else:
feel_bad_factor += 1 feel_bad_factor += 1
score = round((feel_good_factor) / float(feel_good_factor + feel_bad_factor),2) score = round((feel_good_factor) / float(feel_good_factor + feel_bad_factor),2)
# self.result += "__terp__.py : "+ str(self.score) + "/10\n"
return [_('__terp__.py file'), score] return [_('__terp__.py file'), score]

View File

@ -21,6 +21,7 @@
############################################################################## ##############################################################################
import module_quality_check import module_quality_check
import quality_save_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$ # $Id$
# #
@ -20,17 +20,36 @@
# #
############################################################################## ##############################################################################
from osv import osv, fields import wizard
from osv import osv
import pooler
from tools.translate import _
#class custom_material(osv.osv): import base64
# _name = 'network.material'
# _inherit = 'network.material'
# _columns = {
# }
# _defaults = {
# }
#custom_material()
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: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -20,7 +20,5 @@
# #
############################################################################## ##############################################################################
import custom
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -23,6 +23,7 @@ import time
import os import os
import StringIO import StringIO
import odt2txt import odt2txt
import tempfile
# #
# This should be the indexer # This should be the indexer
@ -36,11 +37,10 @@ def content_index(content, filename=None, content_type=None):
stdin.close() stdin.close()
result = stdout.read().decode('latin1','replace').encode('utf-8','replace') result = stdout.read().decode('latin1','replace').encode('utf-8','replace')
elif ext == '.pdf': elif ext == '.pdf':
fname = os.tempnam(filename)+'.pdf' file_descriptor, file_name = tempfile.mkstemp(suffix=ext)
fp = file(fname,'wb') os.write(file_descriptor, content)
fp.write(content) os.close(file_descriptor)
fp.close() fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+file_name+' -', 'r')
fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+fname+' -', 'r')
result = fp.read() result = fp.read()
fp.close() fp.close()
elif ext in ('.xls','.ods','.odt','.odp'): elif ext in ('.xls','.ods','.odt','.odp'):
@ -52,4 +52,4 @@ def content_index(content, filename=None, content_type=None):
result = content result = content
else: else:
result = content result = content
return result return result

View File

@ -40,12 +40,23 @@
""", """,
'author': 'Tiny', 'author': 'Tiny',
'depends': ['account', 'account_report', 'base_vat', 'base_iban', 'account_chart'], 'depends': [
'account',
'account_report',
'base_vat',
'base_iban',
'account_chart'
],
'init_xml': [], 'init_xml': [],
'update_xml': ['account_pcmn_belgium.xml', 'l10n_be_wizard.xml', 'update_xml': [
'l10n_be_sequence.xml', 'fiscal_templates.xml', 'account_pcmn_belgium.xml',
'l10n_be_wizard.xml',
'l10n_be_sequence.xml',
'fiscal_templates.xml',
], ],
'demo_xml': [], 'demo_xml': [
'account.report.report.csv'
],
'installable': True, 'installable': True,
'certificate': '31977724637', 'certificate': '31977724637',
} }

View File

@ -359,7 +359,7 @@
<field name="name">France PCMN</field> <field name="name">France PCMN</field>
<field name="account_root_id" ref="l10n_fr.pcg_0"/> <field name="account_root_id" ref="l10n_fr.pcg_0"/>
<field name="tax_code_root_id" ref="l10n_fr.vat_code_chart_root"/> <field name="tax_code_root_id" ref="l10n_fr.vat_code_chart_root"/>
<field name="bank_account_view_id" ref="l10n_fr.pcg_Comptes_50"/> <field name="bank_account_view_id" ref="l10n_fr.pcg_512000"/>
<field name="property_account_receivable" ref="l10n_fr.a_recv"/> <field name="property_account_receivable" ref="l10n_fr.a_recv"/>
<field name="property_account_payable" ref="l10n_fr.a_pay"/> <field name="property_account_payable" ref="l10n_fr.a_pay"/>
<field name="property_account_expense_categ" ref="l10n_fr.a_expense"/> <field name="property_account_expense_categ" ref="l10n_fr.a_expense"/>

View File

@ -249,9 +249,9 @@ class product_template(osv.osv):
'categ_id': fields.many2one('product.category','Category', required=True, change_default=True), 'categ_id': fields.many2one('product.category','Category', required=True, change_default=True),
'list_price': fields.float('Sale Price', digits=(16, int(config['price_accuracy'])), help="Base price for computing the customer price. Sometimes called the catalog price."), 'list_price': fields.float('Sale Price', digits=(16, int(config['price_accuracy'])), help="Base price for computing the customer price. Sometimes called the catalog price."),
'standard_price': fields.float('Cost Price', required=True, digits=(16, int(config['price_accuracy'])), help="The cost of the product for accounting stock valorisation. It can serves as a base price for supplier price."), 'standard_price': fields.float('Cost Price', required=True, digits=(16, int(config['price_accuracy'])), help="The cost of the product for accounting stock valorisation. It can serves as a base price for supplier price."),
'volume': fields.float('Volume', help="The weight in Kg."), 'volume': fields.float('Volume', help="The volume in m3."),
'weight': fields.float('Gross weight'), 'weight': fields.float('Gross weight', help="The gross weight in Kg."),
'weight_net': fields.float('Net weight'), 'weight_net': fields.float('Net weight', help="The net weight in Kg."),
'cost_method': fields.selection([('standard','Standard Price'), ('average','Average Price')], 'Costing Method', required=True, 'cost_method': fields.selection([('standard','Standard Price'), ('average','Average Price')], 'Costing Method', required=True,
help="Standard Price: the cost price is fixed and recomputed periodically (usually at the end of the year), Average Price: the cost price is recomputed at each reception of products."), help="Standard Price: the cost price is fixed and recomputed periodically (usually at the end of the year), Average Price: the cost price is recomputed at each reception of products."),
'warranty': fields.float('Warranty (months)'), 'warranty': fields.float('Warranty (months)'),