[tryton-debian-vcs] tryton-server branch upstream-1.8 created. 5e9845cb511b14c67dbb8dc8c2460874960276ae
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Wed Nov 27 17:15:14 UTC 2013
The following commit has been merged in the upstream-1.8 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-server.git;a=commitdiff;h=5e9845cb511b14c67dbb8dc8c2460874960276ae
commit 5e9845cb511b14c67dbb8dc8c2460874960276ae
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Oct 10 17:42:18 2011 +0200
Adding upstream version 1.8.4.
diff --git a/CHANGELOG b/CHANGELOG
index 4a2cf5a..94ca191 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 1.8.4 - 2011-10-01
+* Bug fixes (see mercurial logs for details)
+
Version 1.8.3 - 2011-05-29
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index e297841..a0e511e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: trytond
-Version: 1.8.3
+Version: 1.8.4
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index e297841..a0e511e 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: trytond
-Version: 1.8.3
+Version: 1.8.4
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/trytond/backend/database.py b/trytond/backend/database.py
index 168d1f9..f144646 100644
--- a/trytond/backend/database.py
+++ b/trytond/backend/database.py
@@ -112,6 +112,8 @@ class CursorInterface(object):
:param context: the context
:return: the cache dictionary
'''
+ from trytond.transaction import Transaction
+ user = Transaction().user
if context is None:
context = {}
cache_ctx = context.copy()
@@ -119,7 +121,7 @@ class CursorInterface(object):
'_delete_records'):
if i in cache_ctx:
del cache_ctx[i]
- return self.cache.setdefault(repr(cache_ctx), {})
+ return self.cache.setdefault((user, repr(cache_ctx)), {})
def execute(self, sql, params=None):
'''
diff --git a/trytond/backend/mysql/init.sql b/trytond/backend/mysql/init.sql
index fc68a7e..c26db83 100644
--- a/trytond/backend/mysql/init.sql
+++ b/trytond/backend/mysql/init.sql
@@ -75,6 +75,7 @@ ALTER TABLE res_user ADD CONSTRAINT res_user_login_uniq UNIQUE (login);
INSERT INTO res_user (id, login, password, name, active) VALUES (0, 'root', NULL, 'Root', False);
UPDATE res_user set id = 0;
+ALTER TABLE res_user AUTO_INCREMENT = 1;
CREATE TABLE res_group (
id BIGINT AUTO_INCREMENT NOT NULL,
@@ -120,7 +121,7 @@ CREATE TABLE wkf_transition (
act_to BIGINT,
`condition` VARCHAR(255),
trigger_expr_id VARCHAR(255),
- signal VARCHAR(255),
+ `signal` VARCHAR(255),
`group` BIGINT,
PRIMARY KEY(id),
CONSTRAINT wkf_transition_act_from_fkey FOREIGN KEY (act_from) REFERENCES wkf_activity (id) ON DELETE CASCADE,
diff --git a/trytond/ir/rule.py b/trytond/ir/rule.py
index 9cf62eb..cce6520 100644
--- a/trytond/ir/rule.py
+++ b/trytond/ir/rule.py
@@ -191,8 +191,11 @@ class Rule(ModelSQL, ModelView):
with contextlib.nested(Transaction().set_user(0),
Transaction().set_context(user=0)):
for rule in self.browse(ids):
+ operator = rule.operator
+ if operator == '<>':
+ operator = '!='
dom = safe_eval("[('%s', '%s', %s)]" % \
- (rule.field.name, rule.operator,
+ (rule.field.name, operator,
operand2query[rule.operand]), {
'user': self.pool.get('res.user').browse(user),
'time': time,
diff --git a/trytond/ir/ui/board.rnc b/trytond/ir/ui/board.rnc
index 0666280..19fd9c1 100644
--- a/trytond/ir/ui/board.rnc
+++ b/trytond/ir/ui/board.rnc
@@ -144,5 +144,6 @@ attlist.xpath &=
attribute position { "inside" | "replace" | "replace_attributes" | "after" | "before" }?
action = element action { attlist.action, empty }
attlist.action &= attribute name { text }
+attlist.action &= [ a:defaultValue = "1" ] attribute colspan { text }?
label |= notAllowed
start = data | board | label
diff --git a/trytond/ir/ui/board.rng b/trytond/ir/ui/board.rng
index a0c90e3..06d6850 100644
--- a/trytond/ir/ui/board.rng
+++ b/trytond/ir/ui/board.rng
@@ -447,6 +447,11 @@
<define name="attlist.action" combine="interleave">
<attribute name="name"/>
</define>
+ <define name="attlist.action" combine="interleave">
+ <optional>
+ <attribute name="colspan" a:defaultValue="1"/>
+ </optional>
+ </define>
<define name="label" combine="choice">
<notAllowed/>
</define>
diff --git a/trytond/model/browse.py b/trytond/model/browse.py
index 12d4a98..f66a9eb 100644
--- a/trytond/model/browse.py
+++ b/trytond/model/browse.py
@@ -171,7 +171,9 @@ class BrowseRecord(object):
data[i] = BrowseRecordList(BrowseRecord(
x, model, local_cache=self._local_cache)
for x in data[i])
- if isinstance(j, fields.Function):
+ if (isinstance(j, fields.Function)
+ or isinstance(data[i], (BrowseRecord,
+ BrowseRecordList))):
self._local_data.setdefault(data['id'], {})[i] = data[i]
del data[i]
self._data[data['id']].update(data)
diff --git a/trytond/model/fields/field.py b/trytond/model/fields/field.py
index 83233e4..e9e7ec7 100644
--- a/trytond/model/fields/field.py
+++ b/trytond/model/fields/field.py
@@ -11,11 +11,12 @@ def domain_validate(value):
if isinstance(arg, basestring):
if arg not in ('AND', 'OR'):
return False
- elif isinstance(arg, tuple) or \
- (isinstance(arg, list) and len(arg) > 2 and \
- (arg[1] in OPERATORS) or \
- (isinstance(arg[1], PYSON) and \
- arg[1].types() == set([str]))):
+ elif (isinstance(arg, tuple)
+ or (isinstance(arg, list)
+ and len(arg) > 2
+ and ((arg[1] in OPERATORS)
+ or (isinstance(arg[1], PYSON)
+ and arg[1].types() == set([str]))))):
pass
elif isinstance(arg, list):
if not test_domain(arg):
diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py
index 8d1ae76..d3a9914 100644
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -253,8 +253,9 @@ class ModelSQL(ModelStorage):
'write_uid', 'write_date'):
default.append(i)
for i in self._inherit_fields.keys():
- if (not i in values) \
- and (not self._inherit_fields[i][0] in avoid_table):
+ if ((not i in values)
+ and (not self._inherit_fields[i][0] in avoid_table)
+ and i in self._defaults):
default.append(i)
if len(default):
@@ -265,6 +266,8 @@ class ModelSQL(ModelStorage):
if field in ('create_uid', 'create_date',
'write_uid', 'write_date'):
del defaults[field]
+ if field in values:
+ del defaults[field]
values.update(self._clean_defaults(defaults))
(upd0, upd1, upd2) = ('', '', [])
@@ -1344,7 +1347,7 @@ class ModelSQL(ModelStorage):
table_query = '(' + table_query + ') AS '
table_join = 'LEFT JOIN ' + table_query + \
'"' + itable._table + '" ON ' \
- '"%s".id = "%s".%s' % (itable._table, self._table,
+ '"%s".id = "%s"."%s"' % (itable._table, self._table,
self._inherits[itable._name])
if table_join not in tables:
tables.append(table_join)
@@ -1578,7 +1581,7 @@ class ModelSQL(ModelStorage):
if isinstance(domain[i][2], basestring):
field_obj = self.pool.get(field.model_name)
res_ids = field_obj.search([
- (field_obj._rec_name, domain[i][1], domain[i][2]),
+ ('rec_name', domain[i][1], domain[i][2]),
], order=[])
domain[i] = (domain[i][0], 'in', res_ids, table)
else:
@@ -1813,7 +1816,7 @@ class ModelSQL(ModelStorage):
otype)
table_join = 'LEFT JOIN "' + table_name + '" AS ' \
'"' + table_name + '.' + link_field + '" ON ' \
- '"%s.%s".id = "%s".%s' % (table_name, link_field,
+ '"%s.%s".id = "%s"."%s"' % (table_name, link_field,
self._table, link_field)
for i in range(len(order_by)):
if table_name in order_by[i]:
@@ -1849,7 +1852,7 @@ class ModelSQL(ModelStorage):
table_join = 'LEFT JOIN "' + table_name + '" AS ' \
'"' + table_name + '.' + link_field + '" ON ' \
- '"%s.%s".id = "%s".%s' % \
+ '"%s.%s".id = "%s"."%s"' % \
(table_name, link_field, self._table, link_field)
for i in range(len(order_by)):
if table_name in order_by[i]:
@@ -1868,7 +1871,7 @@ class ModelSQL(ModelStorage):
table_join2 = 'LEFT JOIN "' + table_name2 + '" AS ' \
'"' + table_name2 + '.' + link_field2 + '" ON ' \
- '"%s.%s".id = "%s.%s".%s' % \
+ '"%s.%s".id = "%s.%s"."%s"' % \
(table_name2, link_field2, table_name, link_field,
link_field2)
for i in range(len(order_by)):
@@ -1976,7 +1979,7 @@ class ModelSQL(ModelStorage):
link_field = self._inherits[obj._name]
order_by, tables, tables_args = obj._order_calc(field, otype)
table_join = 'LEFT JOIN "' + table_name + '" ON ' \
- '"%s".id = "%s".%s' % \
+ '"%s".id = "%s"."%s"' % \
(table_name, self._table, link_field)
if table_join not in tables:
tables.insert(0, table_join)
diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py
index ed9fdee..8203d01 100644
--- a/trytond/model/modelstorage.py
+++ b/trytond/model/modelstorage.py
@@ -21,6 +21,7 @@ from trytond.tools import safe_eval, reduce_domain
from trytond.pyson import PYSONEncoder, PYSONDecoder, PYSON
from trytond.const import OPERATORS
from trytond.transaction import Transaction
+from trytond.config import CONFIG
class ModelStorage(Model):
@@ -522,7 +523,13 @@ class ModelStorage(Model):
break
field_name = fields_tree[i]
model_obj = self.pool.get(value._model_name)
- field = model_obj._columns[field_name]
+ if field_name in model_obj._columns:
+ field = model_obj._columns[field_name]
+ elif field_name in model_obj._inherit_fields:
+ field = model_obj._inherit_fields[field_name][2]
+ else:
+ raise Exception('Field %s not available on object "%s"'
+ % (field_name, model_obj._name))
if field.states and 'invisible' in field.states:
pyson_invisible = PYSONEncoder().encode(
field.states['invisible'])
@@ -1065,7 +1072,8 @@ class ModelStorage(Model):
error_args=self._get_error_args(field_name))
# validate digits
- if hasattr(field, 'digits') and field.digits:
+ if (hasattr(field, 'digits') and field.digits
+ and CONFIG.options['db_type'] != 'mysql'):
if is_pyson(field.digits):
pyson_digits = PYSONEncoder().encode(field.digits)
for record in records:
diff --git a/trytond/tests/test_tools.py b/trytond/tests/test_tools.py
index 60005ef..c6bb78c 100644
--- a/trytond/tests/test_tools.py
+++ b/trytond/tests/test_tools.py
@@ -118,6 +118,8 @@ class ToolsTestCase(unittest.TestCase):
['OR', clause, ['AND', clause, ['OR', clause, clause]]]),
(['OR', [clause]], ['OR', ['AND', clause]]),
([], []),
+ (['OR', clause, []], ['OR', clause, []]),
+ (['AND', clause, []], ['AND', clause, []]),
)
for i, j in tests:
self.assertEqual(reduce_domain(i), j,
diff --git a/trytond/tools/misc.py b/trytond/tools/misc.py
index 0639eab..1868334 100644
--- a/trytond/tools/misc.py
+++ b/trytond/tools/misc.py
@@ -469,4 +469,6 @@ def reduce_domain(domain):
result.extend(sub_domain[1:])
else:
result.append(sub_domain)
+ else:
+ result.append(arg)
return result
diff --git a/trytond/version.py b/trytond/version.py
index 69ac2f7..6867bf1 100644
--- a/trytond/version.py
+++ b/trytond/version.py
@@ -1,7 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
PACKAGE = "trytond"
-VERSION = "1.8.3"
+VERSION = "1.8.4"
LICENSE = "GPL-3"
WEBSITE = "http://www.tryton.org/"
commit a7a452c5d85a9e55e1cd0c2cbd772282972f4c05
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Aug 7 16:36:22 2011 +0200
Adding upstream version 1.8.3.
diff --git a/CHANGELOG b/CHANGELOG
index c8b8dd1..4a2cf5a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 1.8.3 - 2011-05-29
+* Bug fixes (see mercurial logs for details)
+
Version 1.8.2 - 2011-02-13
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index 1e0a2fd..e297841 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: trytond
-Version: 1.8.2
+Version: 1.8.3
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/setup.py b/setup.py
index 6d56602..4ad58f7 100644
--- a/setup.py
+++ b/setup.py
@@ -31,6 +31,7 @@ setup(name=PACKAGE,
'trytond.res': ['*.xml', '*.csv'],
'trytond.webdav': ['*.xml', '*.csv'],
'trytond.workflow': ['*.xml', '*.csv'],
+ 'trytond.test': ['*.xml'],
},
scripts=['bin/trytond'],
classifiers=[
diff --git a/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index 1e0a2fd..e297841 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: trytond
-Version: 1.8.2
+Version: 1.8.3
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/trytond/backend/sqlite/table.py b/trytond/backend/sqlite/table.py
index aa31c7b..6d942b7 100644
--- a/trytond/backend/sqlite/table.py
+++ b/trytond/backend/sqlite/table.py
@@ -91,9 +91,26 @@ class TableHandler(TableHandlerInterface):
def column_rename(self, old_name, new_name, exception=False):
if self.column_exist(old_name) and \
not self.column_exist(new_name):
- self.cursor.execute('ALTER TABLE "%s" ' \
- 'RENAME COLUMN "%s" TO "%s"' %
- (self.table_name, old_name, new_name))
+ temp_table = '_temp_%s' % self.table_name
+ TableHandler.table_rename(self.cursor, self.table_name,
+ temp_table)
+ new_table = TableHandler(self.cursor, self._model,
+ history=self.history)
+ for column, (notnull, hasdef, size, typname) \
+ in self._columns.iteritems():
+ if column == old_name:
+ column = new_name
+ new_table.add_raw_column(column, typname, False,
+ field_size=size)
+ new_columns = new_table._columns.keys()
+ old_columns = [x if x != old_name else new_name
+ for x in new_columns]
+ self.cursor.execute(('INSERT INTO "%s" (' + \
+ ','.join('"%s"' % x for x in new_columns) + \
+ ') SELECT ' + \
+ ','.join('"%s"' % x for x in old_columns) + ' ' + \
+ 'FROM "%s"') % (self.table_name, temp_table))
+ self.cursor.execute('DROP TABLE "%s"' % temp_table)
elif exception and self.column_exist(new_name):
raise Exception('Unable to rename column %s.%s to %s.%s: ' \
'%s.%s already exist!' % \
diff --git a/trytond/ir/action.py b/trytond/ir/action.py
index abbe8bb..dfd1973 100644
--- a/trytond/ir/action.py
+++ b/trytond/ir/action.py
@@ -188,7 +188,8 @@ class ActionKeyword(ModelSQL, ModelView):
del res[-1]['report_content_data']
del res[-1]['report_content']
del res[-1]['style_content']
- res[-1]['email'] = encoder.encode(res[-1]['email'])
+ res[-1]['email'] = encoder.encode(safe_eval(res[-1]['email']
+ or '{}', CONTEXT))
elif action_keyword.action.type == 'ir.action.act_window':
for field in ('domain', 'context', 'search_value'):
del res[-1][field]
diff --git a/trytond/ir/ui/board.rnc b/trytond/ir/ui/board.rnc
index 7ddc22e..0666280 100644
--- a/trytond/ir/ui/board.rnc
+++ b/trytond/ir/ui/board.rnc
@@ -142,6 +142,7 @@ attlist.xpath &= attribute expr { text }
attlist.xpath &=
[ a:defaultValue = "inside" ]
attribute position { "inside" | "replace" | "replace_attributes" | "after" | "before" }?
-action |= notAllowed
+action = element action { attlist.action, empty }
+attlist.action &= attribute name { text }
label |= notAllowed
start = data | board | label
diff --git a/trytond/ir/ui/board.rng b/trytond/ir/ui/board.rng
index 066ddca..a0c90e3 100644
--- a/trytond/ir/ui/board.rng
+++ b/trytond/ir/ui/board.rng
@@ -438,8 +438,14 @@
</attribute>
</optional>
</define>
- <define name="action" combine="choice">
- <notAllowed/>
+ <define name="action">
+ <element name="action">
+ <ref name="attlist.action"/>
+ <empty/>
+ </element>
+ </define>
+ <define name="attlist.action" combine="interleave">
+ <attribute name="name"/>
</define>
<define name="label" combine="choice">
<notAllowed/>
diff --git a/trytond/model/modelsingleton.py b/trytond/model/modelsingleton.py
index b1aa220..f90d909 100644
--- a/trytond/model/modelsingleton.py
+++ b/trytond/model/modelsingleton.py
@@ -87,6 +87,9 @@ class ModelSingleton(ModelStorage):
return res
def default_get(self, fields_names, with_rec_name=True):
+ if '_timestamp' in fields_names:
+ fields_names = list(fields_names)
+ fields_names.remove('_timestamp')
res = super(ModelSingleton, self).default_get(fields_names,
with_rec_name=with_rec_name)
singleton_id = self.get_singleton_id()
diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py
index 09b43cd..8d1ae76 100644
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -622,11 +622,11 @@ class ModelSQL(ModelStorage):
for record in res:
record[field] = res2[field][record['id']]
- to_del = []
+ to_del = set()
fields_related2values = {}
for field in fields_related.keys() + datetime_fields:
if field not in fields_names:
- to_del.append(field)
+ to_del.add(field)
if field not in self._columns:
continue
if field not in fields_related.keys():
diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py
index a4292bf..8960019 100644
--- a/trytond/model/modelview.py
+++ b/trytond/model/modelview.py
@@ -131,7 +131,7 @@ class ModelView(Model):
cursor.execute('SELECT arch, field_childs, id, type, ' \
'inherit, model ' \
'FROM ir_ui_view ' \
- 'WHERE model = %s AND type = %s' \
+ 'WHERE model = %s AND type = %s ' \
'ORDER BY inherit DESC, priority ASC, id ASC',
(self._name, view_type))
sql_res = cursor.fetchone()
diff --git a/trytond/protocols/dispatcher.py b/trytond/protocols/dispatcher.py
index 2c9e192..501812a 100644
--- a/trytond/protocols/dispatcher.py
+++ b/trytond/protocols/dispatcher.py
@@ -71,8 +71,10 @@ def dispatch(host, port, protocol, database_name, user, session, object_type,
database = Database().connect()
try:
cursor = database.cursor()
- res = database.list(cursor)
- cursor.close(close=True)
+ try:
+ res = database.list(cursor)
+ finally:
+ cursor.close(close=True)
except Exception:
res = []
return res
diff --git a/trytond/protocols/webdav.py b/trytond/protocols/webdav.py
index fcb7156..f55d98e 100644
--- a/trytond/protocols/webdav.py
+++ b/trytond/protocols/webdav.py
@@ -82,7 +82,10 @@ class BaseThreadedHTTPServer(SocketServer.ThreadingMixIn,
def server_bind(self):
# Python < 2.6 doesn't handle self.timeout
- self.socket.settimeout(1)
+ if sys.version_info < (2, 6):
+ # breaks the socket under BSD, see http://bugs.python.org/issue7995
+ self.socket.settimeout(1)
+
self.socket.setsockopt(socket.SOL_SOCKET,
socket.SO_REUSEADDR, 1)
BaseHTTPServer.HTTPServer.server_bind(self)
@@ -167,12 +170,11 @@ class TrytonDAVInterface(iface.dav_interface):
dbname, dburi = self._get_dburi(uri)
if not dbname:
database = Database().connect()
+ cursor = database.cursor()
try:
- try:
- cursor = database.cursor()
- lists = database.list(cursor)
- except Exception:
- lists = []
+ lists = database.list(cursor)
+ except Exception:
+ lists = []
finally:
cursor.close()
for dbname in lists:
diff --git a/trytond/protocols/xmlrpc.py b/trytond/protocols/xmlrpc.py
index ee34534..e786f39 100644
--- a/trytond/protocols/xmlrpc.py
+++ b/trytond/protocols/xmlrpc.py
@@ -28,6 +28,7 @@ def dump_decimal(self, value, write):
write("</double></value>\n")
xmlrpclib.Marshaller.dispatch[Decimal] = dump_decimal
+xmlrpclib.Marshaller.dispatch[Float] = dump_decimal
xmlrpclib.Marshaller.dispatch[type(None)] = \
lambda self, value, write: self.dump_bool(bool(value), write)
xmlrpclib.Marshaller.dispatch[datetime.date] = \
diff --git a/trytond/res/group.py b/trytond/res/group.py
index 0c22e12..01eef03 100644
--- a/trytond/res/group.py
+++ b/trytond/res/group.py
@@ -23,6 +23,16 @@ class Group(ModelSQL, ModelView):
('name_uniq', 'unique (name)', 'The name of the group must be unique!')
]
+ def create(self, vals):
+ res = super(Group, self).create(vals)
+ # Restart the cache on the domain_get method
+ self.pool.get('ir.rule').domain_get.reset()
+ # Restart the cache for get_groups
+ self.pool.get('res.user').get_groups.reset()
+ # Restart the cache for get_preferences
+ self.pool.get('res.user').get_preferences.reset()
+ return res
+
def write(self, ids, vals):
res = super(Group, self).write(ids, vals)
# Restart the cache on the domain_get method
@@ -33,4 +43,14 @@ class Group(ModelSQL, ModelView):
self.pool.get('res.user').get_preferences.reset()
return res
+ def delete(self, ids):
+ res = super(Group, self).delete(ids)
+ # Restart the cache on the domain_get method
+ self.pool.get('ir.rule').domain_get.reset()
+ # Restart the cache for get_groups
+ self.pool.get('res.user').get_groups.reset()
+ # Restart the cache for get_preferences
+ self.pool.get('res.user').get_preferences.reset()
+ return res
+
Group()
diff --git a/trytond/res/ir.py b/trytond/res/ir.py
index 3bdf3dd..3aea3a3 100644
--- a/trytond/res/ir.py
+++ b/trytond/res/ir.py
@@ -22,6 +22,24 @@ class UIMenuGroup(ModelSQL):
self._table + '_id_seq')
super(UIMenuGroup, self).init(module_name)
+ def create(self, vals):
+ res = super(UIMenuGroup, self).create(vals)
+ # Restart the cache on the domain_get method
+ self.pool.get('ir.rule').domain_get.reset()
+ return res
+
+ def write(self, ids, vals):
+ res = super(UIMenuGroup, self).write(ids, vals)
+ # Restart the cache on the domain_get method
+ self.pool.get('ir.rule').domain_get.reset()
+ return res
+
+ def delete(self, ids):
+ res = super(UIMenuGroup, self).delete(ids)
+ # Restart the cache on the domain_get method
+ self.pool.get('ir.rule').domain_get.reset()
+ return res
+
UIMenuGroup()
@@ -42,6 +60,24 @@ class ActionGroup(ModelSQL):
self._table + '_id_seq')
super(ActionGroup, self).init(module_name)
+ def create(self, vals):
+ res = super(ActionGroup, self).create(vals)
+ # Restart the cache on the domain_get method
+ self.pool.get('ir.rule').domain_get.reset()
+ return res
+
+ def write(self, ids, vals):
+ res = super(ActionGroup, self).write(ids, vals)
+ # Restart the cache on the domain_get method
+ self.pool.get('ir.rule').domain_get.reset()
+ return res
+
+ def delete(self, ids):
+ res = super(ActionGroup, self).delete(ids)
+ # Restart the cache on the domain_get method
+ self.pool.get('ir.rule').domain_get.reset()
+ return res
+
ActionGroup()
diff --git a/trytond/res/user.py b/trytond/res/user.py
index ebc616e..3f2e4ac 100644
--- a/trytond/res/user.py
+++ b/trytond/res/user.py
@@ -145,7 +145,7 @@ class User(ModelSQL, ModelView):
transaction = Transaction()
for user_id in ids:
res[user_id] = get_connections(transaction.cursor.database_name,
- transaction.user)
+ user_id)
return res
def _convert_vals(self, vals):
diff --git a/trytond/server.py b/trytond/server.py
index 3258eba..5674253 100644
--- a/trytond/server.py
+++ b/trytond/server.py
@@ -86,26 +86,30 @@ class TrytonServer(object):
database = Database(db_name).connect()
cursor = database.cursor()
- if CONFIG['init']:
- if not cursor.test():
- self.logger.info("init db")
- Database.init(cursor)
- init[db_name] = True
- cursor.commit()
+ try:
+ if CONFIG['init']:
+ if not cursor.test():
+ self.logger.info("init db")
+ Database.init(cursor)
+ init[db_name] = True
+ cursor.commit()
+ elif not cursor.test():
+ raise Exception("'%s' is not a Tryton database!" % db_name)
+ finally:
cursor.close()
- elif not cursor.test():
- raise Exception("'%s' is not a Tryton database!" % db_name)
Pool.start()
for db_name in CONFIG["db_name"]:
cursor = Database(db_name).connect().cursor()
- if not cursor.test():
- raise Exception("'%s' is not a Tryton database!" % db_name)
- cursor.execute('SELECT code FROM ir_lang ' \
- 'WHERE translatable')
- lang = [x[0] for x in cursor.fetchall()]
- cursor.close()
+ try:
+ if not cursor.test():
+ raise Exception("'%s' is not a Tryton database!" % db_name)
+ cursor.execute('SELECT code FROM ir_lang ' \
+ 'WHERE translatable')
+ lang = [x[0] for x in cursor.fetchall()]
+ finally:
+ cursor.close()
update = bool(CONFIG['init'] or CONFIG['update'])
Pool(db_name).init(update=update, lang=lang)
@@ -128,17 +132,20 @@ class TrytonServer(object):
database = Database(db_name).connect()
cursor = database.cursor()
- salt = ''.join(random.sample(string.letters + string.digits, 8))
- password += salt
- if hashlib:
- password = hashlib.sha1(password).hexdigest()
- else:
- password = sha.new(password).hexdigest()
- cursor.execute('UPDATE res_user ' \
- 'SET password = %s, salt = %s ' \
- 'WHERE login = \'admin\'', (password, salt))
- cursor.commit()
- cursor.close()
+ try:
+ salt = ''.join(random.sample(
+ string.letters + string.digits, 8))
+ password += salt
+ if hashlib:
+ password = hashlib.sha1(password).hexdigest()
+ else:
+ password = sha.new(password).hexdigest()
+ cursor.execute('UPDATE res_user ' \
+ 'SET password = %s, salt = %s ' \
+ 'WHERE login = \'admin\'', (password, salt))
+ cursor.commit()
+ finally:
+ cursor.close()
if update:
self.logger.info('Update/Init succeed!')
diff --git a/trytond/tools/misc.py b/trytond/tools/misc.py
index 95092ba..0639eab 100644
--- a/trytond/tools/misc.py
+++ b/trytond/tools/misc.py
@@ -119,6 +119,8 @@ def file_open(name, mode="r", subdir='modules'):
name2 = False
while True:
head, tail = os.path.split(head)
+ if head == root_path:
+ break
if not tail:
break
if zipname:
diff --git a/trytond/version.py b/trytond/version.py
index f960b3b..69ac2f7 100644
--- a/trytond/version.py
+++ b/trytond/version.py
@@ -1,7 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
PACKAGE = "trytond"
-VERSION = "1.8.2"
+VERSION = "1.8.3"
LICENSE = "GPL-3"
WEBSITE = "http://www.tryton.org/"
diff --git a/trytond/webdav/webdav.py b/trytond/webdav/webdav.py
index 2962829..44ea623 100644
--- a/trytond/webdav/webdav.py
+++ b/trytond/webdav/webdav.py
@@ -6,6 +6,7 @@ import time
from trytond.model import ModelView, ModelSQL, fields
from trytond.version import PACKAGE, VERSION, WEBSITE
from trytond.tools import reduce_ids, safe_eval
+from trytond.transaction import Transaction
class Collection(ModelSQL, ModelView):
--
tryton-server
More information about the tryton-debian-vcs
mailing list