From 8af368159be801f5ee24d8be8fdcad7025688cae Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 21 Sep 2010 16:04:57 +0200 Subject: [PATCH 01/94] [IMP] addons.init: avoid spurious warnings during validation of -i / -u server parameters Includes revert of revision 2111.5.24 rvo@tinyerp.co.in-20100503134414-ma87k4htpifi00tz bzr revid: odo@openerp.com-20100921140457-cwhl843wz86nfmm8 --- bin/addons/__init__.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index cc3bdc2ce7b..3e062563dd5 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -757,16 +757,19 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): return has_updates +def _check_module_names(cr, module_names): + mod_names = set(module_names) + if 'base' in mod_names: + # ignore dummy 'all' module + mod_names.remove('all') + cr.execute("SELECT count(id) AS count FROM ir_module_module WHERE name in %s", (tuple(mod_names),)) + if cr.dictfetchone()['count'] != len(mod_names): + # find out what module name(s) are incorrect: + cr.execute("SELECT name FROM ir_module_module") + incorrect_names = mod_names.difference([x['name'] for x in cr.dictfetchall()]) + logging.getLogger('init').warning('invalid module names, ignored: %s', ", ".join(incorrect_names)) + def load_modules(db, force_demo=False, status=None, update_module=False): - - def check_module_name(cr, mods, state): - for mod in mods: - id = modobj.search(cr, 1, ['&', ('state', '=', state), ('name', '=', mod)]) - if id: - getattr(modobj, states[state])(cr, 1, id) - elif mod != 'all': - logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: invalid module name!' % (mod)) - if not status: status = {} cr = db.cursor() @@ -795,16 +798,23 @@ def load_modules(db, force_demo=False, status=None, update_module=False): if update_module: modobj = pool.get('ir.module.module') - states = {'installed': 'button_upgrade', 'uninstalled': 'button_install'} logger.notifyChannel('init', netsvc.LOG_INFO, 'updating modules list') if ('base' in tools.config['init']) or ('base' in tools.config['update']): modobj.update_list(cr, 1) + _check_module_names(cr, itertools.chain(tools.config['init'].keys(), tools.config['update'].keys())) + mods = [k for k in tools.config['init'] if tools.config['init'][k]] - check_module_name(cr, mods, 'uninstalled') + if mods: + ids = modobj.search(cr, 1, ['&', ('state', '=', 'uninstalled'), ('name', 'in', mods)]) + if ids: + modobj.button_install(cr, 1, ids) mods = [k for k in tools.config['update'] if tools.config['update'][k]] - check_module_name(cr, mods, 'installed') + if mods: + ids = modobj.search(cr, 1, ['&', ('state', '=', 'installed'), ('name', 'in', mods)]) + if ids: + modobj.button_upgrade(cr, 1, ids) cr.execute("update ir_module_module set state=%s where name=%s", ('installed', 'base')) From 0b314fd3dd6da4ca55993293d350825d55bd9b86 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 21 Sep 2010 16:25:25 +0200 Subject: [PATCH 02/94] [IMP] addons.init: handle properly empty update/init module spec bzr revid: odo@openerp.com-20100921142525-2vjy7njophpl77bf --- bin/addons/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 3e062563dd5..297cf73c6f4 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -762,12 +762,13 @@ def _check_module_names(cr, module_names): if 'base' in mod_names: # ignore dummy 'all' module mod_names.remove('all') - cr.execute("SELECT count(id) AS count FROM ir_module_module WHERE name in %s", (tuple(mod_names),)) - if cr.dictfetchone()['count'] != len(mod_names): - # find out what module name(s) are incorrect: - cr.execute("SELECT name FROM ir_module_module") - incorrect_names = mod_names.difference([x['name'] for x in cr.dictfetchall()]) - logging.getLogger('init').warning('invalid module names, ignored: %s', ", ".join(incorrect_names)) + if mod_names: + cr.execute("SELECT count(id) AS count FROM ir_module_module WHERE name in %s", (tuple(mod_names),)) + if cr.dictfetchone()['count'] != len(mod_names): + # find out what module name(s) are incorrect: + cr.execute("SELECT name FROM ir_module_module") + incorrect_names = mod_names.difference([x['name'] for x in cr.dictfetchall()]) + logging.getLogger('init').warning('invalid module names, ignored: %s', ", ".join(incorrect_names)) def load_modules(db, force_demo=False, status=None, update_module=False): if not status: From bbc9eba7a0824dafb05832518a4fa3a9117b8b1f Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 21 Sep 2010 17:34:23 +0200 Subject: [PATCH 03/94] [IMP] netsvc.Agent: Agent.runner thread should be marked daemon to be terminated at server exit (harmlessly) Also set a thread name for the runner thread. bzr revid: odo@openerp.com-20100921153423-053knurknw34qj1r --- bin/netsvc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/netsvc.py b/bin/netsvc.py index d29aebd92b5..ce9b35d2a5b 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -352,7 +352,12 @@ class Agent(object): time.sleep(1) time.sleep(60) -threading.Thread(target=Agent.runner).start() +agent_runner = threading.Thread(target=Agent.runner, name="netsvc.Agent.runner") +# the agent runner is a typical daemon thread, that will never quit and must be +# terminated when the main process exits - with no consequence (the processing +# threads it spawns are not marked daemon) +agent_runner.daemon = True +agent_runner.start() import traceback From 1e9167f9a9cf88cef7bcc898c49ce267764d4d3b Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Wed, 22 Sep 2010 11:09:37 +0530 Subject: [PATCH 04/94] [IMP] hr_* : Usability improvements bzr revid: vir@tinyerp.com-20100922053937-5gah2r12uvewy210 --- addons/hr/hr_department_view.xml | 4 ++-- addons/hr/hr_view.xml | 4 ++-- addons/hr_expense/hr_expense.py | 2 +- addons/hr_expense/hr_expense_view.xml | 4 ++-- addons/hr_holidays/hr_holidays_view.xml | 14 +++++++------- addons/hr_holidays/security/ir.model.access.csv | 1 + addons/hr_recruitment/hr_recruitment.py | 2 +- addons/hr_recruitment/hr_recruitment_view.xml | 4 ++-- addons/hr_timesheet/hr_timesheet_view.xml | 11 ++++++----- .../hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 4 ++-- 10 files changed, 26 insertions(+), 24 deletions(-) diff --git a/addons/hr/hr_department_view.xml b/addons/hr/hr_department_view.xml index ccbd506b7e6..d4f13458f1c 100644 --- a/addons/hr/hr_department_view.xml +++ b/addons/hr/hr_department_view.xml @@ -14,9 +14,9 @@
- + - + diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index e0efa92056b..83b5b266e5e 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -99,7 +99,7 @@ search - + @@ -114,7 +114,7 @@ - + diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 6c2f44dfb8c..4003cded168 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -81,7 +81,7 @@ class hr_expense_expense(osv.osv): 'company_id': fields.many2one('res.company', 'Company', required=True), 'state': fields.selection([ ('draft', 'Draft'), - ('confirm', 'Waiting Approved'), + ('confirm', 'Waiting Approval'), ('accepted', 'Approved'), ('invoiced', 'Invoiced'), ('paid', 'Reimbursed'), diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml index 4fc5b0412f8..79c0d5513f0 100644 --- a/addons/hr_expense/hr_expense_view.xml +++ b/addons/hr_expense/hr_expense_view.xml @@ -77,7 +77,7 @@ - + @@ -99,7 +99,7 @@