[tryton-debian-vcs] tryton-server branch debian-stretch-4.4 updated. debian/4.4.5-1-2-gc2501ea
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Wed Dec 13 10:43:34 UTC 2017
The following commit has been merged in the debian-stretch-4.4 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-server.git;a=commitdiff;h=debian/4.4.5-1-2-gc2501ea
commit c2501ea67a082af07ceb0072e8e3a602128c4e57
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Dec 12 19:33:16 2017 +0100
Releasing debian version 4.4.6-1.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/debian/changelog b/debian/changelog
index f5dc8e9..6d14a1e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+tryton-server (4.4.6-1) unstable; urgency=medium
+
+ * Merging upstream version 4.4.6.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Tue, 12 Dec 2017 19:33:16 +0100
+
tryton-server (4.4.5-1) unstable; urgency=medium
* Bump the Standards-Version to 4.1.1, no changes needed.
commit 6688b97768af315d6fb4d006f2d154d24a8d6ace
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Dec 12 19:33:16 2017 +0100
Merging upstream version 4.4.6.
diff --git a/CHANGELOG b/CHANGELOG
index 73da79d..503af31 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.4.6 - 2017-12-04
+* Bug fixes (see mercurial logs for details)
+
Version 4.4.5 - 2017-11-07
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index cef4445..e2b7790 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond
-Version: 4.4.5
+Version: 4.4.6
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index cef4445..e2b7790 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond
-Version: 4.4.5
+Version: 4.4.6
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/trytond/__init__.py b/trytond/__init__.py
index fb301fc..0e7f08e 100644
--- a/trytond/__init__.py
+++ b/trytond/__init__.py
@@ -5,14 +5,14 @@ import time
import warnings
from email import charset
-__version__ = "4.4.5"
+__version__ = "4.4.6"
os.environ['TZ'] = 'UTC'
if hasattr(time, 'tzset'):
time.tzset()
if time.tzname[0] != 'UTC':
- warnings.warn('Timezone must be set to UTC instead of %s', time.tzname[0])
+ warnings.warn('Timezone must be set to UTC instead of %s' % time.tzname[0])
# set email encoding for utf-8 to 'quoted-printable'
charset.add_charset('utf-8', charset.QP, charset.QP)
diff --git a/trytond/backend/mysql/database.py b/trytond/backend/mysql/database.py
index 73b7fec..e4c9e0f 100644
--- a/trytond/backend/mysql/database.py
+++ b/trytond/backend/mysql/database.py
@@ -87,6 +87,7 @@ class Database(DatabaseInterface):
'INTEGER': SQLType('SIGNED INTEGER', 'BIGINT'),
'BIGINTEGER': SQLType('SIGNED INTEGER', 'BIGINT'),
'NUMERIC': SQLType('DECIMAL', 'DECIMAL(65, 30)'),
+ 'INTERVAL': SQLType('DOUBLE', 'DOUBLE(255, 6)'),
}
def connect(self):
diff --git a/trytond/backend/mysql/init.sql b/trytond/backend/mysql/init.sql
index cb91ae6..8e612cc 100644
--- a/trytond/backend/mysql/init.sql
+++ b/trytond/backend/mysql/init.sql
@@ -129,5 +129,6 @@ CREATE TABLE ir_module_dependency (
CREATE TABLE ir_cache (
id BIGINT AUTO_INCREMENT NOT NULL,
name VARCHAR(255),
- "timestamp" TIMESTAMP
+ "timestamp" TIMESTAMP,
+ PRIMARY KEY(id)
) ENGINE=InnoDB;
diff --git a/trytond/model/fields/many2many.py b/trytond/model/fields/many2many.py
index 09195c6..ecf9735 100644
--- a/trytond/model/fields/many2many.py
+++ b/trytond/model/fields/many2many.py
@@ -325,9 +325,12 @@ class Many2Many(Field):
target_operator = 'child_of'
else:
target_operator = 'parent_of'
- query = Target.search([
- (domain[3], target_operator, value),
- ], order=[], query=True)
+ target_domain = [
+ (domain[3], target_operator, value),
+ ]
+ if self.filter:
+ target_domain.append(self.filter)
+ query = Target.search(target_domain, order=[], query=True)
where = (target.in_(query) & (origin != Null))
if history_where:
where &= history_where
@@ -339,13 +342,20 @@ class Many2Many(Field):
return ~expression
return expression
if isinstance(value, basestring):
- targets = Target.search([('rec_name', 'ilike', value)],
- order=[])
+ target_domain = [('rec_name', 'ilike', value)]
+ if self.filter:
+ target_domain.append(self.filter)
+ targets = Target.search(target_domain, order=[])
ids = [t.id for t in targets]
- elif not isinstance(value, (list, tuple)):
- ids = [value]
else:
- ids = value
+ if not isinstance(value, (list, tuple)):
+ ids = [value]
+ else:
+ ids = value
+ if self.filter:
+ targets = Target.search(
+ [('id', 'in', ids), self.filter], order=[])
+ ids = [t.id for t in targets]
if not ids:
expression = Literal(False)
if operator.startswith('not'):
@@ -361,6 +371,9 @@ class Many2Many(Field):
where &= history_where
if origin_where:
where &= origin_where
+ if self.filter:
+ query = Target.search(self.filter, order=[], query=True)
+ where &= target.in_(query)
query = relation.select(origin, where=where)
expression = ~table.id.in_(query)
if operator == '!=':
@@ -385,6 +398,11 @@ class Many2Many(Field):
rule_domain = Rule.domain_get(Relation.__name__, mode='read')
if rule_domain:
relation_domain = [relation_domain, rule_domain]
+ if self.filter:
+ relation_domain = [
+ relation_domain,
+ (self.target, 'where', self.filter),
+ ]
relation_tables = {
None: (relation, None),
}
diff --git a/trytond/model/fields/one2many.py b/trytond/model/fields/one2many.py
index 39ac0e8..e9fda82 100644
--- a/trytond/model/fields/one2many.py
+++ b/trytond/model/fields/one2many.py
@@ -262,6 +262,9 @@ class One2Many(Field):
where &= history_where
if origin_where:
where &= origin_where
+ if self.filter:
+ query = Target.search(self.filter, order=[], query=True)
+ where &= origin.in_(query)
query = target.select(origin, where=where)
expression = ~table.id.in_(query)
if operator == '!=':
@@ -284,6 +287,8 @@ class One2Many(Field):
rule_domain = Rule.domain_get(Target.__name__, mode='read')
if rule_domain:
target_domain = [target_domain, rule_domain]
+ if self.filter:
+ target_domain = [target_domain, self.filter]
target_tables = {
None: (target, None),
}
diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py
index 48e27c2..12b1c1a 100644
--- a/trytond/model/modelstorage.py
+++ b/trytond/model/modelstorage.py
@@ -1438,7 +1438,7 @@ class ModelStorage(Model):
to_write = []
for target in targets:
if target.id is None or target.id < 0:
- if field._type == 'one2many':
+ if field._type == 'one2many' and field.field:
# Don't store old target link
setattr(target, field.field, None)
to_create.append(target._save_values)
diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py
index 3c8be21..4255f2a 100644
--- a/trytond/model/modelview.py
+++ b/trytond/model/modelview.py
@@ -720,6 +720,7 @@ class ModelView(Model):
del value['remove']
if not value:
continue
+ value = dict(value)
elif field._type == 'many2many':
value = [r.id for r in value]
changed[fname] = value
diff --git a/trytond/tests/test_fields.py b/trytond/tests/test_fields.py
index 8ac755b..57c02ec 100644
--- a/trytond/tests/test_fields.py
+++ b/trytond/tests/test_fields.py
@@ -2516,6 +2516,28 @@ class FieldsTestCase(unittest.TestCase):
self.assertEqual(filtered_target.value, 3)
@with_transaction()
+ def test_one2many_filter_search(self):
+ "Test search on one2many with filter"
+ pool = Pool()
+ One2ManyFilter = pool.get('test.one2many_filter')
+
+ One2ManyFilter.create([{
+ 'targets': [('create', [{'value': -1}])],
+ }])
+
+ result = One2ManyFilter.search([('targets', '!=', None)])
+ self.assertEqual(len(result), 1)
+
+ result = One2ManyFilter.search([('filtered_targets', '!=', None)])
+ self.assertEqual(len(result), 0)
+
+ result = One2ManyFilter.search([('targets.value', '=', -1)])
+ self.assertEqual(len(result), 1)
+
+ result = One2ManyFilter.search([('filtered_targets.value', '=', -1)])
+ self.assertEqual(len(result), 0)
+
+ @with_transaction()
def test_many2many(self):
'Test Many2Many'
pool = Pool()
@@ -2768,6 +2790,36 @@ class FieldsTestCase(unittest.TestCase):
self.assertEqual(filtered_target.value, 3)
@with_transaction()
+ def test_many2many_filter_search(self):
+ "Test search on many2many with filter"
+ pool = Pool()
+ Many2ManyFilter = pool.get('test.many2many_filter')
+
+ Many2ManyFilter.create([{
+ 'targets': [('create', [{'value': -1}])],
+ }])
+
+ result = Many2ManyFilter.search([('targets', '!=', None)])
+ self.assertEqual(len(result), 1)
+
+ result = Many2ManyFilter.search([('filtered_targets', '!=', None)])
+ self.assertEqual(len(result), 0)
+
+ result = Many2ManyFilter.search(
+ [('or_filtered_targets', '!=', None)])
+ self.assertEqual(len(result), 1)
+
+ result = Many2ManyFilter.search([('targets.value', '=', -1)])
+ self.assertEqual(len(result), 1)
+
+ result = Many2ManyFilter.search([('filtered_targets.value', '=', -1)])
+ self.assertEqual(len(result), 0)
+
+ result = Many2ManyFilter.search(
+ [('or_filtered_targets.value', '=', -1)])
+ self.assertEqual(len(result), 1)
+
+ @with_transaction()
def test_many2many_add_to_list(self):
"Test Many2Many add to list of records"
pool = Pool()
diff --git a/trytond/tools/misc.py b/trytond/tools/misc.py
index 385b556..cae4a24 100644
--- a/trytond/tools/misc.py
+++ b/trytond/tools/misc.py
@@ -91,11 +91,11 @@ def get_smtp_server():
:return: A SMTP instance. The quit() method must be call when all
the calls to sendmail() have been made.
"""
- from ..sendmail import _get_smtp_server
+ from ..sendmail import get_smtp_server
warnings.warn(
'get_smtp_server is deprecated use trytond.sendmail',
DeprecationWarning)
- return _get_smtp_server()
+ return get_smtp_server()
def memoize(maxsize):
--
tryton-server
More information about the tryton-debian-vcs
mailing list