From 9180d920aa05a9e1e00796293c91619d649d6afc Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Fri, 28 May 2010 12:01:04 +0530 Subject: [PATCH 01/17] [IMP]:stock,account:rename the buttons name of the SQL reports. bzr revid: apa@tinyerp.com-20100528063104-fwka6w697en3na9n --- .../account/report/account_analytic_entries_report_view.xml | 4 ++-- addons/account/report/account_analytic_report_view.xml | 4 ++-- addons/account/report/account_entries_report_view.xml | 4 ++-- addons/account/report/account_invoice_report_view.xml | 4 ++-- addons/stock/report/report_stock_picking_view.xml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/account/report/account_analytic_entries_report_view.xml b/addons/account/report/account_analytic_entries_report_view.xml index 157a08f8ca5..82a063256c1 100644 --- a/addons/account/report/account_analytic_entries_report_view.xml +++ b/addons/account/report/account_analytic_entries_report_view.xml @@ -35,10 +35,10 @@ - - diff --git a/addons/account/report/account_analytic_report_view.xml b/addons/account/report/account_analytic_report_view.xml index eba69e2785b..f853b809867 100644 --- a/addons/account/report/account_analytic_report_view.xml +++ b/addons/account/report/account_analytic_report_view.xml @@ -36,10 +36,10 @@ - - diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index f61348c290c..5d1b99b578e 100644 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -50,10 +50,10 @@ - - diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 597e5f43675..94f181cd587 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -54,10 +54,10 @@ - - diff --git a/addons/stock/report/report_stock_picking_view.xml b/addons/stock/report/report_stock_picking_view.xml index c343b09931a..e570e2b55ea 100644 --- a/addons/stock/report/report_stock_picking_view.xml +++ b/addons/stock/report/report_stock_picking_view.xml @@ -54,10 +54,10 @@ - - From 948c9e8ae2fe92369cc247a65a02142ea0ab3a38 Mon Sep 17 00:00:00 2001 From: "ssi (Open ERP)" Date: Fri, 28 May 2010 12:29:50 +0530 Subject: [PATCH 02/17] [ADD] added new module marketing to manage menus bzr revid: ssi@tinyerp.com-20100528065950-ia7kz041py33m54k --- addons/marketing/__init__.py | 23 +++++++++++++++++ addons/marketing/__openerp__.py | 38 +++++++++++++++++++++++++++++ addons/marketing/marketing_view.xml | 6 +++++ 3 files changed, 67 insertions(+) create mode 100644 addons/marketing/__init__.py create mode 100644 addons/marketing/__openerp__.py create mode 100644 addons/marketing/marketing_view.xml diff --git a/addons/marketing/__init__.py b/addons/marketing/__init__.py new file mode 100644 index 00000000000..2aefd8b3c11 --- /dev/null +++ b/addons/marketing/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/marketing/__openerp__.py b/addons/marketing/__openerp__.py new file mode 100644 index 00000000000..36cec655d15 --- /dev/null +++ b/addons/marketing/__openerp__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + "name" : "Marketing", + "version" : "1.1", + "depends" : ["base"], + "author" : "Tiny", + "category": 'Generic Modules/Marketing', + "description": "Menu for Marketing", + 'website': 'http://www.openerp.com', + 'init_xml': [], + 'demo_xml':[], + 'update_xml': ['marketing_view.xml'], + 'demo_xml': [], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/marketing/marketing_view.xml b/addons/marketing/marketing_view.xml new file mode 100644 index 00000000000..b920ce369fc --- /dev/null +++ b/addons/marketing/marketing_view.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From e74b683ab5101ce1e495e097e6cfd87129a8eba5 Mon Sep 17 00:00:00 2001 From: "ssi (Open ERP)" Date: Fri, 28 May 2010 12:54:14 +0530 Subject: [PATCH 03/17] [IMP] marketing_campaign: modified menus and dependency bzr revid: ssi@tinyerp.com-20100528072414-8uatbvbl7g3rlrj4 --- addons/marketing_campaign/__openerp__.py | 5 ++++- addons/marketing_campaign/marketing_campaign_view.xml | 11 ++++++----- .../report/campaign_analysis_view.xml | 7 ++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/addons/marketing_campaign/__openerp__.py b/addons/marketing_campaign/__openerp__.py index 9a10fdbaa3d..ad91466817c 100755 --- a/addons/marketing_campaign/__openerp__.py +++ b/addons/marketing_campaign/__openerp__.py @@ -23,7 +23,8 @@ { "name" : "", "version" : "1.1", - "depends" : ["crm", + "depends" : ["marketing", + "crm", "document", "poweremail" # need to get this module form the branch # lp:poweremail @@ -34,11 +35,13 @@ """, 'website': 'http://www.openerp.com', 'init_xml': [], + 'demo_xml':[], 'update_xml': [ 'marketing_campaign_view.xml', 'marketing_campaign_data.xml', 'marketing_campaign_workflow.xml', 'report/campaign_analysis_view.xml', + 'marketing_campaign_demo.xml' ], 'demo_xml': [ 'marketing_campaign_demo.xml', diff --git a/addons/marketing_campaign/marketing_campaign_view.xml b/addons/marketing_campaign/marketing_campaign_view.xml index 5a7f8529cc0..fb88b6d283d 100755 --- a/addons/marketing_campaign/marketing_campaign_view.xml +++ b/addons/marketing_campaign/marketing_campaign_view.xml @@ -1,7 +1,7 @@ - + + + + + 0.631 + + + 0.632 + + + diff --git a/bin/import_xml.rng b/bin/import_xml.rng index e139238acfe..3a698f4a897 100644 --- a/bin/import_xml.rng +++ b/bin/import_xml.rng @@ -32,6 +32,7 @@ + @@ -51,6 +52,7 @@ + @@ -70,6 +72,7 @@ + @@ -205,6 +208,7 @@ + From 74cf00b2fd67da53e0b9e77a8df838915f139d86 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 31 May 2010 16:05:12 +0200 Subject: [PATCH 12/17] [BACKPORT] manual backport of fix for lp:541545 (http://bazaar.launchpad.net/~openerp/openobject-server/5.0/revision/chs@openerp.com-20100503080227-nrn21og1yd4bmy2l) lp bug: https://launchpad.net/bugs/541545 fixed bzr revid: chs@openerp.com-20100531140512-610lbks7cnwa6m8w --- bin/addons/base/__openerp__.py | 1 + bin/addons/base/test/bug_lp541545.xml | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 bin/addons/base/test/bug_lp541545.xml diff --git a/bin/addons/base/__openerp__.py b/bin/addons/base/__openerp__.py index 827ac3263ae..8685bf6c342 100644 --- a/bin/addons/base/__openerp__.py +++ b/bin/addons/base/__openerp__.py @@ -74,6 +74,7 @@ 'test': [ 'test/base_test.xml', 'test/test_context.xml', + 'bug_lp541545.xml', ], 'installable': True, 'active': True, diff --git a/bin/addons/base/test/bug_lp541545.xml b/bin/addons/base/test/bug_lp541545.xml new file mode 100644 index 00000000000..4c1df7a0383 --- /dev/null +++ b/bin/addons/base/test/bug_lp541545.xml @@ -0,0 +1,14 @@ + + + + + + + + + + From c11f53d6951e766890569e402ef18d18aaf50e50 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 31 May 2010 11:39:13 +0200 Subject: [PATCH 13/17] [IMP] tools: find_in_path: use which (file found on python bug tracker) bzr revid: chs@openerp.com-20100531093913-mn98pno6srb74v27 --- bin/tools/misc.py | 26 ++++---- bin/tools/which.py | 153 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 14 deletions(-) create mode 100644 bin/tools/which.py diff --git a/bin/tools/misc.py b/bin/tools/misc.py index e60213ca740..1594ca5bd6a 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -3,6 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). +# Copyright (C) 2010 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -34,6 +35,7 @@ import socket import re from itertools import islice import threading +from which import which if sys.version_info[:2] < (2, 4): @@ -112,23 +114,19 @@ def init_db(cr): cr.commit() def find_in_path(name): - if os.name == "nt": - sep = ';' - else: - sep = ':' - path = [dir for dir in os.environ['PATH'].split(sep) - if os.path.isdir(dir)] - for dir in path: - val = os.path.join(dir, name) - if os.path.isfile(val) or os.path.islink(val): - return val - return None + try: + return which(name) + except IOError: + return None def find_pg_tool(name): + path = None if config['pg_path'] and config['pg_path'] != 'None': - return os.path.join(config['pg_path'], name) - else: - return find_in_path(name) + path = config['pg_path'] + try: + return which(name, path=path) + except IOError: + return None def exec_pg_command(name, *args): prog = find_pg_tool(name) diff --git a/bin/tools/which.py b/bin/tools/which.py new file mode 100644 index 00000000000..66b264bddec --- /dev/null +++ b/bin/tools/which.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +""" Which - locate a command + + * adapted from Brian Curtin's http://bugs.python.org/file15381/shutil_which.patch + * see http://bugs.python.org/issue444582 + * uses ``PATHEXT`` on Windows + * searches current directory before ``PATH`` on Windows, + but not before an explicitly passed path + * accepts both string or iterable for an explicitly passed path, or pathext + * accepts an explicitly passed empty path, or pathext (either '' or []) + * does not search ``PATH`` for files that have a path specified in their name already + * moved defpath and defpathext lists initialization to module level, + instead of initializing them on each function call + * changed interface: which_files() returns generator, which() returns first match, + or raises IOError(errno.ENOENT) + + .. function:: which_files(file [, mode=os.F_OK | os.X_OK[, path=None[, pathext=None]]]) + + Return a generator which yields full paths in which the *file* name exists + in a directory that is part of the file name, or on *path*, + and has the given *mode*. + By default, *mode* matches an inclusive OR of os.F_OK and os.X_OK + - an existing executable file. + The *path* is, by default, the ``PATH`` variable on the platform, + or the string/iterable passed in as *path*. + In the event that a ``PATH`` variable is not found, :const:`os.defpath` is used. + On Windows, a current directory is searched before using the ``PATH`` variable, + but not before an explicitly passed *path*. + The *pathext* is only used on Windows to match files with given extensions appended as well. + It defaults to the ``PATHEXT`` variable, or the string/iterable passed in as *pathext*. + In the event that a ``PATHEXT`` variable is not found, + default value for Windows XP/Vista is used. + The command is always searched without extension first, + even when *pathext* is explicitly passed. + + .. function:: which(file [, mode=os.F_OK | os.X_OK[, path=None[, pathext=None]]]) + Return first match generated by which_files(file, mode, path, pathext), + or raise IOError(errno.ENOENT). + +""" +__docformat__ = 'restructuredtext en' +__all__ = 'which which_files pathsep defpath defpathext F_OK R_OK W_OK X_OK'.split() + +import sys +from os import access, defpath, pathsep, environ, F_OK, R_OK, W_OK, X_OK +from os.path import exists, dirname, split, join + +windows = sys.platform.startswith('win') + +defpath = environ.get('PATH', defpath).split(pathsep) + +if windows: + defpath.insert(0, '.') # can insert without checking, when duplicates are removed + # given the quite usual mess in PATH on Windows, let's rather remove duplicates + seen = set() + defpath = [dir for dir in defpath if dir.lower() not in seen and not seen.add(dir.lower())] + del seen + + defpathext = [''] + environ.get('PATHEXT', + '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC').lower().split(pathsep) +else: + defpathext = [''] + +def which_files(file, mode=F_OK | X_OK, path=None, pathext=None): + """ Locate a file in a path supplied as a part of the file name, + or the user's path, or a supplied path. + The function yields full paths (not necessarily absolute paths), + in which the given file name matches an existing file in a directory on the path. + + >>> def test_which(expected, *args, **argd): + ... result = list(which_files(*args, **argd)) + ... assert result == expected, 'which_files: %s != %s' % (result, expected) + ... + ... try: + ... result = [ which(*args, **argd) ] + ... except IOError: + ... result = [] + ... assert result[:1] == expected[:1], 'which: %s != %s' % (result[:1], expected[:1]) + + >>> if windows: cmd = environ['COMSPEC'] + >>> if windows: test_which([cmd], 'cmd') + >>> if windows: test_which([cmd], 'cmd.exe') + >>> if windows: test_which([cmd], 'cmd', path=dirname(cmd)) + >>> if windows: test_which([cmd], 'cmd', pathext='.exe') + >>> if windows: test_which([cmd], cmd) + >>> if windows: test_which([cmd], cmd, path='') + >>> if windows: test_which([cmd], cmd, pathext='') + >>> if windows: test_which([cmd], cmd[:-4]) + >>> if windows: test_which([cmd], cmd[:-4], path='') + + >>> if windows: test_which([], 'cmd', path='') + >>> if windows: test_which([], 'cmd', pathext='') + >>> if windows: test_which([], '/cmd') + >>> if windows: test_which([], cmd[:-4], pathext='') + + >>> if not windows: sh = '/bin/sh' + >>> if not windows: test_which([sh], 'sh') + >>> if not windows: test_which([sh], 'sh', path=dirname(sh)) + >>> if not windows: test_which([sh], 'sh', pathext='') + >>> if not windows: test_which([sh], sh) + >>> if not windows: test_which([sh], sh, path='') + >>> if not windows: test_which([sh], sh, pathext='') + + >>> if not windows: test_which([], 'sh', mode=W_OK) # not running as root, are you? + >>> if not windows: test_which([], 'sh', path='') + >>> if not windows: test_which([], '/sh') + """ + filepath, file = split(file) + + if filepath: + path = (filepath,) + elif path is None: + path = defpath + elif isinstance(path, str): + path = path.split(pathsep) + + if pathext is None: + pathext = defpathext + elif isinstance(pathext, str): + pathext = pathext.split(pathsep) + + if not '' in pathext: + pathext.insert(0, '') # always check command without extension, even for custom pathext + + for dir in path: + basepath = join(dir, file) + for ext in pathext: + fullpath = basepath + ext + if exists(fullpath) and access(fullpath, mode): + yield fullpath + +def which(file, mode=F_OK | X_OK, path=None, pathext=None): + """ Locate a file in a path supplied as a part of the file name, + or the user's path, or a supplied path. + The function returns full path (not necessarily absolute path), + in which the given file name matches an existing file in a directory on the path, + or raises IOError(errno.ENOENT). + + >>> # for doctest see which_files() + """ + try: + return iter(which_files(file, mode, path, pathext)).next() + except StopIteration: + try: + from errno import ENOENT + except ImportError: + ENOENT = 2 + raise IOError(ENOENT, '%s not found' % (mode & X_OK and 'command' or 'file'), file) + + +if __name__ == '__main__': + import doctest + doctest.testmod() From 04a13826a0ecd4fb2a713c4b2050e5d4d4d4c507 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 31 May 2010 11:42:39 +0200 Subject: [PATCH 14/17] [IMP] allow to specify external dependencies into __openerp__.py file bzr revid: chs@openerp.com-20100531094239-ci0wprefy9xy41nj --- bin/addons/base/module/module.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 1f5f2393c19..2372a09405f 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -23,6 +23,7 @@ import tarfile import re import urllib import os +import imp import tools from osv import fields, osv, orm import zipfile @@ -191,6 +192,27 @@ class module(osv.osv): return super(module, self).unlink(cr, uid, ids, context=context) + @staticmethod + def _check_external_dependencies(terp): + depends = terp.get('external_dependencies') + if not depends: + return + for pydep in depends.get('python', []): + parts = pydep.split('.') + parts.reverse() + path = None + while parts: + part = parts.pop() + try: + f, path, descr = imp.find_module(part, path and [path] or None) + except ImportError: + raise ImportError('No module named %s' % (pydep,)) + + for binary in depends.get('bin', []): + if tools.find_in_path(binary) is None: + raise Exception('Unable to find %r in path' % (binary,)) + + def state_update(self, cr, uid, ids, newstate, states_to_update, context={}, level=100): if level<1: raise orm.except_orm(_('Error'), _('Recursion error in modules dependencies !')) @@ -206,6 +228,11 @@ class module(osv.osv): else: od = self.browse(cr, uid, ids2)[0] mdemo = od.demo or mdemo + terp = self.get_module_info(module.name) + try: + self._check_external_dependencies(terp) + except Exception, e: + raise orm.except_orm(_('Error'), _('Unable %s the module "%s" because an external dependencie is not met: %s' % (newstate, module.name, e.args[0]))) if not module.dependencies_id: mdemo = module.demo if module.state in states_to_update: From 2f3c27b63171cfad9c74459602df3e5805baa6ed Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Sun, 16 May 2010 18:27:41 +0200 Subject: [PATCH 15/17] [IMP] __openerp__.py can now contain maitainer and contribors bzr revid: chs@openerp.com-20100516162741-5qwvadhq07bdt1be --- bin/addons/__init__.py | 10 +--- bin/addons/base/__openerp__.py | 4 +- bin/addons/base/module/module.py | 64 +++++++++++------------- bin/addons/base/module/module_view.xml | 16 ++++-- bin/addons/base/module/wizard/add_new.py | 11 ++-- 5 files changed, 50 insertions(+), 55 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index e0073d3f123..ac8e951e2a3 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -3,6 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). +# Copyright (C) 2010 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -716,14 +717,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): for kind in ('init', 'update'): if package.state=='to upgrade': # upgrading the module information - modobj.write(cr, 1, [mid], { - 'description': package.data.get('description', ''), - 'shortdesc': package.data.get('name', ''), - 'author': package.data.get('author', 'Unknown'), - 'website': package.data.get('website', ''), - 'license': package.data.get('license', 'GPL-2'), - 'certificate': package.data.get('certificate') or None, - }) + modobj.write(cr, 1, [mid], modobj.get_values_from_terp(package.data)) load_init_update_xml(cr, m, idref, mode, kind) load_data(cr, m, idref, mode) if hasattr(package, 'demo') or (package.dbdemo and package.state != 'installed'): diff --git a/bin/addons/base/__openerp__.py b/bin/addons/base/__openerp__.py index 8685bf6c342..2308ecfccc8 100644 --- a/bin/addons/base/__openerp__.py +++ b/bin/addons/base/__openerp__.py @@ -3,6 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). +# Copyright (C) 2010 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -25,7 +26,8 @@ 'version': '1.2', 'category': 'Generic Modules/Base', 'description': """The kernel of OpenERP, needed for all installation.""", - 'author': 'Tiny', + 'author': 'OpenERP s.a.', + 'maintainer': 'OpenERP s.a.', 'website': 'http://www.openerp.com', 'depends': [], 'init_xml': [ diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 2372a09405f..5bc12432d4e 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -3,6 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). +# Copyright (C) 2010 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -123,6 +124,8 @@ class module(osv.osv): 'shortdesc': fields.char('Short Description', size=256, readonly=True, translate=True), 'description': fields.text("Description", readonly=True, translate=True), 'author': fields.char("Author", size=128, readonly=True), + 'maintainer': fields.char('Maintainer', size=128, readonly=True), + 'contributors': fields.text('Contributors', readonly=True), 'website': fields.char("Website", size=256, readonly=True), # attention: Incorrect field names !! @@ -306,6 +309,19 @@ class module(osv.osv): self.update_translations(cr, uid, ids) return True + @staticmethod + def get_values_from_terp(terp): + return { + 'description': terp.get('description', ''), + 'shortdesc': terp.get('name', ''), + 'author': terp.get('author', 'Unknown'), + 'maintainer': terp.get('maintainer', False), + 'contributors': ', '.join(terp.get('contributors', [])), + 'website': terp.get('website', ''), + 'license': terp.get('license', 'GPL-2'), + 'certificate': terp.get('certificate') or None, + } + # update the list of available packages def update_list(self, cr, uid, context={}): res = [0, 0] # [update, add] @@ -313,46 +329,31 @@ class module(osv.osv): # iterate through installed modules and mark them as being so for mod_name in addons.get_modules(): ids = self.search(cr, uid, [('name','=',mod_name)]) + + terp = self.get_module_info(mod_name) + values = self.get_values_from_terp(terp) + if ids: id = ids[0] mod = self.browse(cr, uid, id) - terp = self.get_module_info(mod_name) if terp.get('installable', True) and mod.state == 'uninstallable': self.write(cr, uid, id, {'state': 'uninstalled'}) if parse_version(terp.get('version', '')) > parse_version(mod.latest_version or ''): self.write(cr, uid, id, { 'url': ''}) res[0] += 1 - self.write(cr, uid, id, { - 'description': terp.get('description', ''), - 'shortdesc': terp.get('name', ''), - 'author': terp.get('author', 'Unknown'), - 'website': terp.get('website', ''), - 'license': terp.get('license', 'GPL-2'), - 'certificate': terp.get('certificate') or None, - }) + self.write(cr, uid, id, values) cr.execute('DELETE FROM ir_module_module_dependency WHERE module_id = %s', (id,)) - self._update_dependencies(cr, uid, ids[0], terp.get('depends', [])) - self._update_category(cr, uid, ids[0], terp.get('category', 'Uncategorized')) - continue - mod_path = addons.get_module_path(mod_name) - if mod_path: - terp = self.get_module_info(mod_name) + else: + mod_path = addons.get_module_path(mod_name) + if not mod_path: + continue if not terp or not terp.get('installable', True): continue - id = self.create(cr, uid, { - 'name': mod_name, - 'state': 'uninstalled', - 'description': terp.get('description', ''), - 'shortdesc': terp.get('name', ''), - 'author': terp.get('author', 'Unknown'), - 'website': terp.get('website', ''), - 'license': terp.get('license', 'GPL-2'), - 'certificate': terp.get('certificate') or None, - }) + id = self.create(cr, uid, dict(name=mod_name, state='uninstalled', **values)) res[1] += 1 - self._update_dependencies(cr, uid, id, terp.get('depends', [])) - self._update_category(cr, uid, id, terp.get('category', 'Uncategorized')) + self._update_dependencies(cr, uid, id, terp.get('depends', [])) + self._update_category(cr, uid, id, terp.get('category', 'Uncategorized')) return res @@ -379,14 +380,7 @@ class module(osv.osv): except Exception, e: raise orm.except_orm(_('Error'), _('Can not create the module file:\n %s') % (fname,)) terp = self.get_module_info(mod.name) - self.write(cr, uid, mod.id, { - 'description': terp.get('description', ''), - 'shortdesc': terp.get('name', ''), - 'author': terp.get('author', 'Unknown'), - 'website': terp.get('website', ''), - 'license': terp.get('license', 'GPL-2'), - 'certificate': terp.get('certificate') or None, - }) + self.write(cr, uid, mod.id, self.get_values_from_terp(terp)) cr.execute('DELETE FROM ir_module_module_dependency ' \ 'WHERE module_id = %s', (mod.id,)) self._update_dependencies(cr, uid, mod.id, terp.get('depends', diff --git a/bin/addons/base/module/module_view.xml b/bin/addons/base/module/module_view.xml index cd57b59023c..5a64360b01d 100644 --- a/bin/addons/base/module/module_view.xml +++ b/bin/addons/base/module/module_view.xml @@ -95,10 +95,16 @@ - - - - + + + + + + + + + + @@ -141,6 +147,8 @@ + + diff --git a/bin/addons/base/module/wizard/add_new.py b/bin/addons/base/module/wizard/add_new.py index 0e2028e7624..c6eddab2adb 100644 --- a/bin/addons/base/module/wizard/add_new.py +++ b/bin/addons/base/module/wizard/add_new.py @@ -3,6 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). +# Copyright (C) 2010 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -56,7 +57,7 @@ class wizard_install_module(wizard.interface): terp = mod_obj.get_module_info(module) if not terp.get('installable', True): continue - + # XXX check if this code is correct... fm = imp.find_module(module) try: @@ -65,12 +66,8 @@ class wizard_install_module(wizard.interface): if fm[0]: fm[0].close() - mod_id = mod_obj.create(cr, uid, { - 'name': module, - 'state': 'uninstalled', - 'description': terp.get('description', ''), - 'shortdesc': terp.get('name', ''), - 'author': terp.get('author', 'Unknown')}) + values = mod_obj.get_values_from_terp(terp) + mod_id = mod_obj.create(cr, uid, dict(name=module, state='uninstalled', **values)) dependencies = terp.get('depends', []) for d in dependencies: cr.execute('insert into ir_module_module_dependency (module_id,name) values (%s, %s)', (mod_id, d)) From 758d2f103f9c6c7cc9ce4b476b8b8e76fca62a1e Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 31 May 2010 14:19:18 +0200 Subject: [PATCH 16/17] [IMP] base: correct module view bzr revid: chs@openerp.com-20100531121918-i1eet6uw5w7xut5a --- bin/addons/base/module/module.py | 2 +- bin/addons/base/module/module_view.xml | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 5bc12432d4e..e29e95bf68f 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -316,7 +316,7 @@ class module(osv.osv): 'shortdesc': terp.get('name', ''), 'author': terp.get('author', 'Unknown'), 'maintainer': terp.get('maintainer', False), - 'contributors': ', '.join(terp.get('contributors', [])), + 'contributors': ', '.join(terp.get('contributors', [])) or False, 'website': terp.get('website', ''), 'license': terp.get('license', 'GPL-2'), 'certificate': terp.get('certificate') or None, diff --git a/bin/addons/base/module/module_view.xml b/bin/addons/base/module/module_view.xml index 5a64360b01d..63484b97d43 100644 --- a/bin/addons/base/module/module_view.xml +++ b/bin/addons/base/module/module_view.xml @@ -95,16 +95,12 @@ - - - - - - - - - - + + + + + + From 4bd5550e21ac7f767660d721d5bdcfa3a970e7e2 Mon Sep 17 00:00:00 2001 From: Christophe Simonis <> Date: Mon, 31 May 2010 17:05:17 +0200 Subject: [PATCH 17/17] [FIX] Fixed sql generation bug when the domain ranges on the grandparent's fields of an "inherits" hierarchy. bzr revid: jth@openerp.com-20100531150517-6q2u5ou30lfe2lqt --- bin/osv/expression.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/osv/expression.py b/bin/osv/expression.py index 2ca19bbf418..4da2a70528a 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -71,7 +71,8 @@ class expression(object): if not reduce(lambda acc, val: acc and (self._is_operator(val) or self._is_leaf(val)), exp, True): raise ValueError('Bad domain expression: %r' % (exp,)) self.__exp = exp - self.__tables = {} # used to store the table to use for the sql generation. key = index of the leaf + self.__field_tables = {} # used to store the table to use for the sql generation. key = index of the leaf + self.__all_tables = set() self.__joins = [] self.__main_table = None # 'root' table. set by parse() self.__DUMMY_LEAF = (1, '=', 1) # a dummy leaf that must not be parsed or sql generated @@ -103,6 +104,7 @@ class expression(object): return [(left, 'in', rg(ids, table, parent or table._parent_name))] self.__main_table = table + self.__all_tables.add(table) i = -1 while i + 1