Merge commit 'origin/master' into mdv-gpl3-fwd

bzr revid: p_christ@hol.gr-20081215182709-rusb3oq7npwecnt7
This commit is contained in:
P. Christeas 2008-12-15 20:27:09 +02:00
commit bf1d0a2535
19 changed files with 98 additions and 244 deletions

View File

@ -1,3 +1,6 @@
include README
recursive-include doc * recursive-include doc *
recursive-include man * recursive-include man *
recursive-include bin *xml *xsl *sql *rml *sxw *csv recursive-include bin *xml *xsl *sql *rml *sxw *csv *rng
graft bin/addons/
global-exclude *pyc *~

View File

@ -140,8 +140,6 @@ def get_module_path(module):
logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: module not found' % (module,)) logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: module not found' % (module,))
return False return False
raise IOError, 'Module not found : %s' % module
def get_module_filetree(module, dir='.'): def get_module_filetree(module, dir='.'):
path = get_module_path(module) path = get_module_path(module)
@ -193,7 +191,11 @@ def get_modules():
if name[-4:] == '.zip': if name[-4:] == '.zip':
name = name[:-4] name = name[:-4]
return name return name
return map(clean, os.listdir(dir))
def is_really_module(name):
name = opj(dir, name)
return os.path.isdir(name) or zipfile.is_zipfile(name)
return map(clean, filter(is_really_module, os.listdir(dir)))
return list(set(listdir(ad) + listdir(_ad))) return list(set(listdir(ad) + listdir(_ad)))
@ -545,9 +547,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
modobj = pool.get('ir.module.module') modobj = pool.get('ir.module.module')
logger.notifyChannel('init', netsvc.LOG_INFO, 'updating modules list') logger.notifyChannel('init', netsvc.LOG_INFO, 'updating modules list')
cr.execute("select id from ir_module_module where state in ('to install','to upgrade') and name=%s", ('base',)) modobj.update_list(cr, 1)
if cr.rowcount:
modobj.update_list(cr, 1)
mods = [k for k in tools.config['init'] if tools.config['init'][k]] mods = [k for k in tools.config['init'] if tools.config['init'][k]]
if mods: if mods:

View File

@ -1143,13 +1143,7 @@
<field name="model_id" select="1"/> <field name="model_id" select="1"/>
<field name="sequence" select="2"/> <field name="sequence" select="2"/>
<notebook colspan="4"> <notebook colspan="4">
<!--<page string="Python Code" attrs="{'invisible':[('state','!=','python')]}"> <page string="Trigger" attrs="{'invisible':[('state','!=','trigger')]}">
<separator colspan="4" string="Python code"/>
<field name="code" colspan="4" nolabel="1" />
<button string="Create Action" name="%(wizard_server_action_create)d" type="action"/>
</page>
--><page string="Trigger" attrs="{'invisible':[('state','!=','trigger')]}">
<separator colspan="4" string="Trigger Configuration"/> <separator colspan="4" string="Trigger Configuration"/>
<field name="wkf_model_id"/> <field name="wkf_model_id"/>
<field name="trigger_obj_id" select="2" domain="[('model_id','=',model_id)]" on_change="on_trigger_obj_id(trigger_obj_id)"/> <field name="trigger_obj_id" select="2" domain="[('model_id','=',model_id)]" on_change="on_trigger_obj_id(trigger_obj_id)"/>
@ -1198,7 +1192,8 @@
<page string="Multi Actions" attrs="{'invisible':[('state','!=','other')]}"> <page string="Multi Actions" attrs="{'invisible':[('state','!=','other')]}">
<separator colspan="4" string="Other Actions Configuration"/> <separator colspan="4" string="Other Actions Configuration"/>
<field name="child_ids" nolabel="1" colspan="4"/> <field name="child_ids" nolabel="1" colspan="4"/>
<label colspan="4" string="Only one client action will be execute, last clinent action will be consider in case of multipls clinets actions" align="0.0"/> <label colspan="4" string="Only one client action will be execute, last
clinent action will be consider in case of multiples clients actions" align="0.0"/>
</page> </page>
</notebook> </notebook>
@ -1224,6 +1219,7 @@
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">ir.actions.server</field> <field name="res_model">ir.actions.server</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_server_action_tree"/> <field name="view_id" ref="view_server_action_tree"/>
<field name="context">{'key':'server_action'}</field> <field name="context">{'key':'server_action'}</field>
</record> </record>

View File

@ -366,21 +366,22 @@ server_object_lines()
# #
class actions_server(osv.osv): class actions_server(osv.osv):
def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False):
res = super(actions_server, self).fields_view_get(cr, user, view_id, view_type, context, toolbar)
#print 'RES : ',res
return res
def _select_signals(self, cr, uid, context={}): def _select_signals(self, cr, uid, context={}):
cr.execute("select distinct t.signal as key, t.signal || ' - [ ' || w.osv || ' ] ' as val from wkf w, wkf_activity a, wkf_transition t "\ cr.execute("select distinct t.signal as key, t.signal || ' - [ ' || w.osv || ' ] ' as val from wkf w, wkf_activity a, wkf_transition t "\
" where w.id = a.wkf_id " \ " where w.id = a.wkf_id " \
" and t.act_from = a.wkf_id " \ " and t.act_from = a.wkf_id " \
" or t.act_to = a.wkf_id ") " or t.act_to = a.wkf_id and t.signal not in (null, NULL)")
return cr.fetchall() result = cr.fetchall() or []
res = []
def on_trigger_obj_id(self, cr, uid, ids, context={}): for rs in result:
cr.execute("select distinct t.signal as key, t.signal as val from wkf w, wkf_activity a, wkf_transition t "\ if not rs[0] == None and not rs[1] == None:
" where w.id = a.wkf_id " \ res.append(rs)
" and t.act_from = a.wkf_id " \ return res
" or t.act_to = a.wkf_id " \
" and w.osv = %s ", ('account.invoice'))
data = cr.fetchall()
return {"values":{'trigger_name':data}}
_name = 'ir.actions.server' _name = 'ir.actions.server'
_table = 'ir_act_server' _table = 'ir_act_server'
@ -397,7 +398,6 @@ class actions_server(osv.osv):
('object_write','Write Object'), ('object_write','Write Object'),
('other','Multi Actions'), ('other','Multi Actions'),
], 'Action State', required=True, size=32), ], 'Action State', required=True, size=32),
'code': fields.text('Python Code'),
'sequence': fields.integer('Sequence'), 'sequence': fields.integer('Sequence'),
'model_id': fields.many2one('ir.model', 'Object', required=True), 'model_id': fields.many2one('ir.model', 'Object', required=True),
'action_id': fields.many2one('ir.actions.actions', 'Client Action'), 'action_id': fields.many2one('ir.actions.actions', 'Client Action'),
@ -418,16 +418,7 @@ class actions_server(osv.osv):
_defaults = { _defaults = {
'state': lambda *a: 'dummy', 'state': lambda *a: 'dummy',
'type': lambda *a: 'ir.actions.server', 'type': lambda *a: 'ir.actions.server',
'sequence': lambda *a: 0, 'sequence': lambda *a: 5,
'code': lambda *a: """# You can use the following variables
# - object
# - object2
# - time
# - cr
# - uid
# - ids
# If you plan to return an action, assign: action = {...}
""",
} }
@ -569,7 +560,7 @@ class actions_server(osv.osv):
if exp.type == 'equation': if exp.type == 'equation':
obj_pool = self.pool.get(action.model_id.model) obj_pool = self.pool.get(action.model_id.model)
obj = obj_pool.browse(cr, uid, context['active_id'], context=context) obj = obj_pool.browse(cr, uid, context['active_id'], context=context)
expr = eval(euq, {'context':context, 'object': obj}) expr = eval(euq, {'context':context, 'object': obj, 'time':time})
else: else:
expr = exp.value expr = exp.value
res[exp.col1.name] = expr res[exp.col1.name] = expr
@ -593,7 +584,7 @@ class actions_server(osv.osv):
if exp.type == 'equation': if exp.type == 'equation':
obj_pool = self.pool.get(action.model_id.model) obj_pool = self.pool.get(action.model_id.model)
obj = obj_pool.browse(cr, uid, context['active_id'], context=context) obj = obj_pool.browse(cr, uid, context['active_id'], context=context)
expr = eval(euq, {'context':context, 'object': obj}) expr = eval(euq, {'context':context, 'object': obj, 'time':time})
else: else:
expr = exp.value expr = exp.value
res[exp.col1.name] = expr res[exp.col1.name] = expr

View File

@ -292,10 +292,7 @@ class module(osv.osv):
res = [0, 0] # [update, add] res = [0, 0] # [update, add]
# iterate through installed modules and mark them as being so # iterate through installed modules and mark them as being so
for name in addons.get_modules(): for mod_name in addons.get_modules():
mod_name = name
if name[-4:]=='.zip':
mod_name=name[:-4]
ids = self.search(cr, uid, [('name','=',mod_name)]) ids = self.search(cr, uid, [('name','=',mod_name)])
if ids: if ids:
id = ids[0] id = ids[0]
@ -304,8 +301,7 @@ class module(osv.osv):
if terp.get('installable', True) and mod.state == 'uninstallable': if terp.get('installable', True) and mod.state == 'uninstallable':
self.write(cr, uid, id, {'state': 'uninstalled'}) self.write(cr, uid, id, {'state': 'uninstalled'})
if parse_version(terp.get('version', '')) > parse_version(mod.latest_version or ''): if parse_version(terp.get('version', '')) > parse_version(mod.latest_version or ''):
self.write(cr, uid, id, { self.write(cr, uid, id, { 'url': ''})
'url': ''})
res[0] += 1 res[0] += 1
self.write(cr, uid, id, { self.write(cr, uid, id, {
'description': terp.get('description', ''), 'description': terp.get('description', ''),
@ -314,28 +310,16 @@ class module(osv.osv):
'website': terp.get('website', ''), 'website': terp.get('website', ''),
'license': terp.get('license', 'GPL-2'), 'license': terp.get('license', 'GPL-2'),
}) })
cr.execute('DELETE FROM ir_module_module_dependency\ cr.execute('DELETE FROM ir_module_module_dependency WHERE module_id = %s', (id,))
WHERE module_id = %s', (id,)) self._update_dependencies(cr, uid, ids[0], terp.get('depends', []))
self._update_dependencies(cr, uid, ids[0], terp.get('depends', self._update_category(cr, uid, ids[0], terp.get('category', 'Uncategorized'))
[]))
self._update_category(cr, uid, ids[0], terp.get('category',
'Uncategorized'))
continue continue
terp_file = addons.get_module_resource(name, '__terp__.py') mod_path = addons.get_module_path(mod_name)
mod_path = addons.get_module_path(name) if mod_path:
if mod_path and (os.path.isdir(mod_path) or os.path.islink(mod_path) or zipfile.is_zipfile(mod_path)):
terp = self.get_module_info(mod_name) terp = self.get_module_info(mod_name)
if not terp or not terp.get('installable', True): if not terp or not terp.get('installable', True):
continue continue
#if not os.path.isfile( mod_path ):
# import imp
# path = imp.find_module(mod_name, [addons.ad, addons._ad])
# imp.load_module(name, *path)
#else:
# import zipimport
# zimp = zipimport.zipimporter(mod_path)
# zimp.load_module(mod_name)
id = self.create(cr, uid, { id = self.create(cr, uid, {
'name': mod_name, 'name': mod_name,
'state': 'uninstalled', 'state': 'uninstalled',
@ -349,8 +333,6 @@ class module(osv.osv):
self._update_dependencies(cr, uid, id, terp.get('depends', [])) self._update_dependencies(cr, uid, id, terp.get('depends', []))
self._update_category(cr, uid, id, terp.get('category', 'Uncategorized')) self._update_category(cr, uid, id, terp.get('category', 'Uncategorized'))
#import socket
#socket.setdefaulttimeout(10)
for repository in robj.browse(cr, uid, robj.search(cr, uid, [])): for repository in robj.browse(cr, uid, robj.search(cr, uid, [])):
try: try:
index_page = urllib.urlopen(repository.url).read() index_page = urllib.urlopen(repository.url).read()
@ -363,9 +345,7 @@ class module(osv.osv):
modules = re.findall(repository.filter, index_page, re.I+re.M) modules = re.findall(repository.filter, index_page, re.I+re.M)
mod_sort = {} mod_sort = {}
for m in modules: for m in modules:
name = m[0] name, version, extension = m[0], m[1], m[-1]
version = m[1]
extension = m[-1]
if version == 'x': # 'x' version was a mistake if version == 'x': # 'x' version was a mistake
version = '0' version = '0'
if name in mod_sort: if name in mod_sort:
@ -390,16 +370,13 @@ class module(osv.osv):
if installed_version == 'x': # 'x' version was a mistake if installed_version == 'x': # 'x' version was a mistake
installed_version = '0' installed_version = '0'
if parse_version(version) > parse_version(installed_version): if parse_version(version) > parse_version(installed_version):
self.write(cr, uid, id, { self.write(cr, uid, id, { 'url': url })
'url': url
})
res[0] += 1 res[0] += 1
published_version = self.read(cr, uid, id, ['published_version'])['published_version'] published_version = self.read(cr, uid, id, ['published_version'])['published_version']
if published_version == 'x' or not published_version: if published_version == 'x' or not published_version:
published_version = '0' published_version = '0'
if parse_version(version) > parse_version(published_version): if parse_version(version) > parse_version(published_version):
self.write(cr, uid, id, self.write(cr, uid, id, {'published_version': version})
{'published_version': version})
return res return res
def download(self, cr, uid, ids, download=True, context=None): def download(self, cr, uid, ids, download=True, context=None):

View File

@ -3,6 +3,18 @@
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20"> <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first"> <pageTemplate id="first">
<frame id="first" x1="42.0" y1="42.0" width="511" height="758"/> <frame id="first" x1="42.0" y1="42.0" width="511" height="758"/>
<header>
<pageGraphics>
<setFont name="Helvetica-Bold" size="9"/>
<drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
<drawRightString x="20cm" y="28.1cm"> Reference Guide </drawRightString>
<lineMode width="0.7"/>
<stroke color="black"/>
<lines>1cm 28cm 20cm 28cm</lines>
</pageGraphics>
</header>
</pageTemplate> </pageTemplate>
</template> </template>
<stylesheet> <stylesheet>
@ -95,6 +107,7 @@
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_11" fontName="Helvetica-Bold" fontSize="11.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
@ -105,37 +118,28 @@
<para style="Standard"> <para style="Standard">
<font color="white"> </font> <font color="white"> </font>
</para> </para>
<blockTable colWidths="139.0,220.0,152.0" repeatRows="1" style="Table1">
<tr>
<td>
<para style="terp_header_Centre">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_header_Centre">Reference Guide</para>
</td>
<td>
<para style="terp_header_Centre">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">Introspection report on objects</para>
</td>
<td>
<para style="terp_default_Right_9">Printed: [[ time.strftime('%y-%m-%d')]]</para>
</td>
</tr>
</blockTable>
<para style="Standard"> <para style="Standard">
<font color="white"> </font> <font color="white"> </font>
</para> </para>
<blockTable colWidths="19.0,220.0,12.0" repeatRows="1" style="Table1">
<tr>
<td>
<para style="terp_header_Centre">
</para>
</td>
<td>
<para style="terp_default_11">Introspection report on objects</para>
</td>
<td>
<para style="terp_header_Centre">
</para>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</blockTable>
<section> <section>
<para style="Text body">[[ repeatIn(objects, 'module') ]]</para> <para style="Text body">[[ repeatIn(objects, 'module') ]]</para>
<blockTable colWidths="102.0,102.0,102.0,102.0,102.0" style="module_tbl_heading"> <blockTable colWidths="102.0,102.0,102.0,102.0,102.0" style="module_tbl_heading">

View File

@ -1,31 +0,0 @@
#!/bin/bash
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be)
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contact a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
./module_graph.py $@ | dot -Tpng -o > module_graph.png

View File

@ -263,7 +263,7 @@ class xmlrpc(object):
class GenericXMLRPCRequestHandler: class GenericXMLRPCRequestHandler:
def _dispatch(self, method, params): def _dispatch(self, method, params):
#print 'TERP-CALL : ',method, params # print 'TERP-CALL : ',method, params
import traceback import traceback
try: try:
n = self.path.split("/")[-1] n = self.path.split("/")[-1]
@ -398,8 +398,6 @@ class TinySocketClientThread(threading.Thread):
ts.mysend(r) ts.mysend(r)
except Exception, e: except Exception, e:
tb_s = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) tb_s = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
print e
print tb_s
import tools import tools
if tools.config['debug_mode']: if tools.config['debug_mode']:
import pdb import pdb

View File

@ -658,7 +658,6 @@ class related(function):
return [(self._arg[0], 'in', sarg)] return [(self._arg[0], 'in', sarg)]
def _fnct_write(self,obj,cr, uid, ids, field_name, values, args, context=None): def _fnct_write(self,obj,cr, uid, ids, field_name, values, args, context=None):
print 'Related Write', obj._name
if values and field_name: if values and field_name:
self._field_get2(cr, uid, obj, context) self._field_get2(cr, uid, obj, context)
relation = obj._name relation = obj._name

View File

@ -714,8 +714,7 @@ class orm_template(object):
translation_obj = self.pool.get('ir.translation') translation_obj = self.pool.get('ir.translation')
model_access_obj = self.pool.get('ir.model.access') model_access_obj = self.pool.get('ir.model.access')
for parent in self._inherits: for parent in self._inherits:
res.update(self.pool.get(parent).fields_get(cr, user, fields, res.update(self.pool.get(parent).fields_get(cr, user, fields, context))
context))
for f in self._columns.keys(): for f in self._columns.keys():
if fields and f not in fields: if fields and f not in fields:
continue continue
@ -732,12 +731,10 @@ class orm_template(object):
and getattr(self._columns[f], arg): and getattr(self._columns[f], arg):
res[f][arg] = getattr(self._columns[f], arg) res[f][arg] = getattr(self._columns[f], arg)
res_trans = translation_obj._get_source(cr, user, res_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'field', context.get('lang', False) or 'en_US')
self._name + ',' + f, 'field', context.get('lang', False) or 'en_US')
if res_trans: if res_trans:
res[f]['string'] = res_trans res[f]['string'] = res_trans
help_trans = translation_obj._get_source(cr, user, help_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'help', context.get('lang', False) or 'en_US')
self._name + ',' + f, 'help', context.get('lang', False) or 'en_US')
if help_trans: if help_trans:
res[f]['help'] = help_trans res[f]['help'] = help_trans
@ -749,9 +746,7 @@ class orm_template(object):
for (key, val) in sel: for (key, val) in sel:
val2 = None val2 = None
if val: if val:
val2 = translation_obj._get_source(cr, user, val2 = translation_obj._get_source(cr, user, self._name + ',' + f, 'selection', context.get('lang', False) or 'en_US', val)
self._name + ',' + f, 'selection',
context.get('lang', False) or 'en_US', val)
sel2.append((key, val2 or val)) sel2.append((key, val2 or val))
sel = sel2 sel = sel2
res[f]['selection'] = sel res[f]['selection'] = sel

View File

@ -22,8 +22,8 @@
############################################################################## ##############################################################################
name = 'openerp-server' name = 'openerp-server'
version = '5.0.0-rc1' version = '5.0.0_rc1'
major_version = version.rsplit('.', 1)[0] major_version = '5.0'
description = 'OpenERP Server' description = 'OpenERP Server'
long_desc = '''\ long_desc = '''\
OpenERP is a complete ERP and CRM. The main features are accounting (analytic OpenERP is a complete ERP and CRM. The main features are accounting (analytic

View File

@ -613,7 +613,7 @@ class report_sxw(report_rml):
else: else:
ir_menu_report_obj = pool.get('ir.ui.menu') ir_menu_report_obj = pool.get('ir.ui.menu')
report_menu_ids = ir_menu_report_obj.search(cr, uid, report_menu_ids = ir_menu_report_obj.search(cr, uid,
[('id', '=', ids)], context=context) [('id', 'in', ids)], context=context)
if report_menu_ids: if report_menu_ids:
report_name = ir_menu_report_obj.browse(cr, uid, report_menu_ids[0], report_name = ir_menu_report_obj.browse(cr, uid, report_menu_ids[0],
context=context) context=context)

View File

@ -117,7 +117,7 @@ class Cursor(object):
if self.sql_log: if self.sql_log:
now = mdt.now() now = mdt.now()
res = self._obj.execute(query, p or None) res = self._obj.execute(query, p or None)
if self.sql_log: if self.sql_log:
@ -213,15 +213,15 @@ class PoolManager(object):
logger = netsvc.Logger() logger = netsvc.Logger()
try: try:
logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Connecting to %s' % (db_name,)) logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Connecting to %s' % (db_name,))
PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(0, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name) PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(1, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name)
except Exception, e: except Exception, e:
logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %r' % (db_name, e)) logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %s' % (db_name, e.message))
raise raise
return PoolManager._pools[db_name] return PoolManager._pools[db_name]
get = staticmethod(get) get = staticmethod(get)
def close(db_name): def close(db_name):
if db_name is PoolManager._pools: if db_name in PoolManager._pools:
logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Closing all connections to %s' % (db_name,)) logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Closing all connections to %s' % (db_name,))
PoolManager._pools[db_name].closeall() PoolManager._pools[db_name].closeall()
del PoolManager._pools[db_name] del PoolManager._pools[db_name]

View File

@ -289,11 +289,13 @@ form: module.record_id""" % (xml_id,)
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.report.xml", self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode) id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.report.xml", self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode)
self.idref[xml_id] = int(id) self.idref[xml_id] = int(id)
if not rec.hasAttribute('menu') or eval(rec.getAttribute('menu')): if not rec.hasAttribute('menu') or eval(rec.getAttribute('menu')):
keyword = str(rec.getAttribute('keyword') or 'client_print_multi') keyword = str(rec.getAttribute('keyword') or 'client_print_multi')
keys = [('action',keyword),('res_model',res['model'])] keys = [('action',keyword),('res_model',res['model'])]
value = 'ir.actions.report.xml,'+str(id) value = 'ir.actions.report.xml,'+str(id)
replace = rec.hasAttribute('replace') and rec.getAttribute("replace") replace = rec.hasAttribute('replace') and rec.getAttribute("replace") or True
self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', keyword, res['name'], [res['model']], value, replace=replace, isobject=True, xml_id=xml_id) self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', keyword, res['name'], [res['model']], value, replace=replace, isobject=True, xml_id=xml_id)
return False return False
@ -426,7 +428,7 @@ form: module.record_id""" % (xml_id,)
keyword = 'client_action_relate' keyword = 'client_action_relate'
keys = [('action', keyword), ('res_model', res_model)] keys = [('action', keyword), ('res_model', res_model)]
value = 'ir.actions.act_window,'+str(id) value = 'ir.actions.act_window,'+str(id)
replace = rec.hasAttribute('replace') and rec.getAttribute('replace') replace = rec.hasAttribute('replace') and rec.getAttribute('replace') or True
self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', keyword, xml_id, [src_model], value, replace=replace, isobject=True, xml_id=xml_id) self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', keyword, xml_id, [src_model], value, replace=replace, isobject=True, xml_id=xml_id)
# TODO add remove ir.model.data # TODO add remove ir.model.data
return False return False

View File

@ -531,12 +531,14 @@ def is_hashable(h):
except TypeError: except TypeError:
return False return False
#
# Use it as a decorator of the function you plan to cache
# Timeout: 0 = no timeout, otherwise in seconds
#
class cache(object): class cache(object):
"""
Use it as a decorator of the function you plan to cache
Timeout: 0 = no timeout, otherwise in seconds
"""
def __init__(self, timeout=10000, skiparg=2, multi=None): def __init__(self, timeout=10000, skiparg=2, multi=None):
assert skiparg >= 2 # at least self and cr
self.timeout = timeout self.timeout = timeout
self.skiparg = skiparg self.skiparg = skiparg
self.multi = multi self.multi = multi
@ -553,9 +555,9 @@ class cache(object):
del self.cache[kwargs['clear_keys']] del self.cache[kwargs['clear_keys']]
return True return True
# Update named arguments with positional argument values # Update named arguments with positional argument values (without self and cr)
kwargs2 = kwargs.copy() kwargs2 = kwargs.copy()
kwargs2.update(dict(zip(arg_names, args))) kwargs2.update(dict(zip(arg_names, args[self.skiparg-2:])))
for k in kwargs2: for k in kwargs2:
if isinstance(kwargs2[k], (list, dict, set)): if isinstance(kwargs2[k], (list, dict, set)):
kwargs2[k] = tuple(kwargs2[k]) kwargs2[k] = tuple(kwargs2[k])
@ -577,7 +579,7 @@ class cache(object):
# Work out new value, cache it and return it # Work out new value, cache it and return it
# FIXME Should copy() this value to avoid futur modifications of the cache ? # FIXME Should copy() this value to avoid futur modifications of the cache ?
# FIXME What about exceptions ? # FIXME What about exceptions ?
result = fn(self2,cr,*args, **kwargs) result = fn(self2, cr, *args, **kwargs)
self.cache[key] = (result, time.time()) self.cache[key] = (result, time.time())
return result return result

View File

@ -1,68 +0,0 @@
* What is this package?
PyChart is a Python library for creating professional quality PS, PDF,
PNG, or SVG charts. It supports line plots, bar plots, range-fill
plots, and pie charts. Because it is based on Python, you can make
the full use of Python's scripting power.
The PyChart home page is at
http://www.hpl.hp.com/personal/Yasushi_Saito/pychart
* What you need
You need Python (http://www.python.org) version 2.2 or later (on
Debian GNU/Linux, you need, python-xml package as well). You also need
Ghostscript (http://www.cs.wisc.edu/~ghost/) to produce PNG
files.
Pychart used to require Ghostscript during PS and PDF
generation to obtain font metric information, but that's no
longer the case.
* Platforms supported
In theory, PyChart works on any platform with Python. In practice,
I've run PyChart on Linux and Win2000.
* Installation
Become a root and do:
# python setup.py install
Or, you can set PYTHONPATH environment variable before you start
Python. For example (in bash):
% PYTHONPATH=~/PyChart-1.33/pychart python mumbo.py
* Documentation
A detailed documentation is found in doc/pychart.
* Examples
All the *.py files in the demos/ directory can be run directly. For
example,
setenv PYTHONPATH ..
python linetest.py >foo.eps
gs foo.eps
or
setenv PYTHONPATH ..
setenv PYCHART_OPTIONS="format=pdf"
python linetest.py >foo.pdf
acroread foo.pdf
* About the author
Yasushi Saito (ysaito@hpl.hp.com), a full-time researcher and
part-time hacker. This program is created mainly to serve my personal
needs to write pretty charts for research papers. As such, it is
updated only when I'm writing a paper, which happens about once every
half year or so.
Anyway, if you have comments, requests, or (even better)
fixes/enhancements, feel free to email me.

View File

@ -36,10 +36,6 @@ from stat import ST_MODE
from distutils.core import setup, Command from distutils.core import setup, Command
from distutils.command.install import install from distutils.command.install import install
from distutils.command.build import build
from distutils.command.build_scripts import build_scripts
from distutils.command.install_scripts import install_scripts
from distutils.file_util import copy_file
if os.name == 'nt': if os.name == 'nt':
import py2exe import py2exe
@ -91,7 +87,6 @@ def data_files():
os.chdir('..') os.chdir('..')
for (dp,dn,names) in os.walk('doc'): for (dp,dn,names) in os.walk('doc'):
files.append((dp, map(lambda x: opj(dp, x), names))) files.append((dp, map(lambda x: opj(dp, x), names)))
files.append(('.', [(opj('bin', 'import_xml.rng'))]))
else: else:
man_directory = opj('share', 'man') man_directory = opj('share', 'man')
files.append((opj(man_directory, 'man1'), ['man/openerp-server.1'])) files.append((opj(man_directory, 'man1'), ['man/openerp-server.1']))
@ -104,12 +99,9 @@ def data_files():
openerp_site_packages = opj('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server') openerp_site_packages = opj('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server')
files.append((openerp_site_packages, [('bin/import_xml.rng')]))
for addon in find_addons(): for addon in find_addons():
add_path = addon.replace('.', os.path.sep).replace('openerp-server', 'bin', 1) add_path = addon.replace('.', os.path.sep).replace('openerp-server', 'bin', 1)
addon_path = opj('lib', 'python%s' % py_short_version, 'site-packages', add_path.replace('bin', 'openerp-server', 1)) addon_path = opj('lib', 'python%s' % py_short_version, 'site-packages', add_path.replace('bin', 'openerp-server', 1))
pathfiles = [] pathfiles = []
for root, dirs, innerfiles in os.walk(add_path): for root, dirs, innerfiles in os.walk(add_path):
innerfiles = filter(lambda file: os.path.splitext(file)[1] not in ('.pyc', '.py', '.pyd', '.pyo'), innerfiles) innerfiles = filter(lambda file: os.path.splitext(file)[1] not in ('.pyc', '.py', '.pyd', '.pyo'), innerfiles)
@ -121,7 +113,7 @@ def data_files():
check_modules() check_modules()
f = file('openerp-server','w') f = file('openerp-server','w')
start_script = """#!/bin/sh\necho "OpenERP Setup - The content of this file is generated at the install stage" """ start_script = """#!/bin/sh\necho "OpenERP Setup - The content of this file is generated at the install stage\n" """
f.write(start_script) f.write(start_script)
f.close() f.close()
@ -177,13 +169,7 @@ setup(name = name,
'openerp-server.workflow'] + \ 'openerp-server.workflow'] + \
list(find_addons()), list(find_addons()),
package_dir = {'openerp-server': 'bin'}, package_dir = {'openerp-server': 'bin'},
console = [ console = [ { "script" : "bin\\openerp-server.py", "icon_resources" : [ (1,"pixmaps\\openerp-icon.ico") ] } ],
{ "script" : "bin\\openerp-server.py",
"icon_resources" : [
(1,"pixmaps\\openerp-icon.ico")
]
}
],
options = options, options = options,
) )