commit
2e183dc153
|
@ -42,6 +42,7 @@
|
|||
'ir/workflow/workflow_view.xml',
|
||||
'module/module_wizard.xml',
|
||||
'module/module_view.xml',
|
||||
'module/module_web_view.xml',
|
||||
'module/module_data.xml',
|
||||
'module/module_report.xml',
|
||||
'res/res_request_view.xml',
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
import module
|
||||
import module_web
|
||||
import wizard
|
||||
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('method', method)
|
||||
self.log('params', params)
|
||||
if hasattr(self,'auth_provider'):
|
||||
auth = self.auth_provider
|
||||
else:
|
||||
auth = None
|
||||
auth = getattr(self, 'auth_provider', None)
|
||||
result = ExportService.getService(service_name).dispatch(method, auth, params)
|
||||
self.log('result', result)
|
||||
# We shouldn't marshall None,
|
||||
|
@ -377,10 +374,7 @@ class OpenERPDispatcher:
|
|||
return result
|
||||
except Exception, e:
|
||||
self.log('exception', tools.exception_to_unicode(e))
|
||||
if hasattr(e, 'traceback'):
|
||||
tb = e.traceback
|
||||
else:
|
||||
tb = sys.exc_info()
|
||||
tb = getattr(e, 'traceback', sys.exc_info())
|
||||
tb_s = "".join(traceback.format_exception(*tb))
|
||||
if tools.config['debug_mode']:
|
||||
import pdb
|
||||
|
|
|
@ -304,7 +304,7 @@ def get_pg_type(f):
|
|||
elif isinstance(f.selection, list) and isinstance(f.selection[0][0], int):
|
||||
f_size = -1
|
||||
else:
|
||||
f_size = (hasattr(f, 'size') and f.size) or 16
|
||||
f_size = getattr(f, 'size', 16)
|
||||
|
||||
if f_size == -1:
|
||||
f_type = ('int4', 'INTEGER')
|
||||
|
@ -976,8 +976,7 @@ class orm_template(object):
|
|||
res[f]['readonly'] = True
|
||||
res[f]['states'] = {}
|
||||
for arg in ('digits', 'invisible','filters'):
|
||||
if hasattr(self._columns[f], arg) \
|
||||
and getattr(self._columns[f], arg):
|
||||
if getattr(self._columns[f], arg, None):
|
||||
res[f][arg] = getattr(self._columns[f], arg)
|
||||
|
||||
#TODO: optimize
|
||||
|
@ -1427,7 +1426,7 @@ class orm_template(object):
|
|||
act_id = int(data_menu.split(',')[1])
|
||||
if act_id:
|
||||
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:
|
||||
def clean(x):
|
||||
x = x[2]
|
||||
|
@ -1866,7 +1865,7 @@ class orm(orm_template):
|
|||
create = False
|
||||
todo_end = []
|
||||
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)
|
||||
if not cr.rowcount:
|
||||
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_size = f_pg_def['size']
|
||||
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))
|
||||
cr.execute('ALTER TABLE "%s" DROP COLUMN "%s"'% (self._table, k))
|
||||
cr.commit()
|
||||
|
@ -2162,7 +2162,7 @@ class orm(orm_template):
|
|||
|
||||
if not hasattr(self, '_log_access'):
|
||||
# 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()
|
||||
for store_field in self._columns:
|
||||
|
|
|
@ -195,8 +195,8 @@ class osv_memory(osv_base, orm.orm_memory):
|
|||
# put objects in the pool var
|
||||
#
|
||||
def createInstance(cls, pool, module, cr):
|
||||
name = hasattr(cls, '_name') and cls._name or cls._inherit
|
||||
parent_names = hasattr(cls, '_inherit') and cls._inherit
|
||||
name = getattr(cls, '_name', cls._inherit)
|
||||
parent_names = getattr(cls, '_inherit', None)
|
||||
if parent_names:
|
||||
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
|
||||
parent_class = pool.get(parent_name).__class__
|
||||
|
@ -209,7 +209,7 @@ class osv_memory(osv_base, orm.orm_memory):
|
|||
else:
|
||||
new.extend(cls.__dict__.get(s, []))
|
||||
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)
|
||||
|
||||
obj = object.__new__(cls)
|
||||
|
@ -223,7 +223,7 @@ class osv(osv_base, orm.orm):
|
|||
# put objects in the pool var
|
||||
#
|
||||
def createInstance(cls, pool, module, cr):
|
||||
parent_names = hasattr(cls, '_inherit') and cls._inherit
|
||||
parent_names = getattr(cls, '_inherit', None)
|
||||
if parent_names:
|
||||
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
|
||||
parent_class = pool.get(parent_name).__class__
|
||||
|
@ -247,7 +247,7 @@ class osv(osv_base, orm.orm):
|
|||
else:
|
||||
new.extend(cls.__dict__.get(s, []))
|
||||
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)
|
||||
obj = object.__new__(cls)
|
||||
obj.__init__(pool, cr)
|
||||
|
|
|
@ -85,7 +85,7 @@ class _float_format(float, _format):
|
|||
|
||||
def __str__(self):
|
||||
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]
|
||||
if hasattr(self, 'lang_obj'):
|
||||
return self.lang_obj.format('%.' + str(digits) + 'f', self.name, True)
|
||||
|
@ -108,7 +108,7 @@ class _date_format(str, _format):
|
|||
|
||||
def __str__(self):
|
||||
if self.val:
|
||||
if hasattr(self,'name') and (self.name):
|
||||
if getattr(self,'name', None):
|
||||
date = mx.DateTime.strptime(self.name,DT_FORMAT)
|
||||
return date.strftime(self.lang_obj.date_format)
|
||||
return self.val
|
||||
|
@ -120,7 +120,7 @@ class _dttime_format(str, _format):
|
|||
|
||||
def __str__(self):
|
||||
if self.val:
|
||||
if hasattr(self,'name') and self.name:
|
||||
if getattr(self,'name', None):
|
||||
datetime = mx.DateTime.strptime(self.name,DHM_FORMAT)
|
||||
return datetime.strftime(self.lang_obj.date_format+ " " + self.lang_obj.time_format)
|
||||
return self.val
|
||||
|
|
|
@ -137,7 +137,7 @@ class BaseHttpDaemon(threading.Thread, netsvc.Server):
|
|||
if os.name != 'nt':
|
||||
try:
|
||||
self.server.socket.shutdown(
|
||||
hasattr(socket, 'SHUT_RDWR') and socket.SHUT_RDWR or 2)
|
||||
getattr(socket, 'SHUT_RDWR', 2))
|
||||
except socket.error, e:
|
||||
if e.errno != 57: raise
|
||||
# OSX, socket shutdowns both sides if any side closes it
|
||||
|
|
|
@ -42,10 +42,8 @@ class TinySocketClientThread(threading.Thread, netsvc.OpenERPDispatcher):
|
|||
def __del__(self):
|
||||
if self.sock:
|
||||
try:
|
||||
if hasattr(socket, 'SHUT_RDWR'):
|
||||
self.socket.shutdown(socket.SHUT_RDWR)
|
||||
else:
|
||||
self.socket.shutdown(2)
|
||||
self.socket.shutdown(
|
||||
getattr(socket, 'SHUT_RDWR', 2))
|
||||
except: pass
|
||||
# That should garbage-collect and close it, too
|
||||
self.sock = None
|
||||
|
@ -131,10 +129,8 @@ class TinySocketServerThread(threading.Thread,netsvc.Server):
|
|||
for t in self.threads:
|
||||
t.stop()
|
||||
try:
|
||||
if hasattr(socket, 'SHUT_RDWR'):
|
||||
self.socket.shutdown(socket.SHUT_RDWR)
|
||||
else:
|
||||
self.socket.shutdown(2)
|
||||
self.socket.shutdown(
|
||||
getattr(socket, 'SHUT_RDWR', 2))
|
||||
self.socket.close()
|
||||
except:
|
||||
return False
|
||||
|
|
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@
|
|||
##############################################################################
|
||||
#
|
||||
# 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
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
##############################################################################
|
||||
#
|
||||
# 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
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
|
|
Loading…
Reference in New Issue