From 974624a15211160bcddcb39b49099d68619f40e2 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 14 Jan 2009 08:34:04 +0100 Subject: [PATCH 01/16] [FIX] Typo bzr revid: stephane@tinyerp.com-20090114073404-5u00fmohsradtpid --- addons/base_module_quality/__terp__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/base_module_quality/__terp__.py b/addons/base_module_quality/__terp__.py index d77b50cd830..1ad92d5d3a9 100644 --- a/addons/base_module_quality/__terp__.py +++ b/addons/base_module_quality/__terp__.py @@ -25,8 +25,7 @@ '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. + '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... From aaa22b707f1cd6802745ae6023b9aeec629c3a3e Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 14 Jan 2009 08:54:20 +0100 Subject: [PATCH 02/16] [IMP] Use tempfile.mkstemp instead of os.tempname. mkstemp is more secure bzr revid: stephane@tinyerp.com-20090114075420-yfgsx5cz8pjxcrkf --- addons/document/content_index.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/document/content_index.py b/addons/document/content_index.py index db78217b6d6..96297ff7a8b 100644 --- a/addons/document/content_index.py +++ b/addons/document/content_index.py @@ -23,6 +23,7 @@ import time import os import StringIO import odt2txt +import tempfile # # This should be the indexer @@ -36,11 +37,10 @@ def content_index(content, filename=None, content_type=None): stdin.close() result = stdout.read().decode('latin1','replace').encode('utf-8','replace') elif ext == '.pdf': - fname = os.tempnam(filename)+'.pdf' - fp = file(fname,'wb') - fp.write(content) - fp.close() - fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+fname+' -', 'r') + file_descriptor, file_name = tempfile.mkstemp(suffix=ext) + os.write(file_descriptor, content) + os.close(file_descriptor) + fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+file_name+' -', 'r') result = fp.read() fp.close() elif ext in ('.xls','.ods','.odt','.odp'): @@ -52,4 +52,4 @@ def content_index(content, filename=None, content_type=None): result = content else: result = content - return result \ No newline at end of file + return result From 7a8d5c0c2cc3dd7197cd7523d0d5f07b602e88d7 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 14 Jan 2009 10:52:10 +0100 Subject: [PATCH 03/16] [REF] Remove unusued code bzr revid: stephane@tinyerp.com-20090114095210-mdxolxl7884o1fzq --- addons/custom/__init__.py | 2 -- addons/custom/custom.py | 37 ------------------------------------- 2 files changed, 39 deletions(-) delete mode 100644 addons/custom/custom.py diff --git a/addons/custom/__init__.py b/addons/custom/__init__.py index 345290445e6..7ed460db2b3 100644 --- a/addons/custom/__init__.py +++ b/addons/custom/__init__.py @@ -20,7 +20,5 @@ # ############################################################################## -import custom - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/custom/custom.py b/addons/custom/custom.py deleted file mode 100644 index 2000b89e66a..00000000000 --- a/addons/custom/custom.py +++ /dev/null @@ -1,37 +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 . -# -############################################################################## - -from osv import osv, fields - -#class custom_material(osv.osv): -# _name = 'network.material' -# _inherit = 'network.material' -# _columns = { -# } -# _defaults = { -# } -#custom_material() - - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - From 6b59779b4598d07766720657af3e3cf053b36cd2 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:01:37 +0100 Subject: [PATCH 04/16] [FIX] lp:315408 Added domain [('type','!=','view')] on default_debit_account_id and default_credit_account_id fields of account_journal lp bug: https://launchpad.net/bugs/315408 fixed bzr revid: qdp@jade-20090114130137-ok0pnyde622gohgj --- addons/account/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index c249e704f81..9ae28c4ab1f 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -448,8 +448,8 @@ class account_journal(osv.osv): '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."), - 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account'), - 'default_debit_account_id': fields.many2one('account.account', 'Default Debit 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', 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."), '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."), From 5368288e81055057b3870715724875f5a98886a4 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:13:08 +0100 Subject: [PATCH 05/16] [FIX] lp:315415 Added a domain [('state','<>','done')] on period_id field of account_invoice lp bug: https://launchpad.net/bugs/315415 fixed bzr revid: qdp@jade-20090114131308-n05tcaj8kyv7pw3z --- addons/account/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 8a5cc00589e..6dd6ee1ccee 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -182,7 +182,7 @@ class account_invoice(osv.osv): '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."), 'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}), From 2203fc2d57516429bb0fcb102997f86921d6703d Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:31:50 +0100 Subject: [PATCH 06/16] typo corrected bzr revid: qdp@jade-20090114133150-pi18cjb4kh0no10j --- addons/account/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 6dd6ee1ccee..f6cccdcf2f0 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -182,7 +182,7 @@ class account_invoice(osv.osv): 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]} ), - 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done'), 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."), 'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}), From 37323b62a771901f7092383cc35a05f364379364 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:33:59 +0100 Subject: [PATCH 07/16] [FIX] added domain=[('type','<>','view')] on accounts of fiscal_position and fiscal_position templates lp bug: https://launchpad.net/bugs/315443 fixed bzr revid: qdp@jade-20090114133359-muarqlhiiy6ne3f9 --- addons/account/account.py | 4 ++-- addons/account/partner.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 9ae28c4ab1f..790d9adc15c 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1901,8 +1901,8 @@ class account_fiscal_position_account_template(osv.osv): _rec_name = 'position_id' _columns = { '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_dest_id': fields.many2one('account.account.template', 'Account Destination', 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', domain=[('type','<>','view')], required=True) } account_fiscal_position_account_template() diff --git a/addons/account/partner.py b/addons/account/partner.py index d32a6b785e5..a2e981fb4ab 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -76,8 +76,8 @@ class account_fiscal_position_account(osv.osv): _rec_name = 'position_id' _columns = { '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_dest_id': fields.many2one('account.account', 'Account Destination', 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', domain=[('type','<>','view')], required=True) } account_fiscal_position_account() From 0f9a96368b311e7b34c505f22ca4b0c95d9185e5 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:52:31 +0100 Subject: [PATCH 08/16] [FIX] lp:315471 added readonly="1" on state field of fiscalyear. Use have to go through the wizard for closing fiscal year if they want to change the status lp bug: https://launchpad.net/bugs/315471 fixed bzr revid: qdp@jade-20090114135231-na2gxb55ifavl2l6 --- addons/account/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 2eb2ae92738..600114e90bd 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -28,7 +28,7 @@ - +