From d8ea3c99d9bb33606c24b943e5df6bdd0f7f84b5 Mon Sep 17 00:00:00 2001 From: "hda@tinyerp.com" <> Date: Fri, 24 Oct 2008 16:11:31 +0530 Subject: Added fearutes tab in module bzr revid: hda@tinyerp.com-20081024104131-zirn6p2mu806a1o6 --- bin/addons/base/module/module.py | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 836a6a3ed7d..ff821818144 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -219,6 +219,65 @@ class module(osv.osv): res[m.id] = '' return res + def _get_menus(self, cr, uid, ids, field_name=None, arg=None, context={}): + res = {} + model_data_obj = self.pool.get('ir.model.data') + menu_obj = self.pool.get('ir.ui.menu') + for m in self.browse(cr, uid, ids): + if m.state == 'installed': + menu_txt = '' + menus_id = model_data_obj.search(cr,uid,[('module','=',m.name),('model','=','ir.ui.menu')]) + for data_id in model_data_obj.browse(cr,uid,menus_id): + menu_txt += menu_obj.browse(cr,uid,data_id.res_id).complete_name + '\n' + res[m.id] = menu_txt + else: + res[m.id] = '' + return res + + def _get_reports(self, cr, uid, ids, field_name=None, arg=None, context={}): + res = {} + model_data_obj = self.pool.get('ir.model.data') + report_obj = self.pool.get('ir.actions.report.xml') + for m in self.browse(cr, uid, ids): + if m.state == 'installed': + report_txt = '' + report_id = model_data_obj.search(cr,uid,[('module','=',m.name),('model','=','ir.actions.report.xml')]) + for data_id in model_data_obj.browse(cr,uid,report_id): + report_txt += report_obj.browse(cr,uid,data_id.res_id).name + '\n' + res[m.id] = report_txt + else: + res[m.id] = '' + return res + + def _get_views(self, cr, uid, ids, field_name=None, arg=None, context={}): + res = {} + model_data_obj = self.pool.get('ir.model.data') + view_obj = self.pool.get('ir.ui.view') + for m in self.browse(cr, uid, ids): + if m.state == 'installed': + view_txt = '' + view_id = model_data_obj.search(cr,uid,[('module','=',m.name),('model','=','ir.ui.view')]) + for data_id in model_data_obj.browse(cr,uid,view_id): + view_txt += view_obj.browse(cr,uid,data_id.res_id).name + '\n' + res[m.id] = view_txt + else: + res[m.id] = '' + return res + + def _get_objects(self, cr, uid, ids, field_name=None, arg=None, context={}): + res = {} + model_data_obj=self.pool.get('ir.model.data') + for m in self.browse(cr, uid, ids): + if m.state=='installed': + cr.execute('''select distinct model from ir_model_data where module = '%s' '''%(m.name)) + objects = cr.fetchall() + obj_lst=map(lambda x:x[0],objects) + res[m.id] = '\n'.join(obj_lst) + else: + res[m.id] = '' + return res + + _columns = { 'name': fields.char("Name", size=128, readonly=True, required=True), 'category_id': fields.many2one('ir.module.category', 'Category', readonly=True), @@ -245,6 +304,10 @@ class module(osv.osv): 'license': fields.selection([('GPL-2', 'GPL-2'),('GPL-3', 'GPL-3'), ('Other proprietary', 'Other proprietary')], string='License', readonly=True), + 'menus_by_module': fields.function(_get_menus, method=True, string='Menus', type='text'), + 'reports_by_module': fields.function(_get_reports, method=True, string='Reports', type='text'), + 'views_by_module': fields.function(_get_views, method=True, string='Views', type='text'), + 'objects_by_module': fields.function(_get_objects, method=True, string='Objects', type='text'), } _defaults = { -- cgit v1.2.3 From be2fe6fe1e93d1d5217b978798c8db8ac0075066 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 24 Oct 2008 17:07:43 +0200 Subject: fix bug with language update when upgrading a module + PEP8 bzr revid: christophe@tinyerp.com-20081024150743-4u8iolu21xhi0a2r --- bin/addons/base/module/module.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index ff821818144..c581ee1620d 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -604,9 +604,9 @@ class module(osv.osv): if not filter_lang: pool = pooler.get_pool(cr.dbname) - lang_obj=pool.get('res.lang') - lang_ids=lang_obj.search(cr, uid, [('translatable', '=', True)]) - filter_lang= [lang.code for lang in lang_obj.browse(cr, uid, lang_ids)] + lang_obj = pool.get('res.lang') + lang_ids = lang_obj.search(cr, uid, [('translatable', '=', True)]) + filter_lang = [lang.code for lang in lang_obj.browse(cr, uid, lang_ids)] elif not isinstance(filter_lang, (list, tuple)): filter_lang = [filter_lang] @@ -617,7 +617,7 @@ class module(osv.osv): for lang in filter_lang: f = os.path.join(tools.config['addons_path'], mod.name, 'i18n', lang + '.po') if os.path.exists(f): - logger.notifyChannel("init", netsvc.LOG_INFO, 'addons %s: loading translation file for language %s' % (mod.name, lang)) + logger.notifyChannel("init", netsvc.LOG_INFO, 'addon %s: loading translation file for language %s' % (mod.name, lang)) tools.trans_load(cr.dbname, f, lang, verbose=False) module() -- cgit v1.2.3 From d5e50a5159409c248d00233708b75e932054fc6b Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 25 Oct 2008 10:53:56 +0200 Subject: improvement bzr revid: fp@tinyerp.com-20081025085356-9ezz9r2qj6q52a3r --- bin/addons/base/module/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index c581ee1620d..e3793a298d6 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -373,7 +373,7 @@ class module(osv.osv): m.state not in ('uninstalled','uninstallable','to remove')''', (module.name,)) res = cr.fetchall() if res: - raise orm.except_orm(_('Error'), _('The module you are trying to remove depends on installed modules :\n %s') % '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res))) + raise orm.except_orm(_('Error'), _('Some installed modules depends on the module you plan to desinstall :\n %s') % '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res))) self.write(cr, uid, ids, {'state': 'to remove'}) return True -- cgit v1.2.3 From 41c89fa5f3693823301d9e2a88cfee817ec0deee Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 28 Oct 2008 10:48:51 +0100 Subject: bugfix with boken addons symlinks bzr revid: chs@tinyerp.com-20081028094851-v7cpms0hnozu0fin --- bin/addons/base/module/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index e3793a298d6..27f390a3bd1 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -443,7 +443,7 @@ class module(osv.osv): continue terp_file = addons.get_module_resource(name, '__terp__.py') mod_path = addons.get_module_path(name) - if os.path.isdir(mod_path) or os.path.islink(mod_path) or zipfile.is_zipfile(mod_path): + if mod_path and (os.path.isdir(mod_path) or os.path.islink(mod_path) or zipfile.is_zipfile(mod_path)): terp = self.get_module_info(mod_name) if not terp or not terp.get('installable', True): continue -- cgit v1.2.3 From 97e080c4484a56e31a92a7017c4d3e677a5a388d Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 29 Oct 2008 00:15:42 +0100 Subject: module_layout_print_report bzr revid: fp@tinyerp.com-20081028231542-i0z2xm40d507le8o --- bin/addons/base/module/module.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 27f390a3bd1..323e032784f 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -591,10 +591,12 @@ class module(osv.osv): self.write(cr, uid, [id], {'category_id': p_id}) def action_install(self,cr,uid,ids,context=None): - self.write(cr , uid, ids ,{'state' : 'to install'}) - self.download(cr, uid, ids, context=context) - for id in ids: - cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%d and m.state='uninstalled'",(id,)) + for module in self.browse(cr, uid, ids, context): + if module.state <> 'uninstalled': + continue + self.write(cr , uid, [module.id] ,{'state' : 'to install'}) + self.download(cr, uid, [module.id], context=context) + cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%d and m.state='uninstalled'",(module.id,)) dep_ids = map(lambda x:x[0],cr.fetchall()) if len(dep_ids): self.action_install(cr,uid,dep_ids,context=context) -- cgit v1.2.3 From 95ed4f39ad9bf4b9ddfbb46b2b334cba06666747 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Thu, 30 Oct 2008 08:56:24 +0100 Subject: improved_views bzr revid: fp@tinyerp.com-20081030075624-q47d58h8btqcvr8i --- bin/addons/base/module/module.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 323e032784f..03cad192bff 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -253,7 +253,7 @@ class module(osv.osv): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') - for m in self.browse(cr, uid, ids): + for m in self.browse(cr, uid, ids, context=context): if m.state == 'installed': view_txt = '' view_id = model_data_obj.search(cr,uid,[('module','=',m.name),('model','=','ir.ui.view')]) @@ -264,20 +264,6 @@ class module(osv.osv): res[m.id] = '' return res - def _get_objects(self, cr, uid, ids, field_name=None, arg=None, context={}): - res = {} - model_data_obj=self.pool.get('ir.model.data') - for m in self.browse(cr, uid, ids): - if m.state=='installed': - cr.execute('''select distinct model from ir_model_data where module = '%s' '''%(m.name)) - objects = cr.fetchall() - obj_lst=map(lambda x:x[0],objects) - res[m.id] = '\n'.join(obj_lst) - else: - res[m.id] = '' - return res - - _columns = { 'name': fields.char("Name", size=128, readonly=True, required=True), 'category_id': fields.many2one('ir.module.category', 'Category', readonly=True), @@ -307,7 +293,6 @@ class module(osv.osv): 'menus_by_module': fields.function(_get_menus, method=True, string='Menus', type='text'), 'reports_by_module': fields.function(_get_reports, method=True, string='Reports', type='text'), 'views_by_module': fields.function(_get_views, method=True, string='Views', type='text'), - 'objects_by_module': fields.function(_get_objects, method=True, string='Objects', type='text'), } _defaults = { -- cgit v1.2.3 From c619a6fdec91c7279760daf9254518c50022e7e0 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 3 Nov 2008 19:19:28 +0100 Subject: allow more specific gpl licencing of modules bzr revid: christophe@tinyerp.com-20081103181928-kgx86tqic4oum6l7 --- bin/addons/base/module/module.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 03cad192bff..c4cfc98c59e 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -287,9 +287,13 @@ class module(osv.osv): ('to install','To be installed') ], string='State', readonly=True), 'demo': fields.boolean('Demo data'), - 'license': fields.selection([('GPL-2', 'GPL-2'),('GPL-3', 'GPL-3'), - ('Other proprietary', 'Other proprietary')], string='License', - readonly=True), + 'license': fields.selection([ + ('GPL-2', 'GPL-2'), + ('GPL-2 or any later version', 'GPL-2 or later version'), + ('GPL-3', 'GPL-3'), + ('GPL-3 or any later version', 'GPL-3 or later version'), + ('Other proprietary', 'Other proprietary') + ], string='License', readonly=True), 'menus_by_module': fields.function(_get_menus, method=True, string='Menus', type='text'), 'reports_by_module': fields.function(_get_reports, method=True, string='Reports', type='text'), 'views_by_module': fields.function(_get_views, method=True, string='Views', type='text'), -- cgit v1.2.3 From e404e54e38c3771b0b103a1d0f94cc157ff9987a Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 3 Nov 2008 19:27:16 +0100 Subject: passing in GPL-3 bzr revid: christophe@tinyerp.com-20081103182716-6c6xyeewubx4uas0 --- bin/addons/base/module/module.py | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index c4cfc98c59e..579231724b2 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -1,30 +1,22 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved +# $Id$ # -# $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. # -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability of assessing all potential -# consequences resulting from its eventual inadequacies and bugs -# End users who are looking for a ready-to-use solution with commercial -# garantees and support are strongly adviced to contract a Free Software -# Service Company +# 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. # -# 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 2 -# 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # ############################################################################## -- cgit v1.2.3