diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 01441910488..937176ec2e6 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()) @@ -282,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)""") 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 = """ """ 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': diff --git a/bin/osv/orm.py b/bin/osv/orm.py index f65c9183b20..62d414c1eb3 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 @@ -829,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') @@ -1404,7 +1407,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): @@ -2322,7 +2328,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']) 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/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: diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 509c04ec5e8..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()) @@ -396,7 +398,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 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']) diff --git a/setup.py b/setup.py index 0000ae6c152..f4385cb05e0 100644 --- a/setup.py +++ b/setup.py @@ -138,6 +138,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 +159,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"], }} 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,))