commit
2e183dc153
|
@ -42,6 +42,7 @@
|
||||||
'ir/workflow/workflow_view.xml',
|
'ir/workflow/workflow_view.xml',
|
||||||
'module/module_wizard.xml',
|
'module/module_wizard.xml',
|
||||||
'module/module_view.xml',
|
'module/module_view.xml',
|
||||||
|
'module/module_web_view.xml',
|
||||||
'module/module_data.xml',
|
'module/module_data.xml',
|
||||||
'module/module_report.xml',
|
'module/module_report.xml',
|
||||||
'res/res_request_view.xml',
|
'res/res_request_view.xml',
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import module
|
import module
|
||||||
|
import module_web
|
||||||
import wizard
|
import wizard
|
||||||
import report
|
import report
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
from osv import fields, osv, orm
|
||||||
|
|
||||||
|
class module_web(osv.osv):
|
||||||
|
_name = "ir.module.web"
|
||||||
|
_description = "Web Module"
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'name': fields.char("Name", size=128, readonly=True, required=True),
|
||||||
|
'description': fields.text("Description", readonly=True, translate=True),
|
||||||
|
'author': fields.char("Author", size=128, readonly=True),
|
||||||
|
'website': fields.char("Website", size=256, readonly=True),
|
||||||
|
'state': fields.selection([
|
||||||
|
('uninstallable','Uninstallable'),
|
||||||
|
('uninstalled','Not Installed'),
|
||||||
|
('installed','Installed')
|
||||||
|
], string='State', readonly=True)
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'state': lambda *a: 'uninstalled',
|
||||||
|
}
|
||||||
|
_order = 'name'
|
||||||
|
|
||||||
|
_sql_constraints = [
|
||||||
|
('name_uniq', 'unique (name)', 'The name of the module must be unique !'),
|
||||||
|
]
|
||||||
|
|
||||||
|
def update_module_list(self, cr, uid, modules, context={}):
|
||||||
|
|
||||||
|
for module in modules:
|
||||||
|
mod_name = module['name']
|
||||||
|
ids = self.search(cr, uid, [('name','=',mod_name)])
|
||||||
|
if ids:
|
||||||
|
self.write(cr, uid, ids, module)
|
||||||
|
else:
|
||||||
|
self.create(cr, uid, module)
|
||||||
|
|
||||||
|
def button_install(self, cr, uid, ids, context={}):
|
||||||
|
return self.write(cr, uid, ids, {'state': 'installed'}, context)
|
||||||
|
|
||||||
|
def button_uninstall(self, cr, uid, ids, context={}):
|
||||||
|
return self.write(cr, uid, ids, {'state': 'uninstalled'}, context)
|
||||||
|
|
||||||
|
module_web()
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="module_web_tree" model="ir.ui.view">
|
||||||
|
<field name="name">ir.module.web.tree</field>
|
||||||
|
<field name="model">ir.module.web</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="description"/>
|
||||||
|
<field name="author"/>
|
||||||
|
<field name="state"/>
|
||||||
|
<button name="button_install" string="Install" type="object" states="uninstalled" context="{'reload': 1}"/>
|
||||||
|
<button name="button_uninstall" string="Uninstall" type="object" states="installed" context="{'reload': 1}"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="open_module_web_list" model="ir.actions.url">
|
||||||
|
<field name="name">web_module_list</field>
|
||||||
|
<field name="url">/modules</field>
|
||||||
|
</record>
|
||||||
|
<menuitem name="Web Modules" action="open_module_web_list" id="open_module_web_list_url" type="url" parent="base.menu_management"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
|
@ -365,10 +365,7 @@ class OpenERPDispatcher:
|
||||||
self.log('service', service_name)
|
self.log('service', service_name)
|
||||||
self.log('method', method)
|
self.log('method', method)
|
||||||
self.log('params', params)
|
self.log('params', params)
|
||||||
if hasattr(self,'auth_provider'):
|
auth = getattr(self, 'auth_provider', None)
|
||||||
auth = self.auth_provider
|
|
||||||
else:
|
|
||||||
auth = None
|
|
||||||
result = ExportService.getService(service_name).dispatch(method, auth, params)
|
result = ExportService.getService(service_name).dispatch(method, auth, params)
|
||||||
self.log('result', result)
|
self.log('result', result)
|
||||||
# We shouldn't marshall None,
|
# We shouldn't marshall None,
|
||||||
|
@ -377,10 +374,7 @@ class OpenERPDispatcher:
|
||||||
return result
|
return result
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.log('exception', tools.exception_to_unicode(e))
|
self.log('exception', tools.exception_to_unicode(e))
|
||||||
if hasattr(e, 'traceback'):
|
tb = getattr(e, 'traceback', sys.exc_info())
|
||||||
tb = e.traceback
|
|
||||||
else:
|
|
||||||
tb = sys.exc_info()
|
|
||||||
tb_s = "".join(traceback.format_exception(*tb))
|
tb_s = "".join(traceback.format_exception(*tb))
|
||||||
if tools.config['debug_mode']:
|
if tools.config['debug_mode']:
|
||||||
import pdb
|
import pdb
|
||||||
|
|
|
@ -304,7 +304,7 @@ def get_pg_type(f):
|
||||||
elif isinstance(f.selection, list) and isinstance(f.selection[0][0], int):
|
elif isinstance(f.selection, list) and isinstance(f.selection[0][0], int):
|
||||||
f_size = -1
|
f_size = -1
|
||||||
else:
|
else:
|
||||||
f_size = (hasattr(f, 'size') and f.size) or 16
|
f_size = getattr(f, 'size', 16)
|
||||||
|
|
||||||
if f_size == -1:
|
if f_size == -1:
|
||||||
f_type = ('int4', 'INTEGER')
|
f_type = ('int4', 'INTEGER')
|
||||||
|
@ -976,8 +976,7 @@ class orm_template(object):
|
||||||
res[f]['readonly'] = True
|
res[f]['readonly'] = True
|
||||||
res[f]['states'] = {}
|
res[f]['states'] = {}
|
||||||
for arg in ('digits', 'invisible','filters'):
|
for arg in ('digits', 'invisible','filters'):
|
||||||
if hasattr(self._columns[f], arg) \
|
if getattr(self._columns[f], arg, None):
|
||||||
and getattr(self._columns[f], arg):
|
|
||||||
res[f][arg] = getattr(self._columns[f], arg)
|
res[f][arg] = getattr(self._columns[f], arg)
|
||||||
|
|
||||||
#TODO: optimize
|
#TODO: optimize
|
||||||
|
@ -1427,7 +1426,7 @@ class orm_template(object):
|
||||||
act_id = int(data_menu.split(',')[1])
|
act_id = int(data_menu.split(',')[1])
|
||||||
if act_id:
|
if act_id:
|
||||||
data_action = self.pool.get('ir.actions.act_window').browse(cr, user, [act_id], context)[0]
|
data_action = self.pool.get('ir.actions.act_window').browse(cr, user, [act_id], context)[0]
|
||||||
result['submenu'] = hasattr(data_action,'menus') and data_action.menus or False
|
result['submenu'] = getattr(data_action,'menus', False)
|
||||||
if toolbar:
|
if toolbar:
|
||||||
def clean(x):
|
def clean(x):
|
||||||
x = x[2]
|
x = x[2]
|
||||||
|
@ -1866,7 +1865,7 @@ class orm(orm_template):
|
||||||
create = False
|
create = False
|
||||||
todo_end = []
|
todo_end = []
|
||||||
self._field_create(cr, context=context)
|
self._field_create(cr, context=context)
|
||||||
if not hasattr(self, "_auto") or self._auto:
|
if getattr(self, '_auto', True):
|
||||||
cr.execute("SELECT relname FROM pg_class WHERE relkind in ('r','v') AND relname='%s'" % self._table)
|
cr.execute("SELECT relname FROM pg_class WHERE relkind in ('r','v') AND relname='%s'" % self._table)
|
||||||
if not cr.rowcount:
|
if not cr.rowcount:
|
||||||
cr.execute("CREATE TABLE \"%s\" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS" % self._table)
|
cr.execute("CREATE TABLE \"%s\" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS" % self._table)
|
||||||
|
@ -2009,7 +2008,8 @@ class orm(orm_template):
|
||||||
f_pg_type = f_pg_def['typname']
|
f_pg_type = f_pg_def['typname']
|
||||||
f_pg_size = f_pg_def['size']
|
f_pg_size = f_pg_def['size']
|
||||||
f_pg_notnull = f_pg_def['attnotnull']
|
f_pg_notnull = f_pg_def['attnotnull']
|
||||||
if isinstance(f, fields.function) and not f.store and (not hasattr(f,'nodrop') or not f.nodrop):
|
if isinstance(f, fields.function) and not f.store and\
|
||||||
|
not getattr(f, 'nodrop', False):
|
||||||
logger.notifyChannel('orm', netsvc.LOG_INFO, 'column %s (%s) in table %s removed: converted to a function !\n' % (k, f.string, self._table))
|
logger.notifyChannel('orm', netsvc.LOG_INFO, 'column %s (%s) in table %s removed: converted to a function !\n' % (k, f.string, self._table))
|
||||||
cr.execute('ALTER TABLE "%s" DROP COLUMN "%s"'% (self._table, k))
|
cr.execute('ALTER TABLE "%s" DROP COLUMN "%s"'% (self._table, k))
|
||||||
cr.commit()
|
cr.commit()
|
||||||
|
@ -2162,7 +2162,7 @@ class orm(orm_template):
|
||||||
|
|
||||||
if not hasattr(self, '_log_access'):
|
if not hasattr(self, '_log_access'):
|
||||||
# if not access is not specify, it is the same value as _auto
|
# if not access is not specify, it is the same value as _auto
|
||||||
self._log_access = not hasattr(self, "_auto") or self._auto
|
self._log_access = getattr(self, "_auto", True)
|
||||||
|
|
||||||
self._columns = self._columns.copy()
|
self._columns = self._columns.copy()
|
||||||
for store_field in self._columns:
|
for store_field in self._columns:
|
||||||
|
|
|
@ -195,8 +195,8 @@ class osv_memory(osv_base, orm.orm_memory):
|
||||||
# put objects in the pool var
|
# put objects in the pool var
|
||||||
#
|
#
|
||||||
def createInstance(cls, pool, module, cr):
|
def createInstance(cls, pool, module, cr):
|
||||||
name = hasattr(cls, '_name') and cls._name or cls._inherit
|
name = getattr(cls, '_name', cls._inherit)
|
||||||
parent_names = hasattr(cls, '_inherit') and cls._inherit
|
parent_names = getattr(cls, '_inherit', None)
|
||||||
if parent_names:
|
if parent_names:
|
||||||
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
|
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
|
||||||
parent_class = pool.get(parent_name).__class__
|
parent_class = pool.get(parent_name).__class__
|
||||||
|
@ -209,7 +209,7 @@ class osv_memory(osv_base, orm.orm_memory):
|
||||||
else:
|
else:
|
||||||
new.extend(cls.__dict__.get(s, []))
|
new.extend(cls.__dict__.get(s, []))
|
||||||
nattr[s] = new
|
nattr[s] = new
|
||||||
name = hasattr(cls, '_name') and cls._name or cls._inherit
|
name = getattr(cls, '_name', cls._inherit)
|
||||||
cls = type(name, (cls, parent_class), nattr)
|
cls = type(name, (cls, parent_class), nattr)
|
||||||
|
|
||||||
obj = object.__new__(cls)
|
obj = object.__new__(cls)
|
||||||
|
@ -223,7 +223,7 @@ class osv(osv_base, orm.orm):
|
||||||
# put objects in the pool var
|
# put objects in the pool var
|
||||||
#
|
#
|
||||||
def createInstance(cls, pool, module, cr):
|
def createInstance(cls, pool, module, cr):
|
||||||
parent_names = hasattr(cls, '_inherit') and cls._inherit
|
parent_names = getattr(cls, '_inherit', None)
|
||||||
if parent_names:
|
if parent_names:
|
||||||
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
|
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
|
||||||
parent_class = pool.get(parent_name).__class__
|
parent_class = pool.get(parent_name).__class__
|
||||||
|
@ -247,7 +247,7 @@ class osv(osv_base, orm.orm):
|
||||||
else:
|
else:
|
||||||
new.extend(cls.__dict__.get(s, []))
|
new.extend(cls.__dict__.get(s, []))
|
||||||
nattr[s] = new
|
nattr[s] = new
|
||||||
name = hasattr(cls, '_name') and cls._name or cls._inherit
|
name = getattr(cls, '_name', cls._inherit)
|
||||||
cls = type(name, (cls, parent_class), nattr)
|
cls = type(name, (cls, parent_class), nattr)
|
||||||
obj = object.__new__(cls)
|
obj = object.__new__(cls)
|
||||||
obj.__init__(pool, cr)
|
obj.__init__(pool, cr)
|
||||||
|
|
|
@ -85,7 +85,7 @@ class _float_format(float, _format):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
digits = 2
|
digits = 2
|
||||||
if hasattr(self,'_field') and hasattr(self._field, 'digits') and self._field.digits:
|
if hasattr(self,'_field') and getattr(self._field, 'digits', None):
|
||||||
digits = self._field.digits[1]
|
digits = self._field.digits[1]
|
||||||
if hasattr(self, 'lang_obj'):
|
if hasattr(self, 'lang_obj'):
|
||||||
return self.lang_obj.format('%.' + str(digits) + 'f', self.name, True)
|
return self.lang_obj.format('%.' + str(digits) + 'f', self.name, True)
|
||||||
|
@ -108,7 +108,7 @@ class _date_format(str, _format):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.val:
|
if self.val:
|
||||||
if hasattr(self,'name') and (self.name):
|
if getattr(self,'name', None):
|
||||||
date = mx.DateTime.strptime(self.name,DT_FORMAT)
|
date = mx.DateTime.strptime(self.name,DT_FORMAT)
|
||||||
return date.strftime(self.lang_obj.date_format)
|
return date.strftime(self.lang_obj.date_format)
|
||||||
return self.val
|
return self.val
|
||||||
|
@ -120,7 +120,7 @@ class _dttime_format(str, _format):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.val:
|
if self.val:
|
||||||
if hasattr(self,'name') and self.name:
|
if getattr(self,'name', None):
|
||||||
datetime = mx.DateTime.strptime(self.name,DHM_FORMAT)
|
datetime = mx.DateTime.strptime(self.name,DHM_FORMAT)
|
||||||
return datetime.strftime(self.lang_obj.date_format+ " " + self.lang_obj.time_format)
|
return datetime.strftime(self.lang_obj.date_format+ " " + self.lang_obj.time_format)
|
||||||
return self.val
|
return self.val
|
||||||
|
|
|
@ -137,7 +137,7 @@ class BaseHttpDaemon(threading.Thread, netsvc.Server):
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
try:
|
try:
|
||||||
self.server.socket.shutdown(
|
self.server.socket.shutdown(
|
||||||
hasattr(socket, 'SHUT_RDWR') and socket.SHUT_RDWR or 2)
|
getattr(socket, 'SHUT_RDWR', 2))
|
||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
if e.errno != 57: raise
|
if e.errno != 57: raise
|
||||||
# OSX, socket shutdowns both sides if any side closes it
|
# OSX, socket shutdowns both sides if any side closes it
|
||||||
|
|
|
@ -42,10 +42,8 @@ class TinySocketClientThread(threading.Thread, netsvc.OpenERPDispatcher):
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.sock:
|
if self.sock:
|
||||||
try:
|
try:
|
||||||
if hasattr(socket, 'SHUT_RDWR'):
|
self.socket.shutdown(
|
||||||
self.socket.shutdown(socket.SHUT_RDWR)
|
getattr(socket, 'SHUT_RDWR', 2))
|
||||||
else:
|
|
||||||
self.socket.shutdown(2)
|
|
||||||
except: pass
|
except: pass
|
||||||
# That should garbage-collect and close it, too
|
# That should garbage-collect and close it, too
|
||||||
self.sock = None
|
self.sock = None
|
||||||
|
@ -131,10 +129,8 @@ class TinySocketServerThread(threading.Thread,netsvc.Server):
|
||||||
for t in self.threads:
|
for t in self.threads:
|
||||||
t.stop()
|
t.stop()
|
||||||
try:
|
try:
|
||||||
if hasattr(socket, 'SHUT_RDWR'):
|
self.socket.shutdown(
|
||||||
self.socket.shutdown(socket.SHUT_RDWR)
|
getattr(socket, 'SHUT_RDWR', 2))
|
||||||
else:
|
|
||||||
self.socket.shutdown(2)
|
|
||||||
self.socket.close()
|
self.socket.close()
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
|
Loading…
Reference in New Issue