bzr revid: olt@tinyerp.com-20081027133046-hk0te5meh4i3obs9
This commit is contained in:
Olivier Laurent 2008-10-27 14:30:46 +01:00
commit ce7045b9fe
10 changed files with 45 additions and 25 deletions

View File

@ -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)""")

View File

@ -47,7 +47,7 @@ view_form = """<?xml version="1.0"?>
<group colspan="2" col="4">
<separator string="System Upgrade" colspan="4"/>
<label align="0.0" string="Choose a language to install:" colspan="4"/>
<field name="lang" colspan="4"/>
<field name="lang" colspan="4" required="1"/>
<label align="0.0" string="Note that this operation may take a few minutes." colspan="4"/>
</group>
</form>"""

View File

@ -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':

View File

@ -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'])

View File

@ -34,6 +34,7 @@ import print_fnc
import custom
import render
import pychart
import int_to_text
import report_sxw

View File

@ -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:

View File

@ -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

View File

@ -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'])

View File

@ -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"],
}}

View File

@ -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,))