From 6f9879c7ee5d6362afbc4e36e7b8f581f5e455cc Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Mon, 20 Oct 2008 19:30:41 +0200 Subject: [PATCH 01/16] Fixes for packaging - Add 'import int_to_text' so py2exe detect and copy it. - setup.py: Add dependencies to `asyncore', `asynchat' (addon `document') - setup.py: Add `import_xml.rng' in data files (crash on DB creation) bzr revid: x.alt@ajm.lu-20081020173041-bh5m3z4ljgcr8i4o --- bin/report/__init__.py | 1 + setup.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/report/__init__.py b/bin/report/__init__.py index adbe1d7ee74..347e8670433 100644 --- a/bin/report/__init__.py +++ b/bin/report/__init__.py @@ -34,6 +34,7 @@ import print_fnc import custom import render import pychart +import int_to_text import report_sxw diff --git a/setup.py b/setup.py index 0000ae6c152..164d834a1e2 100644 --- a/setup.py +++ b/setup.py @@ -86,6 +86,8 @@ def find_addons(): def data_files(): '''Build list of data files to be installed''' + + print "Here" files = [] if os.name == 'nt': os.chdir('bin') @@ -138,6 +140,7 @@ def data_files(): glob.glob(opj(add_path, 'report', '*sxw')) + glob.glob(opj(add_path, 'report', '*xsl')))] files.extend(pathfiles) + files.append(('.', [('bin/import_xml.rng')])) return files check_modules() @@ -158,7 +161,7 @@ options = {"py2exe": { "packages": ["lxml", "lxml.builder", "lxml._elementpath", "lxml.etree", "lxml.objectify", "decimal", "xml", "xml.dom", "xml.xpath", "encodings","mx.DateTime","wizard","pychart","PIL", "pyparsing", - "pydot"], + "pydot","asyncore","asynchat"], "excludes" : ["Tkconstants","Tkinter","tcl"], }} From afd3cd6b6338b1c8c3029d930110d5630b7da9c1 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Mon, 20 Oct 2008 21:45:35 +0200 Subject: [PATCH 02/16] Remove print statment bzr revid: x.alt@ajm.lu-20081020194535-y7o7kuh0bxoj6am3 --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index 164d834a1e2..f4385cb05e0 100644 --- a/setup.py +++ b/setup.py @@ -86,8 +86,6 @@ def find_addons(): def data_files(): '''Build list of data files to be installed''' - - print "Here" files = [] if os.name == 'nt': os.chdir('bin') From 28b4f314fd2404605ef3b7104198538aed75642e Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 10:23:52 +0100 Subject: [PATCH 03/16] push bzr revid: fp@tinyerp.com-20081027092352-949s0q4ewrs8vuej --- bin/osv/expression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/osv/expression.py b/bin/osv/expression.py index 7397a82e88b..54abce1b22c 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -232,9 +232,9 @@ class expression(object): query = '(%s OR %s IS NULL)' % (query, left) else: params = [] - if (right == False or right is None) and operator == '=': + if (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='): query = '%s IS NULL' % left - elif (right == False or right is None) and operator in ['<>', '!=']: + elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']): query = '%s IS NOT NULL' % left else: if left == 'id': From 2a2108247744a276b812432bedb4530f023634e2 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 11:20:25 +0100 Subject: [PATCH 04/16] improve_translation_view bzr revid: fp@tinyerp.com-20081027102025-7h2onj6b4brlok21 --- bin/addons/base/module/wizard/wizard_module_lang_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/module/wizard/wizard_module_lang_install.py b/bin/addons/base/module/wizard/wizard_module_lang_install.py index 2ebe243b705..ef9c0c0b43c 100644 --- a/bin/addons/base/module/wizard/wizard_module_lang_install.py +++ b/bin/addons/base/module/wizard/wizard_module_lang_install.py @@ -47,7 +47,7 @@ view_form = """ """ From 54f4c8f1cce2e4d2639131964d978253e526b924 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 11:46:50 +0100 Subject: [PATCH 05/16] bugfix bzr revid: fp@tinyerp.com-20081027104650-1c3tf9xsx0rmmoat --- bin/osv/orm.py | 5 ++++- bin/tools/misc.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index f65c9183b20..37cc2e50abe 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1404,7 +1404,10 @@ class orm(orm_template): for key,val in res.items(): if f._multi: val = val[k] - cr.execute("UPDATE \"%s\" SET \"%s\"='%s' where id=%d"% (self._table, k, val, key)) + if (val<>False) or (type(val)<>bool): + cr.execute("UPDATE \"%s\" SET \"%s\"='%s' where id=%d"% (self._table, k, val, key)) + #else: + # cr.execute("UPDATE \"%s\" SET \"%s\"=NULL where id=%d"% (self._table, k, key)) # and add constraints if needed if isinstance(f, fields.many2one): diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 509c04ec5e8..9e292c9e27a 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -396,7 +396,7 @@ def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_ msg = MIMEMultipart() if not ssl: - ssl = config['smtp_ssl'] + ssl = config.get('smtp_ssl', False) msg['Subject'] = Header(subject.decode('utf8'), 'utf-8') msg['From'] = email_from From 96e69a0a257f326a051a5ea2d6d9649e7b2f1337 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 12:59:00 +0100 Subject: [PATCH 06/16] merge bzr revid: fp@tinyerp.com-20081027115900-21mykbjk7whhq7in --- bin/osv/orm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 37cc2e50abe..aaf26da4a89 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -2325,7 +2325,10 @@ class orm(orm_template): continue value = res[field] if self._columns[field]._type in ('many2one', 'one2one'): - value = res[field][0] + try: + value = res[field][0] + except: + value = res[field] upd0.append('"'+field+'"='+self._columns[field]._symbol_set[0]) upd1.append(self._columns[field]._symbol_set[1](value)) upd1.append(res['id']) From 537bb6835a53fe05062dd43685a3f711a6f3448d Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 13:18:52 +0100 Subject: [PATCH 07/16] bugfix_empty_dir bzr revid: fp@tinyerp.com-20081027121852-hcmyfyqbcdlk8cuz --- bin/addons/__init__.py | 6 +++++- bin/tools/misc.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 01441910488..1f9f3be0190 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -142,6 +142,8 @@ def get_module_path(module): if os.path.exists(opj(_ad, module)) or os.path.exists(opj(_ad, '%s.zip' % module)): return opj(_ad, module) + logger.notifyChannel('init', netsvc.LOG_WARNING, 'addon:%s:module not found' % (module,)) + return False raise IOError, 'Module not found : %s' % module def get_module_resource(module, *args): @@ -152,7 +154,8 @@ def get_module_resource(module, *args): @return: absolute path to the resource """ - return opj(get_module_path(module), *args) + a = get_module_path(module) + return a and opj(a, *args) or False def get_modules(): """Returns the list of module names @@ -178,6 +181,7 @@ def create_graph(module_list, force=None): except IOError: continue terp_file = get_module_resource(module, '__terp__.py') + if not terp_file: continue if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path): try: info = eval(tools.file_open(terp_file).read()) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 9e292c9e27a..65c9c8c5d35 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -62,6 +62,8 @@ def init_db(cr): for i in addons.get_modules(): terp_file = addons.get_module_resource(i, '__terp__.py') mod_path = addons.get_module_path(i) + if not mod_path: + continue info = False if os.path.isfile(terp_file) and not os.path.isfile(mod_path+'.zip'): info = eval(file(terp_file).read()) From 348d01795afc470032d81b2597206a430be77142 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 27 Oct 2008 13:28:07 +0100 Subject: [PATCH 08/16] fix bug with translation of empty string of selection entries bzr revid: chs@tinyerp.com-20081027122807-a401uef1xctcr4gf --- bin/osv/orm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index aaf26da4a89..7dabec92dbc 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -724,9 +724,11 @@ class orm_template(object): # translate each selection option sel2 = [] for (key, val) in sel: - val2 = translation_obj._get_source(cr, user, + val2 = None + if val: + val2 = translation_obj._get_source(cr, user, self._name + ',' + f, 'selection', - context.get('lang', False) or 'en_US', val) + context.get('lang', False) or 'en_US', val) sel2.append((key, val2 or val)) sel = sel2 res[f]['selection'] = sel From f7273ecbc7c02772e76dcac90dee6e1cdd78b28e Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 27 Oct 2008 13:54:13 +0100 Subject: [PATCH 09/16] admin user is not restricted by roles bzr revid: chs@tinyerp.com-20081027125413-lusm89mme25cclm8 --- bin/osv/orm.py | 17 +++++++++-------- bin/workflow/wkf_expr.py | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 7dabec92dbc..62d414c1eb3 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -831,14 +831,15 @@ class orm_template(object): continue ok = True - - serv = netsvc.LocalService('object_proxy') - user_roles = serv.execute_cr(cr, user, 'res.users', 'read', [user], ['roles_id'])[0]['roles_id'] - cr.execute("select role_id from wkf_transition where signal='%s'" % button.getAttribute('name')) - roles = cr.fetchall() - for role in roles: - if role[0]: - ok = ok and serv.execute_cr(cr, user, 'res.roles', 'check', user_roles, role[0]) + + if user != 1: # admin user has all roles + serv = netsvc.LocalService('object_proxy') + user_roles = serv.execute_cr(cr, user, 'res.users', 'read', [user], ['roles_id'])[0]['roles_id'] + cr.execute("select role_id from wkf_transition where signal='%s'" % button.getAttribute('name')) + roles = cr.fetchall() + for role in roles: + if role[0]: + ok = ok and serv.execute_cr(cr, user, 'res.roles', 'check', user_roles, role[0]) if not ok: button.setAttribute('readonly', '1') diff --git a/bin/workflow/wkf_expr.py b/bin/workflow/wkf_expr.py index 73573a231d2..d2d37edb3b3 100644 --- a/bin/workflow/wkf_expr.py +++ b/bin/workflow/wkf_expr.py @@ -101,8 +101,8 @@ def check(cr, workitem, ident, transition, signal): if transition['signal']: ok = (signal==transition['signal']) - if transition['role_id']: - uid = ident[0] + uid = ident[0] + if transition['role_id'] and uid != 1: serv = netsvc.LocalService('object_proxy') user_roles = serv.execute_cr(cr, uid, 'res.users', 'read', [uid], ['roles_id'])[0]['roles_id'] ok = ok and serv.execute_cr(cr, uid, 'res.roles', 'check', user_roles, transition['role_id']) From 609d96b9bab29b66b66cc12d4e5f57da858c6ec9 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 27 Oct 2008 14:07:56 +0100 Subject: [PATCH 10/16] Bugfix with the translation bzr revid: stephane@tinyerp.com-20081027130756-bgkkfc5qdf2zdlvd --- bin/addons/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 1f9f3be0190..937176ec2e6 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -286,9 +286,10 @@ def load_module_graph(cr, graph, status=None, **kwargs): # Update translations for all installed languages modobj = pool.get('ir.module.module') - modobj.update_translations(cr, 1, [mid], None) - - cr.commit() + if modobj: + modobj.update_translations(cr, 1, [mid], None) + cr.commit() + statusi+=1 cr.execute("""select model,name from ir_model where id not in (select model_id from ir_model_access)""") From f4da34e876b8422fd928b73dbcdb71aca0095cc6 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 27 Oct 2008 14:10:09 +0100 Subject: [PATCH 11/16] Add the amount_to_text file bzr revid: stephane@tinyerp.com-20081027131009-286ilrlm1taqwfg3 --- bin/tools/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/tools/__init__.py b/bin/tools/__init__.py index 6a3022006fc..896f763f4a3 100644 --- a/bin/tools/__init__.py +++ b/bin/tools/__init__.py @@ -31,6 +31,8 @@ from misc import * from convert import * from translate import * from graph import graph +from amount_to_text import * +from amount_to_text_en import * # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From d086b1fb02c39ff762d24b3efc1727270126dd44 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 27 Oct 2008 14:10:16 +0100 Subject: [PATCH 12/16] Indent bugfix bzr revid: stephane@tinyerp.com-20081027131016-u0bn3egsb0itj9q7 --- win32/OpenERPServerService.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win32/OpenERPServerService.py b/win32/OpenERPServerService.py index 24df255f1d2..f6c87a75f6c 100644 --- a/win32/OpenERPServerService.py +++ b/win32/OpenERPServerService.py @@ -87,8 +87,8 @@ class OpenERPServerService(win32serviceutil.ServiceFramework): win32event.WaitForSingleObject(ws, win32event.INFINITE) self.stopping = True - def SvcDoRun(self): - # Start OpenERP Server itself + def SvcDoRun(self): + # Start OpenERP Server itself self.StartTERP() # start the loop waiting for the Service Manager's stop signal thread.start_new_thread(self.StartControl, (self.hWaitStop,)) From a04e26ff6c2fd13815f65cad635b431d4bdc405f Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 14:19:47 +0100 Subject: [PATCH 13/16] product bzr revid: fp@tinyerp.com-20081027131947-jyhzodb1p2pox2od --- addons/product/product_view.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 30b07fe8f74..62f7b7cd0a1 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -1,10 +1,8 @@ - - product.product.tree product.product From 05a120a212f067d6e60009670c13ae41724c2161 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 14:27:24 +0100 Subject: [PATCH 14/16] tooltip_project bzr revid: fp@tinyerp.com-20081027132724-q6shdzndmt0xaaqt --- .../account_analytic_analysis_menu.xml | 8 ++++---- addons/project/project.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis_menu.xml b/addons/account_analytic_analysis/account_analytic_analysis_menu.xml index a6e5e9ce3f3..6e84747e611 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_menu.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_menu.xml @@ -73,7 +73,7 @@ [('state','=','draft')] - + Open Analytic Accounts @@ -84,7 +84,7 @@ [('state','=','open')] - + Pending Analytic Accounts @@ -95,7 +95,7 @@ [('state','=','pending')] - + Simplified View Analytic Accounts @@ -106,7 +106,7 @@ [] - + diff --git a/addons/project/project.py b/addons/project/project.py index 3bb08ed8a89..9cca763f8dc 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -120,8 +120,8 @@ class project(osv.osv): 'tasks': fields.one2many('project.task', 'project_id', "Project tasks"), 'parent_id': fields.many2one('project.project', 'Parent Project'), 'child_id': fields.one2many('project.project', 'parent_id', 'Subproject'), - 'planned_hours': fields.function(_calc_planned, method=True, string='Planned hours'), - 'effective_hours': fields.function(_calc_effective, method=True, string='Hours spent'), + 'planned_hours': fields.function(_calc_planned, method=True, string='Planned hours', help="Sum of planned hours of all tasks related to this project."), + 'effective_hours': fields.function(_calc_effective, method=True, string='Hours spent', help="Sum of spent hours of all tasks related to this project."), 'progress_rate': fields.function(_progress_rate, method=True, string='Progress', type='float', help="Percent of tasks closed according to the total of tasks todo."), 'date_start': fields.date('Starting Date'), 'date_end': fields.date('Expected End'), From 49228e21fae9d77a3aa3da441fe5e2277c47bc3d Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 14:29:39 +0100 Subject: [PATCH 15/16] improved_menu bzr revid: fp@tinyerp.com-20081027132939-03g3xcmh18s6ftxf --- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 00b01f46ed2..cdb63b875d7 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -204,11 +204,10 @@ - + - - + From 66c69e0499251f9f01eed079e22cab1678ac3ea6 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 27 Oct 2008 14:31:02 +0100 Subject: [PATCH 16/16] bufix bzr revid: fp@tinyerp.com-20081027133102-0ouiq5k2x1l5cdsp --- .../hr_timesheet_sheet_view.xml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index cdb63b875d7..3ce0ae29976 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -25,7 +25,7 @@ hr_timesheet_sheet.sheet.account form -
+ @@ -149,17 +149,6 @@ - @@ -201,13 +190,13 @@ - + - + - +