diff --git a/addons/account/account.py b/addons/account/account.py index 78a53b053cd..7ba71473913 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -457,6 +457,7 @@ class account_journal(osv.osv): 'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'), 'entry_posted': fields.boolean('Skip \'Draft\' State for Created Entries', help='Check this box if you don\'t want that new account moves pass through the \'draft\' state and goes direclty to the \'posted state\' without any manual validation.'), 'company_id': fields.related('default_credit_account_id','company_id',type='many2one', relation="res.company", string="Company"), + 'fy_seq_id': fields.one2many('fiscalyear.seq', 'journal_id', 'Sequences'), } _defaults = { @@ -923,7 +924,7 @@ class account_move(osv.osv): for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: - for obj in obj_line.analytic_lines: + for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id) journal = move.journal_id @@ -1872,14 +1873,14 @@ account_tax_template() class account_fiscal_position_template(osv.osv): _name = 'account.fiscal.position.template' _description = 'Template for Fiscal Position' - + _columns = { 'name': fields.char('Fiscal Position Template', size=64, translate=True, required=True), 'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True), 'account_ids': fields.one2many('account.fiscal.position.account.template', 'position_id', 'Accounts Mapping'), 'tax_ids': fields.one2many('account.fiscal.position.tax.template', 'position_id', 'Taxes Mapping') } - + account_fiscal_position_template() class account_fiscal_position_tax_template(osv.osv): @@ -1905,7 +1906,7 @@ class account_fiscal_position_account_template(osv.osv): '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() # Multi charts of Accounts wizard @@ -2156,19 +2157,19 @@ class wizard_multi_charts_accounts(osv.osv_memory): property_obj.create(cr, uid, vals) fp_ids = obj_fiscal_position_template.search(cr, uid,[('chart_template_id', '=', obj_multi.chart_template_id.id)]) - + if fp_ids: for position in obj_fiscal_position_template.browse(cr, uid, fp_ids): - + vals_fp = { 'company_id' : company_id, 'name' : position.name, } new_fp = obj_fiscal_position.create(cr, uid, vals_fp) - + obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_ac_fp = self.pool.get('account.fiscal.position.account') - + for tax in position.tax_ids: vals_tax = { 'tax_src_id' : tax_template_ref[tax.tax_src_id.id], @@ -2176,7 +2177,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'position_id' : new_fp, } obj_tax_fp.create(cr, uid, vals_tax) - + for acc in position.account_ids: vals_acc = { 'account_src_id' : acc_template_ref[acc.account_src_id.id], @@ -2184,7 +2185,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'position_id' : new_fp, } obj_ac_fp.create(cr, uid, vals_acc) - + return { 'view_type': 'form', "view_mode": 'form', diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index bb15f1f4fb4..7c0f69411cd 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -197,7 +197,8 @@ class account_move_line(osv.osv): else: account = move.journal_id.default_debit_account_id - part = self.pool.get('res.partner').browse(cr, uid, partner_id) + part = partner_id and self.pool.get('res.partner').browse(cr, uid, partner_id) or False + # part = False is acceptable for fiscal position. account = self.pool.get('account.fiscal.position').map_account(cr, uid, part, account.id) account = self.pool.get('account.account').browse(cr, uid, account) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 1a0318094f8..a120855e73e 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -269,6 +269,16 @@ + + + + + +
+ + + + @@ -1687,9 +1697,9 @@ - + - + account.fiscal.position.template.form account.fiscal.position.template diff --git a/addons/account/invoice.py b/addons/account/invoice.py index d9d976304bd..2e5bb3c393f 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -30,6 +30,18 @@ from mx.DateTime import RelativeDateTime from tools import config from tools.translate import _ +class fiscalyear_seq(osv.osv): + _name = "fiscalyear.seq" + _description = "Maintains Invoice sequences with Fiscal Year" + _rec_name = 'fiscalyear_id' + _columns = { + 'journal_id': fields.many2one('account.journal', 'Journal'), + 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year',required=True), + 'sequence_id':fields.many2one('ir.sequence', 'Sequence',required=True), + } + +fiscalyear_seq() + class account_invoice(osv.osv): def _amount_all(self, cr, uid, ids, name, args, context=None): res = {} @@ -409,7 +421,7 @@ class account_invoice(osv.osv): for taxe in ait_obj.compute(cr, uid, id).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute - self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context) + self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context) return True def button_compute(self, cr, uid, ids, context=None, set_total=False): @@ -646,10 +658,18 @@ class account_invoice(osv.osv): cr.execute('SELECT id, type, number, move_id, reference ' \ 'FROM account_invoice ' \ 'WHERE id IN ('+','.join(map(str,ids))+')') + obj_inv = self.browse(cr, uid, ids)[0] for (id, invtype, number, move_id, reference) in cr.fetchall(): if not number: - number = self.pool.get('ir.sequence').get(cr, uid, - 'account.invoice.' + invtype) + flag = True + for seq in obj_inv.journal_id.fy_seq_id: + if seq.fiscalyear_id.id == obj_inv.move_id.period_id.fiscalyear_id.id: + number = self.pool.get('ir.sequence').get_id(cr, uid,seq.sequence_id.id) + flag = False + break + if flag: + number = self.pool.get('ir.sequence').get(cr, uid, + 'account.invoice.' + invtype) if invtype in ('in_invoice', 'in_refund'): ref = reference else: diff --git a/addons/account/report/tax_report.py b/addons/account/report/tax_report.py index e2b83b44f37..e9866ae0c7c 100644 --- a/addons/account/report/tax_report.py +++ b/addons/account/report/tax_report.py @@ -163,7 +163,7 @@ class tax_report(rml_parse.rml_parse): res = [] for code in tc.browse(self.cr, self.uid, ids, {'based_on': based_on}): - res.append(('a'*2*level,code)) + res.append(('.'*2*level,code)) res += self._get_codes(based_on, code.id, level+1) return res diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv index 96ab19de3a3..d4294d798c6 100644 --- a/addons/account/security/ir.model.access.csv +++ b/addons/account/security/ir.model.access.csv @@ -80,3 +80,4 @@ "access_account_fiscal_position","account.fiscal.position all","model_account_fiscal_position","base.group_user",1,0,0,0 "access_account_fiscal_position_tax","account.fiscal.position.tax all","model_account_fiscal_position_tax","base.group_user",1,0,0,0 "access_account_fiscal_position_account","account.fiscal.position all","model_account_fiscal_position_account","base.group_user",1,0,0,0 +"access_fiscalyear_seq","fiscalyear.seq","model_fiscalyear_seq","account.group_account_invoice",1,1,1,1 diff --git a/addons/base_module_quality/README.txt b/addons/base_module_quality/README.txt deleted file mode 100644 index 3819448c9c1..00000000000 --- a/addons/base_module_quality/README.txt +++ /dev/null @@ -1,11 +0,0 @@ -This module provide a generic framework to define your own quality test. - - -All you have to do is to: -* create a folder with your test in 'base_module_quality' (e.g: mkdir base_module_quality\mytest) -* create a .py file in it with same name as the folder you just created (e.g: touch base_module_quality\mytest\mytest.py) -* edit your file and define a class 'quality_check' that - * inherits the class 'abstract_quality_test' (defined in base_module_quality.py) - * implements the __init__() method accordingly to what you want to test. - - diff --git a/addons/base_module_quality/__init__.py b/addons/base_module_quality/__init__.py deleted file mode 100644 index 00a225753b2..00000000000 --- a/addons/base_module_quality/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 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 base_module_quality -import wizard - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/base_module_quality/__terp__.py b/addons/base_module_quality/__terp__.py deleted file mode 100644 index 1ad92d5d3a9..00000000000 --- a/addons/base_module_quality/__terp__.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 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 . -# -############################################################################## - - -{ - 'name': 'Base module quality', - 'version': '1.0', - 'category': 'Tiny Specific Modules/Base module quality', - 'description': """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... - - This module also provides generic framework to define your own quality test. For further info, coders may take a look into base_module_quality\README.txt -""", - 'author': 'Tiny', - 'depends': ['base'], - 'init_xml': [], - 'update_xml': ['base_module_quality_wizard.xml', 'security/ir.model.access.csv'], - 'installable': True, - 'active': False, - 'certificate': '75119475677', -} -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_module_quality/base_module_quality.py b/addons/base_module_quality/base_module_quality.py deleted file mode 100644 index b50ad8d20b0..00000000000 --- a/addons/base_module_quality/base_module_quality.py +++ /dev/null @@ -1,142 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 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 pooler -import os -import osv -from tools import config -from tools.translate import _ - -class abstract_quality_check(object): - ''' - This Class provides... - ''' - - def __init__(self): - ''' - this method should initialize the var - ''' - #This float have to store the rating of the module. - #Used to compute the final score (average of all scores). - #0 <= self.score <= 1 - self.score = 0.0 - - #This char have to store the name of the test. - self.name = "" - - #This char have to store the aim of the test and eventually a note. - self.note = "" - - #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 - - #This variable is used to give result of test more weight, - #because some tests are more critical than others. - self.ponderation = 1.0 - - #Specify test got an error on module - self.error = False - - #The tests have to subscribe itselfs in this list, that contains - #all the test that have to be performed. - self.tests = [] - self.list_folders = os.listdir(config['addons_path'] + - '/base_module_quality/') - for item in self.list_folders: - self.item = item - path = config['addons_path']+'/base_module_quality/'+item - if os.path.exists(path + '/' + item + '.py') and item not in ['report', 'wizard', 'security']: - item2 = 'base_module_quality.' + item +'.' + item - x = __import__(item2) - x2 = getattr(x, item) - x3 = getattr(x2, item) - self.tests.append(x3) -# 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 osv.except_osv(_('Programming Error'), _('Test Is 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 - - def format_table(self, header=[], data_list=[]): #This function can work forwidget="text_wiki" - detail = "" - detail += (header[0]) % tuple(header[1]) - frow = '\n|-' - for i in header[1]: - frow += '\n| %s' - for key, value in data_list.items(): - detail += (frow) % tuple(value) - detail = detail + '\n|}' - return detail - - def format_html_table(self, header=[], data_list=[]): #This function can work for widget="html_tag" - # function create html table.... - detail = "" - detail += (header[0]) % tuple(header[1]) - frow = '' - for i in header[1]: - frow += '%s' - frow += '' - for key, value in data_list.items(): - detail += (frow) % tuple(value) - return detail - - def add_quatation(self, x, y): - return x/y - -# 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 deleted file mode 100644 index 21986b49959..00000000000 --- a/addons/base_module_quality/base_module_quality_wizard.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - Results of Quality Checks - wizard.quality.check - tree - - - - - - - - - - Results of Quality Checks - wizard.quality.check - form - -
- - - - - - -
- - Results of Quality Checks with detail - quality.check.detail - form - -
- - - - - - - - - - - -