[tryton-commits] changeset in trytond:5.0 Construct recursively Tree search_rec_n...

2020-10-30 Thread Cédric Krier
changeset e6f346b31218 in trytond:5.0
details: https://hg.tryton.org/trytond?cmd=changeset;node=e6f346b31218
description:
Construct recursively Tree search_rec_name with 'in' operators

Each value of the 'in' operators must be processed as a '=' clause.
The None values must be supported just in case it set in the 'in' values
because the mixin does not allow empty name.

issue9354
review304601002
(grafted from 84244f5b76418f093ce6212653ddd365259818ea)
diffstat:

 trytond/model/tree.py  |  55 ++---
 trytond/tests/test_tree.py |  60 ++
 2 files changed, 89 insertions(+), 26 deletions(-)

diffs (148 lines):

diff -r b8fbf2a06ae1 -r e6f346b31218 trytond/model/tree.py
--- a/trytond/model/tree.py Sat Oct 24 23:17:19 2020 +0200
+++ b/trytond/model/tree.py Mon Oct 26 21:27:13 2020 +0100
@@ -30,38 +30,41 @@
 
 @classmethod
 def search_rec_name(cls, _, clause):
+domain = []
 if isinstance(clause[2], str):
+field = name
 values = list(reversed(clause[2].split(separator)))
+for value in values:
+domain.append((field, clause[1], value.strip()))
+field = parent + '.' + field
+if ((
+clause[1].endswith('like')
+and not clause[2].replace(
+'%%', '__').startswith('%'))
+or not clause[1].endswith('like')):
+if clause[1].startswith('not') or clause[1] == '!=':
+operator = '!='
+domain.insert(0, 'OR')
+else:
+operator = '='
+top_parent = '.'.join((parent,) * len(values))
+domain.append((top_parent, operator, None))
+if (clause[1].endswith('like')
+and clause[2].replace('%%', '__').endswith('%')):
+ids = list(map(int, cls.search(domain, order=[])))
+domain = [(parent, 'child_of', ids)]
+elif clause[2] is None:
+domain.append((name, clause[1], clause[2]))
 else:
-values = [[]]
-for value in clause[2]:
-if value is None:
-values[0].append(value)
-continue
-for i, v in range(reversed(value.split(separator))):
-while len(values) <= i:
-values.append([])
-values[i].append(v)
-domain = []
-field = name
-for value in values:
-domain.append((field, clause[1], value.strip()))
-field = parent + '.' + field
-if ((clause[1].endswith('like')
-and not clause[2].replace(
-'%%', '__').startswith('%'))
-or not clause[1].endswith('like')):
-if clause[1].startswith('not') or clause[1] == '!=':
+if clause[1].startswith('not'):
 operator = '!='
-domain.insert(0, 'OR')
+domain.append('AND')
 else:
 operator = '='
-top_parent = '.'.join((parent,) * len(values))
-domain.append((top_parent, operator, None))
-if (clause[1].endswith('like')
-and clause[2].replace('%%', '__').endswith('%')):
-ids = list(map(int, cls.search(domain, order=[])))
-domain = [(parent, 'child_of', ids)]
+domain.append('OR')
+for value in clause[2]:
+domain.append(cls.search_rec_name(
+name, (clause[0], operator, value)))
 return domain
 
 @classmethod
diff -r b8fbf2a06ae1 -r e6f346b31218 trytond/tests/test_tree.py
--- a/trytond/tests/test_tree.pySat Oct 24 23:17:19 2020 +0200
+++ b/trytond/tests/test_tree.pyMon Oct 26 21:27:13 2020 +0100
@@ -70,6 +70,21 @@
 self.assertEqual(records, [parent])
 
 @with_transaction()
+def test_search_rec_name_equals_none(self):
+"Test search_rec_name equals"
+pool = Pool()
+Tree = pool.get('test.tree')
+
+parent = Tree(name="parent")
+parent.save()
+record = Tree(name="record", parent=parent)
+record.save()
+
+records = Tree.search([('rec_name', '=', None)])
+
+   

[tryton-commits] changeset in trytond:5.4 Construct recursively Tree search_rec_n...

2020-10-30 Thread Cédric Krier
changeset 5d1e3b139ef2 in trytond:5.4
details: https://hg.tryton.org/trytond?cmd=changeset;node=5d1e3b139ef2
description:
Construct recursively Tree search_rec_name with 'in' operators

Each value of the 'in' operators must be processed as a '=' clause.
The None values must be supported just in case it set in the 'in' values
because the mixin does not allow empty name.

issue9354
review304601002
(grafted from 84244f5b76418f093ce6212653ddd365259818ea)
diffstat:

 trytond/model/tree.py  |  55 ++---
 trytond/tests/test_tree.py |  60 ++
 2 files changed, 89 insertions(+), 26 deletions(-)

diffs (148 lines):

diff -r 23e9dd752dc6 -r 5d1e3b139ef2 trytond/model/tree.py
--- a/trytond/model/tree.py Sat Oct 24 23:17:19 2020 +0200
+++ b/trytond/model/tree.py Mon Oct 26 21:27:13 2020 +0100
@@ -38,38 +38,41 @@
 
 @classmethod
 def search_rec_name(cls, _, clause):
+domain = []
 if isinstance(clause[2], str):
+field = name
 values = list(reversed(clause[2].split(separator)))
+for value in values:
+domain.append((field, clause[1], value.strip()))
+field = parent + '.' + field
+if ((
+clause[1].endswith('like')
+and not clause[2].replace(
+'%%', '__').startswith('%'))
+or not clause[1].endswith('like')):
+if clause[1].startswith('not') or clause[1] == '!=':
+operator = '!='
+domain.insert(0, 'OR')
+else:
+operator = '='
+top_parent = '.'.join((parent,) * len(values))
+domain.append((top_parent, operator, None))
+if (clause[1].endswith('like')
+and clause[2].replace('%%', '__').endswith('%')):
+ids = list(map(int, cls.search(domain, order=[])))
+domain = [(parent, 'child_of', ids)]
+elif clause[2] is None:
+domain.append((name, clause[1], clause[2]))
 else:
-values = [[]]
-for value in clause[2]:
-if value is None:
-values[0].append(value)
-continue
-for i, v in range(reversed(value.split(separator))):
-while len(values) <= i:
-values.append([])
-values[i].append(v)
-domain = []
-field = name
-for value in values:
-domain.append((field, clause[1], value.strip()))
-field = parent + '.' + field
-if ((clause[1].endswith('like')
-and not clause[2].replace(
-'%%', '__').startswith('%'))
-or not clause[1].endswith('like')):
-if clause[1].startswith('not') or clause[1] == '!=':
+if clause[1].startswith('not'):
 operator = '!='
-domain.insert(0, 'OR')
+domain.append('AND')
 else:
 operator = '='
-top_parent = '.'.join((parent,) * len(values))
-domain.append((top_parent, operator, None))
-if (clause[1].endswith('like')
-and clause[2].replace('%%', '__').endswith('%')):
-ids = list(map(int, cls.search(domain, order=[])))
-domain = [(parent, 'child_of', ids)]
+domain.append('OR')
+for value in clause[2]:
+domain.append(cls.search_rec_name(
+name, (clause[0], operator, value)))
 return domain
 
 @classmethod
diff -r 23e9dd752dc6 -r 5d1e3b139ef2 trytond/tests/test_tree.py
--- a/trytond/tests/test_tree.pySat Oct 24 23:17:19 2020 +0200
+++ b/trytond/tests/test_tree.pyMon Oct 26 21:27:13 2020 +0100
@@ -70,6 +70,21 @@
 self.assertEqual(records, [parent])
 
 @with_transaction()
+def test_search_rec_name_equals_none(self):
+"Test search_rec_name equals"
+pool = Pool()
+Tree = pool.get('test.tree')
+
+parent = Tree(name="parent")
+parent.save()
+record = Tree(name="record", parent=parent)
+record.save()
+
+records = Tree.search([('rec_name', '=', None)])
+
+   

[tryton-commits] changeset in trytond:5.0 Get session max_attempt as integer when...

2020-10-30 Thread Sergi Almacellas Abellana
changeset b8fbf2a06ae1 in trytond:5.0
details: https://hg.tryton.org/trytond?cmd=changeset;node=b8fbf2a06ae1
description:
Get session max_attempt as integer when deleting user application

issue9752
review304591002
(grafted from f6d3843711f6577257a85b5c5532f7038c793485)
diffstat:

 trytond/res/routes.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r ab9a027a4a87 -r b8fbf2a06ae1 trytond/res/routes.py
--- a/trytond/res/routes.py Thu Oct 22 12:11:09 2020 +0200
+++ b/trytond/res/routes.py Sat Oct 24 23:17:19 2020 +0200
@@ -51,7 +51,7 @@
 return key
 elif request.method == 'DELETE':
 count = LoginAttempt.count(login)
-if count > config.get('session', 'max_attempt', default=5):
+if count > config.getint('session', 'max_attempt', default=5):
 LoginAttempt.add(login)
 abort(429)
 Transaction().atexit(time.sleep, 2 ** count - 1)



[tryton-commits] changeset in trytond:5.6 Get session max_attempt as integer when...

2020-10-30 Thread Sergi Almacellas Abellana
changeset b88a0fa56278 in trytond:5.6
details: https://hg.tryton.org/trytond?cmd=changeset;node=b88a0fa56278
description:
Get session max_attempt as integer when deleting user application

issue9752
review304591002
(grafted from f6d3843711f6577257a85b5c5532f7038c793485)
diffstat:

 trytond/res/routes.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 6515e46baf6c -r b88a0fa56278 trytond/res/routes.py
--- a/trytond/res/routes.py Thu Oct 22 12:11:09 2020 +0200
+++ b/trytond/res/routes.py Sat Oct 24 23:17:19 2020 +0200
@@ -51,7 +51,7 @@
 return key
 elif request.method == 'DELETE':
 count = LoginAttempt.count(login)
-if count > config.get('session', 'max_attempt', default=5):
+if count > config.getint('session', 'max_attempt', default=5):
 LoginAttempt.add(login)
 abort(429)
 Transaction().atexit(time.sleep, 2 ** count - 1)



[tryton-commits] changeset in trytond:5.4 PYSON's DateTime defaults to the curren...

2020-10-30 Thread Nicolas Évrard
changeset 41edf2b0a50f in trytond:5.4
details: https://hg.tryton.org/trytond?cmd=changeset;node=41edf2b0a50f
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from 662ae82c0f5e83f6e4147cb6ef59917e5e182d45)
diffstat:

 doc/ref/pyson.rst |  4 +++-
 trytond/pyson.py  |  2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 553562d4fc2a -r 41edf2b0a50f doc/ref/pyson.rst
--- a/doc/ref/pyson.rst Wed Oct 21 23:23:17 2020 +0200
+++ b/doc/ref/pyson.rst Thu Oct 22 12:11:09 2020 +0200
@@ -218,10 +218,12 @@
 the *arguments* explained below.
 Missing values of arguments named by  ``year``, ``month``, ``day``, ``hour``,
 ``minute``, ``second``, ``microseconds`` take their defaults from ``start`` or
-the actual date and time.
+the actual date and time in `UTC`_.
 When values of arguments named by ``delta_*`` are given, these are added  to
 the appropriate attributes in a date and time preserving manner.
 
+.. _`UTC`: https://en.wikipedia.org/wiki/Coordinated_Universal_Time
+
 Arguments:
 
 ``year``
diff -r 553562d4fc2a -r 41edf2b0a50f trytond/pyson.py
--- a/trytond/pyson.py  Wed Oct 21 23:23:17 2020 +0200
+++ b/trytond/pyson.py  Thu Oct 22 12:11:09 2020 +0200
@@ -630,7 +630,7 @@
 and not isinstance(now, datetime.datetime)):
 now = datetime.datetime.combine(now, datetime.time())
 if not isinstance(now, datetime.datetime):
-now = datetime.datetime.now()
+now = datetime.datetime.utcnow()
 return now + relativedelta(
 year=dct['y'],
 month=dct['M'],



[tryton-commits] changeset in trytond:5.6 Construct recursively Tree search_rec_n...

2020-10-30 Thread Cédric Krier
changeset a86dba790821 in trytond:5.6
details: https://hg.tryton.org/trytond?cmd=changeset;node=a86dba790821
description:
Construct recursively Tree search_rec_name with 'in' operators

Each value of the 'in' operators must be processed as a '=' clause.
The None values must be supported just in case it set in the 'in' values
because the mixin does not allow empty name.

issue9354
review304601002
(grafted from 84244f5b76418f093ce6212653ddd365259818ea)
diffstat:

 trytond/model/tree.py  |  56 ++
 trytond/tests/test_tree.py |  60 ++
 2 files changed, 89 insertions(+), 27 deletions(-)

diffs (149 lines):

diff -r b88a0fa56278 -r a86dba790821 trytond/model/tree.py
--- a/trytond/model/tree.py Sat Oct 24 23:17:19 2020 +0200
+++ b/trytond/model/tree.py Mon Oct 26 21:27:13 2020 +0100
@@ -38,39 +38,41 @@
 
 @classmethod
 def search_rec_name(cls, _, clause):
+domain = []
 if isinstance(clause[2], str):
+field = name
 values = list(reversed(clause[2].split(separator)))
+for value in values:
+domain.append((field, clause[1], value.strip()))
+field = parent + '.' + field
+if ((
+clause[1].endswith('like')
+and not clause[2].replace(
+'%%', '__').startswith('%'))
+or not clause[1].endswith('like')):
+if clause[1].startswith('not') or clause[1] == '!=':
+operator = '!='
+domain.insert(0, 'OR')
+else:
+operator = '='
+top_parent = '.'.join((parent,) * len(values))
+domain.append((top_parent, operator, None))
+if (clause[1].endswith('like')
+and clause[2].replace('%%', '__').endswith('%')):
+ids = list(map(int, cls.search(domain, order=[])))
+domain = [(parent, 'child_of', ids)]
+elif clause[2] is None:
+domain.append((name, clause[1], clause[2]))
 else:
-values = [[]]
-for value in clause[2]:
-if value is None:
-values[0].append(value)
-continue
-for i, v in range(reversed(value.split(separator))):
-while len(values) <= i:
-values.append([])
-values[i].append(v)
-domain = []
-field = name
-for value in values:
-domain.append((field, clause[1], value.strip()))
-field = parent + '.' + field
-if ((
-clause[1].endswith('like')
-and not clause[2].replace(
-'%%', '__').startswith('%'))
-or not clause[1].endswith('like')):
-if clause[1].startswith('not') or clause[1] == '!=':
+if clause[1].startswith('not'):
 operator = '!='
-domain.insert(0, 'OR')
+domain.append('AND')
 else:
 operator = '='
-top_parent = '.'.join((parent,) * len(values))
-domain.append((top_parent, operator, None))
-if (clause[1].endswith('like')
-and clause[2].replace('%%', '__').endswith('%')):
-ids = list(map(int, cls.search(domain, order=[])))
-domain = [(parent, 'child_of', ids)]
+domain.append('OR')
+for value in clause[2]:
+domain.append(cls.search_rec_name(
+name, (clause[0], operator, value)))
 return domain
 
 @classmethod
diff -r b88a0fa56278 -r a86dba790821 trytond/tests/test_tree.py
--- a/trytond/tests/test_tree.pySat Oct 24 23:17:19 2020 +0200
+++ b/trytond/tests/test_tree.pyMon Oct 26 21:27:13 2020 +0100
@@ -70,6 +70,21 @@
 self.assertEqual(records, [parent])
 
 @with_transaction()
+def test_search_rec_name_equals_none(self):
+"Test search_rec_name equals"
+pool = Pool()
+Tree = pool.get('test.tree')
+
+parent = Tree(name="parent")
+parent.save()
+record = Tree(name="record", parent=parent)
+record.save()
+
+records = Tree.search([('rec_name', 

[tryton-commits] changeset in trytond:5.6 PYSON's DateTime defaults to the curren...

2020-10-30 Thread Nicolas Évrard
changeset 6515e46baf6c in trytond:5.6
details: https://hg.tryton.org/trytond?cmd=changeset;node=6515e46baf6c
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from 662ae82c0f5e83f6e4147cb6ef59917e5e182d45)
diffstat:

 doc/ref/pyson.rst |  4 +++-
 trytond/pyson.py  |  2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r fc3a251dae3a -r 6515e46baf6c doc/ref/pyson.rst
--- a/doc/ref/pyson.rst Wed Oct 21 23:23:17 2020 +0200
+++ b/doc/ref/pyson.rst Thu Oct 22 12:11:09 2020 +0200
@@ -218,10 +218,12 @@
 the *arguments* explained below.
 Missing values of arguments named by  ``year``, ``month``, ``day``, ``hour``,
 ``minute``, ``second``, ``microseconds`` take their defaults from ``start`` or
-the actual date and time.
+the actual date and time in `UTC`_.
 When values of arguments named by ``delta_*`` are given, these are added  to
 the appropriate attributes in a date and time preserving manner.
 
+.. _`UTC`: https://en.wikipedia.org/wiki/Coordinated_Universal_Time
+
 Arguments:
 
 ``year``
diff -r fc3a251dae3a -r 6515e46baf6c trytond/pyson.py
--- a/trytond/pyson.py  Wed Oct 21 23:23:17 2020 +0200
+++ b/trytond/pyson.py  Thu Oct 22 12:11:09 2020 +0200
@@ -630,7 +630,7 @@
 and not isinstance(now, datetime.datetime)):
 now = datetime.datetime.combine(now, datetime.time())
 if not isinstance(now, datetime.datetime):
-now = datetime.datetime.now()
+now = datetime.datetime.utcnow()
 return now + relativedelta(
 year=dct['y'],
 month=dct['M'],



[tryton-commits] changeset in trytond:5.4 Get session max_attempt as integer when...

2020-10-30 Thread Sergi Almacellas Abellana
changeset 23e9dd752dc6 in trytond:5.4
details: https://hg.tryton.org/trytond?cmd=changeset;node=23e9dd752dc6
description:
Get session max_attempt as integer when deleting user application

issue9752
review304591002
(grafted from f6d3843711f6577257a85b5c5532f7038c793485)
diffstat:

 trytond/res/routes.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 41edf2b0a50f -r 23e9dd752dc6 trytond/res/routes.py
--- a/trytond/res/routes.py Thu Oct 22 12:11:09 2020 +0200
+++ b/trytond/res/routes.py Sat Oct 24 23:17:19 2020 +0200
@@ -51,7 +51,7 @@
 return key
 elif request.method == 'DELETE':
 count = LoginAttempt.count(login)
-if count > config.get('session', 'max_attempt', default=5):
+if count > config.getint('session', 'max_attempt', default=5):
 LoginAttempt.add(login)
 abort(429)
 Transaction().atexit(time.sleep, 2 ** count - 1)



[tryton-commits] changeset in trytond:5.0 PYSON's DateTime defaults to the curren...

2020-10-30 Thread Nicolas Évrard
changeset ab9a027a4a87 in trytond:5.0
details: https://hg.tryton.org/trytond?cmd=changeset;node=ab9a027a4a87
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from 662ae82c0f5e83f6e4147cb6ef59917e5e182d45)
diffstat:

 trytond/pyson.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r bb821b08ba73 -r ab9a027a4a87 trytond/pyson.py
--- a/trytond/pyson.py  Wed Oct 21 23:23:17 2020 +0200
+++ b/trytond/pyson.py  Thu Oct 22 12:11:09 2020 +0200
@@ -610,7 +610,7 @@
 
 @staticmethod
 def eval(dct, context):
-return datetime.datetime.now() + relativedelta(
+return datetime.datetime.utcnow() + relativedelta(
 year=dct['y'],
 month=dct['M'],
 day=dct['d'],



[tryton-commits] changeset in trytond:5.4 Set default value for missing depends f...

2020-10-30 Thread Cédric Krier
changeset 553562d4fc2a in trytond:5.4
details: https://hg.tryton.org/trytond?cmd=changeset;node=553562d4fc2a
description:
Set default value for missing depends field

This avoid to fill an instance with None value which will prevent it to 
be
saved with the default value for fields not explicitly assigned.

issue9726
review314481004
(grafted from 65b6783a3b63d45f751c79278bd3cb186218ba46)
diffstat:

 trytond/model/fields/field.py |  5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r 5565e0736e7f -r 553562d4fc2a trytond/model/fields/field.py
--- a/trytond/model/fields/field.py Wed Oct 14 14:43:40 2020 +0200
+++ b/trytond/model/fields/field.py Wed Oct 21 23:23:17 2020 +0200
@@ -89,7 +89,10 @@
 if field.startswith('_parent_'):
 field = field[8:]  # Strip '_parent_'
 if not hasattr(record, field):
-setattr(record, field, None)
+default = None
+if hasattr(record, '_defaults') and field in record._defaults:
+default = record._defaults[field]()
+setattr(record, field, default)
 elif nested:
 parent = getattr(record, field)
 if parent:



[tryton-commits] changeset in tryton:5.4 Catch any exception for server version RPC

2020-10-30 Thread Cédric Krier
changeset 834a6ace3cc8 in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=834a6ace3cc8
description:
Catch any exception for server version RPC

It is the first method called with the input of the user.
The login window does not support that it raises an exception and as a 
lot of
different exceptions can be raised (and may change depending of Python
version), we must catch all of them. It does not hide any programming 
error as
they are logged.

issue9408
review292561004
(grafted from feb8125c72d23ae3d5aab49f2745ed25412d2c02)
diffstat:

 tryton/rpc.py |  3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 8d26030d0530 -r 834a6ace3cc8 tryton/rpc.py
--- a/tryton/rpc.py Mon Oct 26 21:25:47 2020 +0100
+++ b/tryton/rpc.py Mon Oct 26 21:28:47 2020 +0100
@@ -3,7 +3,6 @@
 import http.client
 import logging
 import socket
-import ssl
 import os
 try:
 from http import HTTPStatus
@@ -67,7 +66,7 @@
 result = connection.common.server.version()
 logging.getLogger(__name__).debug(repr(result))
 return result
-except (Fault, socket.error, ssl.SSLError, ssl.CertificateError) as e:
+except Exception as e:
 logging.getLogger(__name__).error(e)
 return None
 



[tryton-commits] changeset in trytond:5.0 Set default value for missing depends f...

2020-10-30 Thread Cédric Krier
changeset bb821b08ba73 in trytond:5.0
details: https://hg.tryton.org/trytond?cmd=changeset;node=bb821b08ba73
description:
Set default value for missing depends field

This avoid to fill an instance with None value which will prevent it to 
be
saved with the default value for fields not explicitly assigned.

issue9726
review314481004
(grafted from 65b6783a3b63d45f751c79278bd3cb186218ba46)
diffstat:

 trytond/model/fields/field.py |  5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r a74485c9bbae -r bb821b08ba73 trytond/model/fields/field.py
--- a/trytond/model/fields/field.py Wed Oct 14 14:43:40 2020 +0200
+++ b/trytond/model/fields/field.py Wed Oct 21 23:23:17 2020 +0200
@@ -86,7 +86,10 @@
 if field.startswith('_parent_'):
 field = field[8:]  # Strip '_parent_'
 if not hasattr(record, field):
-setattr(record, field, None)
+default = None
+if hasattr(record, '_defaults') and field in record._defaults:
+default = record._defaults[field]()
+setattr(record, field, default)
 elif nested:
 parent = getattr(record, field)
 if parent:



[tryton-commits] changeset in tryton:5.0 Catch any exception for server version RPC

2020-10-30 Thread Cédric Krier
changeset 9990c3ed2cfd in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=9990c3ed2cfd
description:
Catch any exception for server version RPC

It is the first method called with the input of the user.
The login window does not support that it raises an exception and as a 
lot of
different exceptions can be raised (and may change depending of Python
version), we must catch all of them. It does not hide any programming 
error as
they are logged.

issue9408
review292561004
(grafted from feb8125c72d23ae3d5aab49f2745ed25412d2c02)
diffstat:

 tryton/rpc.py |  3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 0933248e1eff -r 9990c3ed2cfd tryton/rpc.py
--- a/tryton/rpc.py Mon Oct 26 21:25:47 2020 +0100
+++ b/tryton/rpc.py Mon Oct 26 21:28:47 2020 +0100
@@ -3,7 +3,6 @@
 import http.client
 import logging
 import socket
-import ssl
 import os
 try:
 from http import HTTPStatus
@@ -67,7 +66,7 @@
 result = connection.common.server.version()
 logging.getLogger(__name__).debug(repr(result))
 return result
-except (Fault, socket.error, ssl.SSLError, ssl.CertificateError) as e:
+except Exception as e:
 logging.getLogger(__name__).error(e)
 return None
 



[tryton-commits] changeset in trytond:5.6 Set default value for missing depends f...

2020-10-30 Thread Cédric Krier
changeset fc3a251dae3a in trytond:5.6
details: https://hg.tryton.org/trytond?cmd=changeset;node=fc3a251dae3a
description:
Set default value for missing depends field

This avoid to fill an instance with None value which will prevent it to 
be
saved with the default value for fields not explicitly assigned.

issue9726
review314481004
(grafted from 65b6783a3b63d45f751c79278bd3cb186218ba46)
diffstat:

 trytond/model/fields/field.py |  5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r f4497659144c -r fc3a251dae3a trytond/model/fields/field.py
--- a/trytond/model/fields/field.py Wed Oct 14 14:43:40 2020 +0200
+++ b/trytond/model/fields/field.py Wed Oct 21 23:23:17 2020 +0200
@@ -88,7 +88,10 @@
 if field.startswith('_parent_'):
 field = field[8:]  # Strip '_parent_'
 if not hasattr(record, field):
-setattr(record, field, None)
+default = None
+if hasattr(record, '_defaults') and field in record._defaults:
+default = record._defaults[field]()
+setattr(record, field, default)
 elif nested:
 parent = getattr(record, field)
 if parent:



[tryton-commits] changeset in tryton:5.6 Catch any exception for server version RPC

2020-10-30 Thread Cédric Krier
changeset 7e43f2f49786 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=7e43f2f49786
description:
Catch any exception for server version RPC

It is the first method called with the input of the user.
The login window does not support that it raises an exception and as a 
lot of
different exceptions can be raised (and may change depending of Python
version), we must catch all of them. It does not hide any programming 
error as
they are logged.

issue9408
review292561004
(grafted from feb8125c72d23ae3d5aab49f2745ed25412d2c02)
diffstat:

 tryton/rpc.py |  3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r fcef0c23ab0a -r 7e43f2f49786 tryton/rpc.py
--- a/tryton/rpc.py Mon Oct 26 21:25:47 2020 +0100
+++ b/tryton/rpc.py Mon Oct 26 21:28:47 2020 +0100
@@ -3,7 +3,6 @@
 import http.client
 import logging
 import socket
-import ssl
 import os
 try:
 from http import HTTPStatus
@@ -67,7 +66,7 @@
 result = connection.common.server.version()
 logging.getLogger(__name__).debug(repr(result))
 return result
-except (Fault, socket.error, ssl.SSLError, ssl.CertificateError) as e:
+except Exception as e:
 logging.getLogger(__name__).error(e)
 return None
 



[tryton-commits] changeset in tryton:5.0 Returns only Button instance instead of ...

2020-10-30 Thread Cédric Krier
changeset 0933248e1eff in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=0933248e1eff
description:
Returns only Button instance instead of Gtk.Button

The Form.get_buttons must return only the instances created by 
 and
not the Link which are also Gtk.Button.

issue9714
review318621002
(grafted from 90071de08bc7b1349d661903f7d0c1f3da173d85)
diffstat:

 tryton/gui/window/view_form/view/form.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r fb6a580b6735 -r 0933248e1eff tryton/gui/window/view_form/view/form.py
--- a/tryton/gui/window/view_form/view/form.py  Wed Oct 28 00:02:52 2020 +0100
+++ b/tryton/gui/window/view_form/view/form.py  Mon Oct 26 21:25:47 2020 +0100
@@ -496,7 +496,7 @@
 for w in widgets)
 
 def get_buttons(self):
-return [b for b in self.state_widgets if isinstance(b, gtk.Button)]
+return [b for b in self.state_widgets if isinstance(b, Button)]
 
 def reset(self):
 record = self.screen.current_record



[tryton-commits] changeset in tryton:5.4 Returns only Button instance instead of ...

2020-10-30 Thread Cédric Krier
changeset 8d26030d0530 in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=8d26030d0530
description:
Returns only Button instance instead of Gtk.Button

The Form.get_buttons must return only the instances created by 
 and
not the Link which are also Gtk.Button.

issue9714
review318621002
(grafted from 90071de08bc7b1349d661903f7d0c1f3da173d85)
diffstat:

 tryton/gui/window/view_form/view/form.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 1a15769d9448 -r 8d26030d0530 tryton/gui/window/view_form/view/form.py
--- a/tryton/gui/window/view_form/view/form.py  Wed Oct 28 00:02:52 2020 +0100
+++ b/tryton/gui/window/view_form/view/form.py  Mon Oct 26 21:25:47 2020 +0100
@@ -476,7 +476,7 @@
 for w in widgets)
 
 def get_buttons(self):
-return [b for b in self.state_widgets if isinstance(b, Gtk.Button)]
+return [b for b in self.state_widgets if isinstance(b, Button)]
 
 def reset(self):
 record = self.record



[tryton-commits] changeset in tryton:5.0 Do not rely on current record from screen

2020-10-30 Thread Cédric Krier
changeset fb6a580b6735 in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=fb6a580b6735
description:
Do not rely on current record from screen

If the current record is removed, the attribute is set to None by
cancel_current.

issue9298
review314651002
(grafted from 0110eb3f3ddde9e70c2e611c55bed79081e988cb)
diffstat:

 tryton/gui/window/win_form.py |  13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r 843f49dfc8cc -r fb6a580b6735 tryton/gui/window/win_form.py
--- a/tryton/gui/window/win_form.py Sat Oct 24 13:14:55 2020 +0200
+++ b/tryton/gui/window/win_form.py Wed Oct 28 00:02:52 2020 +0100
@@ -402,16 +402,17 @@
 if (self.screen.current_record
 and not readonly
 and response_id in cancel_responses):
-added = 'id' in self.screen.current_record.modified_fields
+record = self.screen.current_record
+added = 'id' in record.modified_fields
 if (self.screen.current_record.id < 0
 or self.save_current):
 self.screen.cancel_current(self._initial_value)
-elif self.screen.current_record.modified:
-self.screen.current_record.cancel()
-self.screen.current_record.reload()
-self.screen.current_record.signal('record-changed')
+elif record.modified:
+record.cancel()
+record.reload()
+record.signal('record-changed')
 if added:
-self.screen.current_record.modified_fields.setdefault('id')
+record.modified_fields.setdefault('id')
 result = False
 else:
 result = response_id not in cancel_responses



[tryton-commits] changeset in tryton:5.6 Returns only Button instance instead of ...

2020-10-30 Thread Cédric Krier
changeset fcef0c23ab0a in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=fcef0c23ab0a
description:
Returns only Button instance instead of Gtk.Button

The Form.get_buttons must return only the instances created by 
 and
not the Link which are also Gtk.Button.

issue9714
review318621002
(grafted from 90071de08bc7b1349d661903f7d0c1f3da173d85)
diffstat:

 tryton/gui/window/view_form/view/form.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 259af7dae8ce -r fcef0c23ab0a tryton/gui/window/view_form/view/form.py
--- a/tryton/gui/window/view_form/view/form.py  Wed Oct 28 00:02:52 2020 +0100
+++ b/tryton/gui/window/view_form/view/form.py  Mon Oct 26 21:25:47 2020 +0100
@@ -493,7 +493,7 @@
 for w in widgets)
 
 def get_buttons(self):
-return [b for b in self.state_widgets if isinstance(b, Gtk.Button)]
+return [b for b in self.state_widgets if isinstance(b, Button)]
 
 def reset(self):
 record = self.record



[tryton-commits] changeset in tryton:5.0 Keep record added/modified after cancel ...

2020-10-30 Thread Cédric Krier
changeset 843f49dfc8cc in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=843f49dfc8cc
description:
Keep record added/modified after cancel from popup window

We need to keep the record modified to ensure that it is added to the 
xxx2Many
on save.

issue9298
review296601002
(grafted from f813fb56a83d7d7a5a116722d6783b706fd7e55e)
diffstat:

 tryton/gui/window/win_form.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (20 lines):

diff -r 3be991ebe900 -r 843f49dfc8cc tryton/gui/window/win_form.py
--- a/tryton/gui/window/win_form.py Sat Oct 24 13:12:01 2020 +0200
+++ b/tryton/gui/window/win_form.py Sat Oct 24 13:14:55 2020 +0200
@@ -402,6 +402,7 @@
 if (self.screen.current_record
 and not readonly
 and response_id in cancel_responses):
+added = 'id' in self.screen.current_record.modified_fields
 if (self.screen.current_record.id < 0
 or self.save_current):
 self.screen.cancel_current(self._initial_value)
@@ -409,6 +410,8 @@
 self.screen.current_record.cancel()
 self.screen.current_record.reload()
 self.screen.current_record.signal('record-changed')
+if added:
+self.screen.current_record.modified_fields.setdefault('id')
 result = False
 else:
 result = response_id not in cancel_responses



[tryton-commits] changeset in tryton:5.4 Do not rely on current record from screen

2020-10-30 Thread Cédric Krier
changeset 1a15769d9448 in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=1a15769d9448
description:
Do not rely on current record from screen

If the current record is removed, the attribute is set to None by
cancel_current.

issue9298
review314651002
(grafted from 0110eb3f3ddde9e70c2e611c55bed79081e988cb)
diffstat:

 tryton/gui/window/win_form.py |  13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r 1199157062ba -r 1a15769d9448 tryton/gui/window/win_form.py
--- a/tryton/gui/window/win_form.py Sat Oct 24 13:14:55 2020 +0200
+++ b/tryton/gui/window/win_form.py Wed Oct 28 00:02:52 2020 +0100
@@ -399,16 +399,17 @@
 if (self.screen.current_record
 and not readonly
 and response_id in cancel_responses):
-added = 'id' in self.screen.current_record.modified_fields
+record = self.screen.current_record
+added = 'id' in record.modified_fields
 if (self.screen.current_record.id < 0
 or self.save_current):
 self.screen.cancel_current(self._initial_value)
-elif self.screen.current_record.modified:
-self.screen.current_record.cancel()
-self.screen.current_record.reload()
-self.screen.current_record.signal('record-changed')
+elif record.modified:
+record.cancel()
+record.reload()
+record.signal('record-changed')
 if added:
-self.screen.current_record.modified_fields.setdefault('id')
+record.modified_fields.setdefault('id')
 result = False
 else:
 result = response_id not in cancel_responses



[tryton-commits] changeset in tryton:5.6 Do not rely on current record from screen

2020-10-30 Thread Cédric Krier
changeset 259af7dae8ce in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=259af7dae8ce
description:
Do not rely on current record from screen

If the current record is removed, the attribute is set to None by
cancel_current.

issue9298
review314651002
(grafted from 0110eb3f3ddde9e70c2e611c55bed79081e988cb)
diffstat:

 tryton/gui/window/win_form.py |  13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r 093ffe5b68d7 -r 259af7dae8ce tryton/gui/window/win_form.py
--- a/tryton/gui/window/win_form.py Sat Oct 24 13:14:55 2020 +0200
+++ b/tryton/gui/window/win_form.py Wed Oct 28 00:02:52 2020 +0100
@@ -399,16 +399,17 @@
 if (self.screen.current_record
 and not readonly
 and response_id in cancel_responses):
-added = 'id' in self.screen.current_record.modified_fields
+record = self.screen.current_record
+added = 'id' in record.modified_fields
 if (self.screen.current_record.id < 0
 or self.save_current):
 self.screen.cancel_current(self._initial_value)
-elif self.screen.current_record.modified:
-self.screen.current_record.cancel()
-self.screen.current_record.reload()
-self.screen.current_record.signal('record-changed')
+elif record.modified:
+record.cancel()
+record.reload()
+record.signal('record-changed')
 if added:
-self.screen.current_record.modified_fields.setdefault('id')
+record.modified_fields.setdefault('id')
 result = False
 else:
 result = response_id not in cancel_responses



[tryton-commits] changeset in tryton:5.4 Keep record added/modified after cancel ...

2020-10-30 Thread Cédric Krier
changeset 1199157062ba in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=1199157062ba
description:
Keep record added/modified after cancel from popup window

We need to keep the record modified to ensure that it is added to the 
xxx2Many
on save.

issue9298
review296601002
(grafted from f813fb56a83d7d7a5a116722d6783b706fd7e55e)
diffstat:

 tryton/gui/window/win_form.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (20 lines):

diff -r e2bde1113059 -r 1199157062ba tryton/gui/window/win_form.py
--- a/tryton/gui/window/win_form.py Sat Oct 24 13:12:01 2020 +0200
+++ b/tryton/gui/window/win_form.py Sat Oct 24 13:14:55 2020 +0200
@@ -399,6 +399,7 @@
 if (self.screen.current_record
 and not readonly
 and response_id in cancel_responses):
+added = 'id' in self.screen.current_record.modified_fields
 if (self.screen.current_record.id < 0
 or self.save_current):
 self.screen.cancel_current(self._initial_value)
@@ -406,6 +407,8 @@
 self.screen.current_record.cancel()
 self.screen.current_record.reload()
 self.screen.current_record.signal('record-changed')
+if added:
+self.screen.current_record.modified_fields.setdefault('id')
 result = False
 else:
 result = response_id not in cancel_responses



[tryton-commits] changeset in tryton:5.6 Keep record added/modified after cancel ...

2020-10-30 Thread Cédric Krier
changeset 093ffe5b68d7 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=093ffe5b68d7
description:
Keep record added/modified after cancel from popup window

We need to keep the record modified to ensure that it is added to the 
xxx2Many
on save.

issue9298
review296601002
(grafted from f813fb56a83d7d7a5a116722d6783b706fd7e55e)
diffstat:

 tryton/gui/window/win_form.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (20 lines):

diff -r 7e98b9b3eeb4 -r 093ffe5b68d7 tryton/gui/window/win_form.py
--- a/tryton/gui/window/win_form.py Sat Oct 24 13:12:01 2020 +0200
+++ b/tryton/gui/window/win_form.py Sat Oct 24 13:14:55 2020 +0200
@@ -399,6 +399,7 @@
 if (self.screen.current_record
 and not readonly
 and response_id in cancel_responses):
+added = 'id' in self.screen.current_record.modified_fields
 if (self.screen.current_record.id < 0
 or self.save_current):
 self.screen.cancel_current(self._initial_value)
@@ -406,6 +407,8 @@
 self.screen.current_record.cancel()
 self.screen.current_record.reload()
 self.screen.current_record.signal('record-changed')
+if added:
+self.screen.current_record.modified_fields.setdefault('id')
 result = False
 else:
 result = response_id not in cancel_responses



[tryton-commits] changeset in tryton:5.6 PYSON's DateTime defaults to the current...

2020-10-30 Thread Nicolas Évrard
changeset d85385cba0e2 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=d85385cba0e2
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from b99e3e41769624d08590d754e9a619c1c6fb7d72)
diffstat:

 tryton/pyson.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r ca48c92eaf73 -r d85385cba0e2 tryton/pyson.py
--- a/tryton/pyson.py   Wed Oct 28 23:59:06 2020 +0100
+++ b/tryton/pyson.py   Thu Oct 22 12:11:09 2020 +0200
@@ -630,7 +630,7 @@
 and not isinstance(now, datetime.datetime)):
 now = datetime.datetime.combine(now, datetime.time())
 if not isinstance(now, datetime.datetime):
-now = datetime.datetime.now()
+now = datetime.datetime.utcnow()
 return now + relativedelta(
 year=dct['y'],
 month=dct['M'],



[tryton-commits] changeset in tryton:5.4 Ensure inserted record has a valid position

2020-10-30 Thread Cédric Krier
changeset e2bde1113059 in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=e2bde1113059
description:
Ensure inserted record has a valid position

issue9731
review298881002
(grafted from c1f77d93195bf6a74576feffe14e94812512d625)
diffstat:

 tryton/gui/window/view_form/model/group.py |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 359701ac2a15 -r e2bde1113059 tryton/gui/window/view_form/model/group.py
--- a/tryton/gui/window/view_form/model/group.pyThu Oct 22 12:11:09 
2020 +0200
+++ b/tryton/gui/window/view_form/model/group.pySat Oct 24 13:12:01 
2020 +0200
@@ -91,6 +91,7 @@
 
 def insert(self, pos, record):
 assert record.group is self
+pos = min(pos, len(self))
 if pos >= 1:
 self.__getitem__(pos - 1).next[id(self)] = record
 if pos < self.__len__():



[tryton-commits] changeset in tryton:5.6 Ensure inserted record has a valid position

2020-10-30 Thread Cédric Krier
changeset 7e98b9b3eeb4 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=7e98b9b3eeb4
description:
Ensure inserted record has a valid position

issue9731
review298881002
(grafted from c1f77d93195bf6a74576feffe14e94812512d625)
diffstat:

 tryton/gui/window/view_form/model/group.py |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r d85385cba0e2 -r 7e98b9b3eeb4 tryton/gui/window/view_form/model/group.py
--- a/tryton/gui/window/view_form/model/group.pyThu Oct 22 12:11:09 
2020 +0200
+++ b/tryton/gui/window/view_form/model/group.pySat Oct 24 13:12:01 
2020 +0200
@@ -91,6 +91,7 @@
 
 def insert(self, pos, record):
 assert record.group is self
+pos = min(pos, len(self))
 if pos >= 1:
 self.__getitem__(pos - 1).next[id(self)] = record
 if pos < self.__len__():



[tryton-commits] changeset in tryton:5.0 Ensure inserted record has a valid position

2020-10-30 Thread Cédric Krier
changeset 3be991ebe900 in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=3be991ebe900
description:
Ensure inserted record has a valid position

issue9731
review298881002
(grafted from c1f77d93195bf6a74576feffe14e94812512d625)
diffstat:

 tryton/gui/window/view_form/model/group.py |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 6d7ffe78ff9d -r 3be991ebe900 tryton/gui/window/view_form/model/group.py
--- a/tryton/gui/window/view_form/model/group.pyThu Oct 22 12:11:09 
2020 +0200
+++ b/tryton/gui/window/view_form/model/group.pySat Oct 24 13:12:01 
2020 +0200
@@ -91,6 +91,7 @@
 
 def insert(self, pos, record):
 assert record.group is self
+pos = min(pos, len(self))
 if pos >= 1:
 self.__getitem__(pos - 1).next[id(self)] = record
 if pos < self.__len__():



[tryton-commits] changeset in tryton:5.4 PYSON's DateTime defaults to the current...

2020-10-30 Thread Nicolas Évrard
changeset 359701ac2a15 in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=359701ac2a15
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from b99e3e41769624d08590d754e9a619c1c6fb7d72)
diffstat:

 tryton/pyson.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r d37b2a0ee0ec -r 359701ac2a15 tryton/pyson.py
--- a/tryton/pyson.py   Wed Oct 28 23:59:06 2020 +0100
+++ b/tryton/pyson.py   Thu Oct 22 12:11:09 2020 +0200
@@ -630,7 +630,7 @@
 and not isinstance(now, datetime.datetime)):
 now = datetime.datetime.combine(now, datetime.time())
 if not isinstance(now, datetime.datetime):
-now = datetime.datetime.now()
+now = datetime.datetime.utcnow()
 return now + relativedelta(
 year=dct['y'],
 month=dct['M'],



[tryton-commits] changeset in tryton:5.0 Store record and field instead of path w...

2020-10-30 Thread Cédric Krier
changeset 6567de0b088b in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=6567de0b088b
description:
Store record and field instead of path when editing is started

The path can not more be valid or pointing to the proper record if the
treeview model is modified during the edition.

issue9765
review294841002
(grafted from 445bee75c18715f87b35f9e7f20f08d053e2514b)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  19 ++-
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (51 lines):

diff -r ffa01a5fda7b -r 6567de0b088b 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 21 
23:21:26 2020 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 28 
23:59:06 2020 +0100
@@ -176,6 +176,7 @@
 class GenericText(Cell):
 align = 0
 editable = None
+editing = None
 
 def __init__(self, view, attrs, renderer=None):
 super(GenericText, self).__init__()
@@ -265,18 +266,20 @@
 callback()
 
 def set_editable(self):
-if not self.editable:
+if not self.editable or not self.editing:
 return
-store = self.view.treeview.get_model()
-record = store.get_value(store.get_iter(self.editable_path), 0)
+record, field = self.editing
 self.editable.set_text(self.get_textual_value(record))
 
 def editing_started(self, cell, editable, path):
 def remove(editable):
 self.editable = None
-self.editable_path = None
+self.editing = None
 self.editable = editable
-self.editable_path = path
+store = self.view.treeview.get_model()
+record = store.get_value(store.get_iter(path), 0)
+field = record[self.attrs['name']]
+self.editing = record, field
 editable.connect('remove-widget', remove)
 return False
 
@@ -845,11 +848,9 @@
 callback()
 
 def set_editable(self):
-if not self.editable:
+if not self.editable and not self.editing:
 return
-store = self.view.treeview.get_model()
-record = store.get_value(store.get_iter(self.editable_path), 0)
-field = record[self.attrs['name']]
+record, field = self.editing
 value = field.get(record)
 self.update_selection(record, field)
 self.set_popdown_value(self.editable, value)



[tryton-commits] changeset in tryton:5.0 PYSON's DateTime defaults to the current...

2020-10-30 Thread Nicolas Évrard
changeset 6d7ffe78ff9d in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=6d7ffe78ff9d
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from b99e3e41769624d08590d754e9a619c1c6fb7d72)
diffstat:

 tryton/pyson.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 6567de0b088b -r 6d7ffe78ff9d tryton/pyson.py
--- a/tryton/pyson.py   Wed Oct 28 23:59:06 2020 +0100
+++ b/tryton/pyson.py   Thu Oct 22 12:11:09 2020 +0200
@@ -610,7 +610,7 @@
 
 @staticmethod
 def eval(dct, context):
-return datetime.datetime.now() + relativedelta(
+return datetime.datetime.utcnow() + relativedelta(
 year=dct['y'],
 month=dct['M'],
 day=dct['d'],



[tryton-commits] changeset in tryton:5.4 Store record and field instead of path w...

2020-10-30 Thread Cédric Krier
changeset d37b2a0ee0ec in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=d37b2a0ee0ec
description:
Store record and field instead of path when editing is started

The path can not more be valid or pointing to the proper record if the
treeview model is modified during the edition.

issue9765
review294841002
(grafted from 445bee75c18715f87b35f9e7f20f08d053e2514b)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 725a9a58bf73 -r d37b2a0ee0ec 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 21 
23:21:26 2020 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 28 
23:59:06 2020 +0100
@@ -209,6 +209,7 @@
 class GenericText(Cell):
 align = 0
 editable = None
+editing = None
 
 def __init__(self, view, attrs, renderer=None):
 super(GenericText, self).__init__()
@@ -295,17 +296,17 @@
 callback()
 
 def set_editable(self):
-if not self.editable:
+if not self.editable or not self.editing:
 return
-record, field = self._get_record_field_from_path(self.editable_path)
+record, field = self.editing
 self.editable.set_text(self.get_textual_value(record))
 
 def editing_started(self, cell, editable, path):
 def remove(editable):
 self.editable = None
-self.editable_path = None
+self.editing = None
 self.editable = editable
-self.editable_path = path
+self.editing = self._get_record_field_from_path(path)
 editable.connect('remove-widget', remove)
 return False
 
@@ -981,9 +982,9 @@
 callback()
 
 def set_editable(self):
-if not self.editable:
+if not self.editable and not self.editing:
 return
-record, field = self._get_record_field_from_path(self.editable_path)
+record, field = self.editing
 value = self.get_value(record, field)
 self.update_selection(record, field)
 self.set_popdown_value(self.editable, value)



[tryton-commits] changeset in tryton:5.0 Use editable path to update editable on ...

2020-10-30 Thread Cédric Krier
changeset ffa01a5fda7b in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=ffa01a5fda7b
description:
Use editable path to update editable on display

The current record is not necessary linked to the editable. For example 
when a
new record is added, the current record is changed before the editing 
is done.
Also the CellRendererCombo does not emit remove-widget when focus is 
changed
which prevent to clear the editable variables.

issue9618
issue9266
review314471002
(grafted from 07b4d22509fcbabb19118233e1cacfb4f15d5f3a)
diffstat:

 tryton/gui/window/view_form/view/list.py|   2 +-
 tryton/gui/window/view_form/view/list_gtk/widget.py |  16 +++-
 2 files changed, 12 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 38b91c650e1a -r ffa01a5fda7b tryton/gui/window/view_form/view/list.py
--- a/tryton/gui/window/view_form/view/list.py  Sun Oct 18 20:31:00 2020 +0200
+++ b/tryton/gui/window/view_form/view/list.py  Wed Oct 21 23:21:26 2020 +0200
@@ -1049,7 +1049,7 @@
 if not name:
 continue
 widget = self.get_column_widget(column)
-widget.set_editable(current_record)
+widget.set_editable()
 if decoder.decode(widget.attrs.get('tree_invisible', '0')):
 column.set_visible(False)
 elif name == self.screen.exclude_field:
diff -r 38b91c650e1a -r ffa01a5fda7b 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Sun Oct 18 
20:31:00 2020 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 21 
23:21:26 2020 +0200
@@ -116,7 +116,7 @@
 
 class Cell(object):
 
-def set_editable(self, record):
+def set_editable(self):
 pass
 
 
@@ -264,15 +264,19 @@
 if callback:
 callback()
 
-def set_editable(self, record):
-if not record or not self.editable:
+def set_editable(self):
+if not self.editable:
 return
+store = self.view.treeview.get_model()
+record = store.get_value(store.get_iter(self.editable_path), 0)
 self.editable.set_text(self.get_textual_value(record))
 
 def editing_started(self, cell, editable, path):
 def remove(editable):
 self.editable = None
+self.editable_path = None
 self.editable = editable
+self.editable_path = path
 editable.connect('remove-widget', remove)
 return False
 
@@ -840,9 +844,11 @@
 if callback:
 callback()
 
-def set_editable(self, record):
-if not record or not self.editable:
+def set_editable(self):
+if not self.editable:
 return
+store = self.view.treeview.get_model()
+record = store.get_value(store.get_iter(self.editable_path), 0)
 field = record[self.attrs['name']]
 value = field.get(record)
 self.update_selection(record, field)



[tryton-commits] changeset in tryton:5.4 Use editable path to update editable on ...

2020-10-30 Thread Cédric Krier
changeset 725a9a58bf73 in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=725a9a58bf73
description:
Use editable path to update editable on display

The current record is not necessary linked to the editable. For example 
when a
new record is added, the current record is changed before the editing 
is done.
Also the CellRendererCombo does not emit remove-widget when focus is 
changed
which prevent to clear the editable variables.

issue9618
issue9266
review314471002
(grafted from 07b4d22509fcbabb19118233e1cacfb4f15d5f3a)
diffstat:

 tryton/gui/window/view_form/view/list.py|   2 +-
 tryton/gui/window/view_form/view/list_gtk/widget.py |  19 +--
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (70 lines):

diff -r 1a8da8f7ec03 -r 725a9a58bf73 tryton/gui/window/view_form/view/list.py
--- a/tryton/gui/window/view_form/view/list.py  Sun Oct 18 15:58:43 2020 +0200
+++ b/tryton/gui/window/view_form/view/list.py  Wed Oct 21 23:21:26 2020 +0200
@@ -1045,7 +1045,7 @@
 if not name:
 continue
 widget = self.get_column_widget(column)
-widget.set_editable(current_record)
+widget.set_editable()
 if decoder.decode(widget.attrs.get('tree_invisible', '0')):
 column.set_visible(False)
 elif name == self.screen.exclude_field:
diff -r 1a8da8f7ec03 -r 725a9a58bf73 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Sun Oct 18 
15:58:43 2020 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 21 
23:21:26 2020 +0200
@@ -148,7 +148,7 @@
 cell.set_property('foreground', foreground)
 cell.set_property('foreground-set', bool(foreground))
 
-def set_editable(self, record):
+def set_editable(self):
 pass
 
 
@@ -294,15 +294,18 @@
 if callback:
 callback()
 
-def set_editable(self, record):
-if not record or not self.editable:
+def set_editable(self):
+if not self.editable:
 return
+record, field = self._get_record_field_from_path(self.editable_path)
 self.editable.set_text(self.get_textual_value(record))
 
 def editing_started(self, cell, editable, path):
 def remove(editable):
 self.editable = None
+self.editable_path = None
 self.editable = editable
+self.editable_path = path
 editable.connect('remove-widget', remove)
 return False
 
@@ -977,10 +980,10 @@
 if callback:
 callback()
 
-def set_editable(self, record):
-if not record or not self.editable:
+def set_editable(self):
+if not self.editable:
 return
-field = record[self.attrs['name']]
+record, field = self._get_record_field_from_path(self.editable_path)
 value = self.get_value(record, field)
 self.update_selection(record, field)
 self.set_popdown_value(self.editable, value)
@@ -988,6 +991,10 @@
 def editing_started(self, cell, editable, path):
 super(Selection, self).editing_started(cell, editable, path)
 record, field = self._get_record_field_from_path(path)
+# Combobox does not emit remove-widget when focus is changed
+self.editable.connect(
+'editing-done',
+lambda *a: self.editable.emit('remove-widget'))
 
 def set_value(*a):
 return self.set_value(editable, record, field)



[tryton-commits] changeset in tryton:5.6 Use editable path to update editable on ...

2020-10-30 Thread Cédric Krier
changeset 3aed04dfbd0c in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=3aed04dfbd0c
description:
Use editable path to update editable on display

The current record is not necessary linked to the editable. For example 
when a
new record is added, the current record is changed before the editing 
is done.
Also the CellRendererCombo does not emit remove-widget when focus is 
changed
which prevent to clear the editable variables.

issue9618
issue9266
review314471002
(grafted from 07b4d22509fcbabb19118233e1cacfb4f15d5f3a)
diffstat:

 tryton/gui/window/view_form/view/list.py|   2 +-
 tryton/gui/window/view_form/view/list_gtk/widget.py |  19 +--
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (70 lines):

diff -r 76a9fa354426 -r 3aed04dfbd0c tryton/gui/window/view_form/view/list.py
--- a/tryton/gui/window/view_form/view/list.py  Sun Oct 18 15:58:43 2020 +0200
+++ b/tryton/gui/window/view_form/view/list.py  Wed Oct 21 23:21:26 2020 +0200
@@ -1045,7 +1045,7 @@
 if not name:
 continue
 widget = self.get_column_widget(column)
-widget.set_editable(current_record)
+widget.set_editable()
 if decoder.decode(widget.attrs.get('tree_invisible', '0')):
 column.set_visible(False)
 elif name == self.screen.exclude_field:
diff -r 76a9fa354426 -r 3aed04dfbd0c 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Sun Oct 18 
15:58:43 2020 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 21 
23:21:26 2020 +0200
@@ -149,7 +149,7 @@
 cell.set_property('foreground', foreground)
 cell.set_property('foreground-set', bool(foreground))
 
-def set_editable(self, record):
+def set_editable(self):
 pass
 
 
@@ -294,15 +294,18 @@
 if callback:
 callback()
 
-def set_editable(self, record):
-if not record or not self.editable:
+def set_editable(self):
+if not self.editable:
 return
+record, field = self._get_record_field_from_path(self.editable_path)
 self.editable.set_text(self.get_textual_value(record))
 
 def editing_started(self, cell, editable, path):
 def remove(editable):
 self.editable = None
+self.editable_path = None
 self.editable = editable
+self.editable_path = path
 editable.connect('remove-widget', remove)
 return False
 
@@ -977,10 +980,10 @@
 if callback:
 callback()
 
-def set_editable(self, record):
-if not record or not self.editable:
+def set_editable(self):
+if not self.editable:
 return
-field = record[self.attrs['name']]
+record, field = self._get_record_field_from_path(self.editable_path)
 value = self.get_value(record, field)
 self.update_selection(record, field)
 self.set_popdown_value(self.editable, value)
@@ -988,6 +991,10 @@
 def editing_started(self, cell, editable, path):
 super(Selection, self).editing_started(cell, editable, path)
 record, field = self._get_record_field_from_path(path)
+# Combobox does not emit remove-widget when focus is changed
+self.editable.connect(
+'editing-done',
+lambda *a: self.editable.emit('remove-widget'))
 
 selection_shortcuts(editable)
 



[tryton-commits] changeset in sao:5.0 Keep record added/modified after cancel fro...

2020-10-30 Thread Cédric Krier
changeset 0ff66dc4987c in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=0ff66dc4987c
description:
Keep record added/modified after cancel from popup window

We need to keep the record modified to ensure that it is added to the 
xxx2Many
on save.

issue9298
review296601002
(grafted from e474e7cddb63b3c592b51ae638c076239b725808)
diffstat:

 src/window.js |  4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 53f2f4d70e04 -r 0ff66dc4987c src/window.js
--- a/src/window.js Sat Oct 24 13:12:01 2020 +0200
+++ b/src/window.js Sat Oct 24 13:14:55 2020 +0200
@@ -404,6 +404,7 @@
 !readonly &&
 this.screen.current_record) {
 result = false;
+var added = this.screen.current_record._changed.id;
 if ((this.screen.current_record.id < 0) || this.save_current) {
 cancel_prm = this.screen.cancel_current(
 this._initial_value);
@@ -411,6 +412,9 @@
 this.screen.current_record.cancel();
 cancel_prm = this.screen.current_record.reload();
 }
+if (added) {
+this.screen.current_record._changed.id = added;
+}
 } else {
 result = response_id != 'RESPONSE_CANCEL';
 }



[tryton-commits] changeset in tryton:5.6 Store record and field instead of path w...

2020-10-30 Thread Cédric Krier
changeset ca48c92eaf73 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=ca48c92eaf73
description:
Store record and field instead of path when editing is started

The path can not more be valid or pointing to the proper record if the
treeview model is modified during the edition.

issue9765
review294841002
(grafted from 445bee75c18715f87b35f9e7f20f08d053e2514b)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 3aed04dfbd0c -r ca48c92eaf73 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 21 
23:21:26 2020 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Oct 28 
23:59:06 2020 +0100
@@ -210,6 +210,7 @@
 class GenericText(Cell):
 align = 0
 editable = None
+editing = None
 
 def __init__(self, view, attrs, renderer=None):
 super(GenericText, self).__init__()
@@ -295,17 +296,17 @@
 callback()
 
 def set_editable(self):
-if not self.editable:
+if not self.editable or not self.editing:
 return
-record, field = self._get_record_field_from_path(self.editable_path)
+record, field = self.editing
 self.editable.set_text(self.get_textual_value(record))
 
 def editing_started(self, cell, editable, path):
 def remove(editable):
 self.editable = None
-self.editable_path = None
+self.editing = None
 self.editable = editable
-self.editable_path = path
+self.editing = self._get_record_field_from_path(path)
 editable.connect('remove-widget', remove)
 return False
 
@@ -981,9 +982,9 @@
 callback()
 
 def set_editable(self):
-if not self.editable:
+if not self.editable and not self.editing:
 return
-record, field = self._get_record_field_from_path(self.editable_path)
+record, field = self.editing
 value = self.get_value(record, field)
 self.update_selection(record, field)
 self.set_popdown_value(self.editable, value)



[tryton-commits] changeset in sao:5.6 Call response with the end button attributes

2020-10-30 Thread Cédric Krier
changeset bbb75b900b27 in sao:5.6
details: https://hg.tryton.org/sao?cmd=changeset;node=bbb75b900b27
description:
Call response with the end button attributes

Since rev 15c499b95290, the argument to response must be the button
attributes.

issue9524
review326411002
(grafted from ac14f0561ac59edf78a8a2844151aacc10cd3f4d)
diffstat:

 src/tab.js |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r 20d974bc4aaf -r bbb75b900b27 src/tab.js
--- a/src/tab.jsWed Oct 28 00:02:52 2020 +0100
+++ b/src/tab.jsSun Oct 25 11:03:29 2020 +0100
@@ -1412,7 +1412,8 @@
 var prm = jQuery.when();
 if ((wizard.state !== wizard.end_state) &&
 (wizard.end_state in wizard.states)) {
-prm = wizard.response(wizard.end_state);
+prm = wizard.response(
+wizard.states[wizard.end_state].attributes);
 }
 var dfd = jQuery.Deferred();
 prm.always(function() {



[tryton-commits] changeset in sao:5.0 Do not rely on current record from screen

2020-10-30 Thread Cédric Krier
changeset 5c2d10012907 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=5c2d10012907
description:
Do not rely on current record from screen

If the current record is removed, the attribute is set to None by
cancel_current.

issue9298
review314651002
(grafted from c1ce7d0bb57f5cabb5f2b08ad43cd3d7b520f5b7)
diffstat:

 src/window.js |  13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r 0ff66dc4987c -r 5c2d10012907 src/window.js
--- a/src/window.js Sat Oct 24 13:14:55 2020 +0200
+++ b/src/window.js Wed Oct 28 00:02:52 2020 +0100
@@ -404,16 +404,17 @@
 !readonly &&
 this.screen.current_record) {
 result = false;
-var added = this.screen.current_record._changed.id;
-if ((this.screen.current_record.id < 0) || this.save_current) {
+var record = this.screen.current_record;
+var added = record._changed.id;
+if ((record.id < 0) || this.save_current) {
 cancel_prm = this.screen.cancel_current(
 this._initial_value);
-} else if (this.screen.current_record.has_changed()) {
-this.screen.current_record.cancel();
-cancel_prm = this.screen.current_record.reload();
+} else if (record.has_changed()) {
+record.cancel();
+cancel_prm = record.reload();
 }
 if (added) {
-this.screen.current_record._changed.id = added;
+record._changed.id = added;
 }
 } else {
 result = response_id != 'RESPONSE_CANCEL';



[tryton-commits] changeset in sao:5.4 Do not rely on current record from screen

2020-10-30 Thread Cédric Krier
changeset 145f1a7253ca in sao:5.4
details: https://hg.tryton.org/sao?cmd=changeset;node=145f1a7253ca
description:
Do not rely on current record from screen

If the current record is removed, the attribute is set to None by
cancel_current.

issue9298
review314651002
(grafted from c1ce7d0bb57f5cabb5f2b08ad43cd3d7b520f5b7)
diffstat:

 src/window.js |  13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r c7239649bb22 -r 145f1a7253ca src/window.js
--- a/src/window.js Sat Oct 24 13:14:55 2020 +0200
+++ b/src/window.js Wed Oct 28 00:02:52 2020 +0100
@@ -404,16 +404,17 @@
 !readonly &&
 this.screen.current_record) {
 result = false;
-var added = this.screen.current_record._changed.id;
-if ((this.screen.current_record.id < 0) || this.save_current) {
+var record = this.screen.current_record;
+var added = record._changed.id;
+if ((record.id < 0) || this.save_current) {
 cancel_prm = this.screen.cancel_current(
 this._initial_value);
-} else if (this.screen.current_record.has_changed()) {
-this.screen.current_record.cancel();
-cancel_prm = this.screen.current_record.reload();
+} else if (record.has_changed()) {
+record.cancel();
+cancel_prm = record.reload();
 }
 if (added) {
-this.screen.current_record._changed.id = added;
+record._changed.id = added;
 }
 } else {
 result = response_id != 'RESPONSE_CANCEL';



[tryton-commits] changeset in sao:5.0 Returns an Array with the statements for PY...

2020-10-30 Thread Cédric Krier
changeset 868f316bd9aa in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=868f316bd9aa
description:
Returns an Array with the statements for PYSON string of And/Or

issue9722
review300711002
(grafted from e3d683dfad4661f290279913f3d2b0e7492c2779)
diffstat:

 src/pyson.js |  2 +-
 tests/sao.js |  4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r bd4d2fca03df -r 868f316bd9aa src/pyson.js
--- a/src/pyson.js  Sun Oct 18 20:34:55 2020 +0200
+++ b/src/pyson.js  Wed Oct 21 23:15:18 2020 +0200
@@ -278,7 +278,7 @@
 return ['boolean'];
 },
 __string_params__: function() {
-return this._statements;
+return [this._statements];
 }
 });
 
diff -r bd4d2fca03df -r 868f316bd9aa tests/sao.js
--- a/tests/sao.js  Sun Oct 18 20:34:55 2020 +0200
+++ b/tests/sao.js  Wed Oct 21 23:15:18 2020 +0200
@@ -251,7 +251,7 @@
 QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), false,
 'decode(And([false, false, true]))');
 QUnit.strictEqual(new Sao.PYSON.And([false, true, true]).toString(),
-"And(false, true, true)");
+"And([false, true, true])");
 });
 
 QUnit.test('PYSON Or', function() {
@@ -319,7 +319,7 @@
 QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), true,
 'decode(Or([false, false, true]))');
 QUnit.strictEqual(new Sao.PYSON.Or([false, true, true]).toString(),
-"Or(false, true, true)");
+"Or([false, true, true])");
 });
 
 QUnit.test('PYSON Equal', function() {



[tryton-commits] changeset in sao:5.4 Ensure inserted record has a valid position

2020-10-30 Thread Cédric Krier
changeset c6d2aaa0bcea in sao:5.4
details: https://hg.tryton.org/sao?cmd=changeset;node=c6d2aaa0bcea
description:
Ensure inserted record has a valid position

issue9731
review298881002
(grafted from b028a776dcda25244877378e41fcb6e43b322b27)
diffstat:

 src/model.js |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 249d1bccd47f -r c6d2aaa0bcea src/model.js
--- a/src/model.js  Wed Oct 21 23:15:18 2020 +0200
+++ b/src/model.js  Sat Oct 24 13:12:01 2020 +0200
@@ -142,6 +142,7 @@
 if ((position === undefined) || (position == -1)) {
 position = this.length;
 }
+position = Math.min(position, this.length);
 if (changed === undefined) {
 changed = true;
 }



[tryton-commits] changeset in sao:5.0 Ensure inserted record has a valid position

2020-10-30 Thread Cédric Krier
changeset 53f2f4d70e04 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=53f2f4d70e04
description:
Ensure inserted record has a valid position

issue9731
review298881002
(grafted from b028a776dcda25244877378e41fcb6e43b322b27)
diffstat:

 src/model.js |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 868f316bd9aa -r 53f2f4d70e04 src/model.js
--- a/src/model.js  Wed Oct 21 23:15:18 2020 +0200
+++ b/src/model.js  Sat Oct 24 13:12:01 2020 +0200
@@ -141,6 +141,7 @@
 if ((position === undefined) || (position == -1)) {
 position = this.length;
 }
+position = Math.min(position, this.length);
 if (changed === undefined) {
 changed = true;
 }



[tryton-commits] changeset in sao:5.4 Keep record added/modified after cancel fro...

2020-10-30 Thread Cédric Krier
changeset c7239649bb22 in sao:5.4
details: https://hg.tryton.org/sao?cmd=changeset;node=c7239649bb22
description:
Keep record added/modified after cancel from popup window

We need to keep the record modified to ensure that it is added to the 
xxx2Many
on save.

issue9298
review296601002
(grafted from e474e7cddb63b3c592b51ae638c076239b725808)
diffstat:

 src/window.js |  4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r c6d2aaa0bcea -r c7239649bb22 src/window.js
--- a/src/window.js Sat Oct 24 13:12:01 2020 +0200
+++ b/src/window.js Sat Oct 24 13:14:55 2020 +0200
@@ -404,6 +404,7 @@
 !readonly &&
 this.screen.current_record) {
 result = false;
+var added = this.screen.current_record._changed.id;
 if ((this.screen.current_record.id < 0) || this.save_current) {
 cancel_prm = this.screen.cancel_current(
 this._initial_value);
@@ -411,6 +412,9 @@
 this.screen.current_record.cancel();
 cancel_prm = this.screen.current_record.reload();
 }
+if (added) {
+this.screen.current_record._changed.id = added;
+}
 } else {
 result = response_id != 'RESPONSE_CANCEL';
 }



[tryton-commits] changeset in sao:5.6 Ensure inserted record has a valid position

2020-10-30 Thread Cédric Krier
changeset 5a25cfb55277 in sao:5.6
details: https://hg.tryton.org/sao?cmd=changeset;node=5a25cfb55277
description:
Ensure inserted record has a valid position

issue9731
review298881002
(grafted from b028a776dcda25244877378e41fcb6e43b322b27)
diffstat:

 src/model.js |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 4059e9f8d6f0 -r 5a25cfb55277 src/model.js
--- a/src/model.js  Wed Oct 21 23:15:18 2020 +0200
+++ b/src/model.js  Sat Oct 24 13:12:01 2020 +0200
@@ -142,6 +142,7 @@
 if ((position === undefined) || (position == -1)) {
 position = this.length;
 }
+position = Math.min(position, this.length);
 if (changed === undefined) {
 changed = true;
 }



[tryton-commits] changeset in sao:5.6 Keep record added/modified after cancel fro...

2020-10-30 Thread Cédric Krier
changeset 6c153ebf5927 in sao:5.6
details: https://hg.tryton.org/sao?cmd=changeset;node=6c153ebf5927
description:
Keep record added/modified after cancel from popup window

We need to keep the record modified to ensure that it is added to the 
xxx2Many
on save.

issue9298
review296601002
(grafted from e474e7cddb63b3c592b51ae638c076239b725808)
diffstat:

 src/window.js |  4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 5a25cfb55277 -r 6c153ebf5927 src/window.js
--- a/src/window.js Sat Oct 24 13:12:01 2020 +0200
+++ b/src/window.js Sat Oct 24 13:14:55 2020 +0200
@@ -404,6 +404,7 @@
 !readonly &&
 this.screen.current_record) {
 result = false;
+var added = this.screen.current_record._changed.id;
 if ((this.screen.current_record.id < 0) || this.save_current) {
 cancel_prm = this.screen.cancel_current(
 this._initial_value);
@@ -411,6 +412,9 @@
 this.screen.current_record.cancel();
 cancel_prm = this.screen.current_record.reload();
 }
+if (added) {
+this.screen.current_record._changed.id = added;
+}
 } else {
 result = response_id != 'RESPONSE_CANCEL';
 }



[tryton-commits] changeset in sao:5.6 Do not rely on current record from screen

2020-10-30 Thread Cédric Krier
changeset 20d974bc4aaf in sao:5.6
details: https://hg.tryton.org/sao?cmd=changeset;node=20d974bc4aaf
description:
Do not rely on current record from screen

If the current record is removed, the attribute is set to None by
cancel_current.

issue9298
review314651002
(grafted from c1ce7d0bb57f5cabb5f2b08ad43cd3d7b520f5b7)
diffstat:

 src/window.js |  13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r 6c153ebf5927 -r 20d974bc4aaf src/window.js
--- a/src/window.js Sat Oct 24 13:14:55 2020 +0200
+++ b/src/window.js Wed Oct 28 00:02:52 2020 +0100
@@ -404,16 +404,17 @@
 !readonly &&
 this.screen.current_record) {
 result = false;
-var added = this.screen.current_record._changed.id;
-if ((this.screen.current_record.id < 0) || this.save_current) {
+var record = this.screen.current_record;
+var added = record._changed.id;
+if ((record.id < 0) || this.save_current) {
 cancel_prm = this.screen.cancel_current(
 this._initial_value);
-} else if (this.screen.current_record.has_changed()) {
-this.screen.current_record.cancel();
-cancel_prm = this.screen.current_record.reload();
+} else if (record.has_changed()) {
+record.cancel();
+cancel_prm = record.reload();
 }
 if (added) {
-this.screen.current_record._changed.id = added;
+record._changed.id = added;
 }
 } else {
 result = response_id != 'RESPONSE_CANCEL';



[tryton-commits] changeset in proteus:5.0 PYSON's DateTime defaults to the curren...

2020-10-30 Thread Nicolas Évrard
changeset 8c50765f8982 in proteus:5.0
details: https://hg.tryton.org/proteus?cmd=changeset;node=8c50765f8982
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from 660d71752eafb9d6449fab76ebd8515d14764553)
diffstat:

 proteus/pyson.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r c3d01cd441f6 -r 8c50765f8982 proteus/pyson.py
--- a/proteus/pyson.py  Mon Dec 02 20:47:15 2019 +0100
+++ b/proteus/pyson.py  Thu Oct 22 12:11:09 2020 +0200
@@ -610,7 +610,7 @@
 
 @staticmethod
 def eval(dct, context):
-return datetime.datetime.now() + relativedelta(
+return datetime.datetime.utcnow() + relativedelta(
 year=dct['y'],
 month=dct['M'],
 day=dct['d'],



[tryton-commits] changeset in sao:5.4 Returns an Array with the statements for PY...

2020-10-30 Thread Cédric Krier
changeset 249d1bccd47f in sao:5.4
details: https://hg.tryton.org/sao?cmd=changeset;node=249d1bccd47f
description:
Returns an Array with the statements for PYSON string of And/Or

issue9722
review300711002
(grafted from e3d683dfad4661f290279913f3d2b0e7492c2779)
diffstat:

 src/pyson.js |  2 +-
 tests/sao.js |  4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 578c0d22311c -r 249d1bccd47f src/pyson.js
--- a/src/pyson.js  Sun Oct 18 15:58:43 2020 +0200
+++ b/src/pyson.js  Wed Oct 21 23:15:18 2020 +0200
@@ -285,7 +285,7 @@
 return ['boolean'];
 },
 __string_params__: function() {
-return this._statements;
+return [this._statements];
 }
 });
 
diff -r 578c0d22311c -r 249d1bccd47f tests/sao.js
--- a/tests/sao.js  Sun Oct 18 15:58:43 2020 +0200
+++ b/tests/sao.js  Wed Oct 21 23:15:18 2020 +0200
@@ -253,7 +253,7 @@
 QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), false,
 'decode(And([false, false, true]))');
 QUnit.strictEqual(new Sao.PYSON.And([false, true, true]).toString(),
-"And(false, true, true)");
+"And([false, true, true])");
 });
 
 QUnit.test('PYSON Or', function() {
@@ -321,7 +321,7 @@
 QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), true,
 'decode(Or([false, false, true]))');
 QUnit.strictEqual(new Sao.PYSON.Or([false, true, true]).toString(),
-"Or(false, true, true)");
+"Or([false, true, true])");
 });
 
 QUnit.test('PYSON Equal', function() {



[tryton-commits] changeset in sao:5.6 Returns an Array with the statements for PY...

2020-10-30 Thread Cédric Krier
changeset 4059e9f8d6f0 in sao:5.6
details: https://hg.tryton.org/sao?cmd=changeset;node=4059e9f8d6f0
description:
Returns an Array with the statements for PYSON string of And/Or

issue9722
review300711002
(grafted from e3d683dfad4661f290279913f3d2b0e7492c2779)
diffstat:

 src/pyson.js |  2 +-
 tests/sao.js |  4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 2c343669a5a7 -r 4059e9f8d6f0 src/pyson.js
--- a/src/pyson.js  Sun Oct 18 15:58:43 2020 +0200
+++ b/src/pyson.js  Wed Oct 21 23:15:18 2020 +0200
@@ -285,7 +285,7 @@
 return ['boolean'];
 },
 __string_params__: function() {
-return this._statements;
+return [this._statements];
 }
 });
 
diff -r 2c343669a5a7 -r 4059e9f8d6f0 tests/sao.js
--- a/tests/sao.js  Sun Oct 18 15:58:43 2020 +0200
+++ b/tests/sao.js  Wed Oct 21 23:15:18 2020 +0200
@@ -253,7 +253,7 @@
 QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), false,
 'decode(And([false, false, true]))');
 QUnit.strictEqual(new Sao.PYSON.And([false, true, true]).toString(),
-"And(false, true, true)");
+"And([false, true, true])");
 });
 
 QUnit.test('PYSON Or', function() {
@@ -321,7 +321,7 @@
 QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), true,
 'decode(Or([false, false, true]))');
 QUnit.strictEqual(new Sao.PYSON.Or([false, true, true]).toString(),
-"Or(false, true, true)");
+"Or([false, true, true])");
 });
 
 QUnit.test('PYSON Equal', function() {



[tryton-commits] changeset in modules/account:5.0 Use getattr instead of testing ...

2020-10-30 Thread Cédric Krier
changeset c73d8d1545e4 in modules/account:5.0
details: https://hg.tryton.org/modules/account?cmd=changeset;node=c73d8d1545e4
description:
Use getattr instead of testing origin id

Since changeset b8d76b07910f, the reference value of a negative id is a 
string
so testing the id does not work. It is safer to call getattr with a 
default
empty string value.

issue9500
review304611002
(grafted from 64b7fe63694035a593bfb467408f9d1106d065f3)
diffstat:

 general_ledger.fodt |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 75cc45c523c1 -r c73d8d1545e4 general_ledger.fodt
--- a/general_ledger.fodt   Sun Oct 18 20:51:16 2020 +0200
+++ b/general_ledger.fodt   Sun Oct 25 11:02:23 2020 +0100
@@ -894,7 +894,7 @@
   line.description or 
line.move_description or 

  
  
-  line.origin.rec_name if line.origin and 
line.origin.id = 0 else 
+  getattr(line.origin, rec_name, 
)
  
  
   line.state_string



[tryton-commits] changeset in modules/marketing_automation:5.4 Register SMTPDataM...

2020-10-30 Thread Cédric Krier
changeset bff98117c662 in modules/marketing_automation:5.4
details: 
https://hg.tryton.org/modules/marketing_automation?cmd=changeset;node=bff98117c662
description:
Register SMTPDataManager to the transaction

It must join explicitly a transaction to be finished when the 
transaction is
committed.

issue9721
review329281002
(grafted from 9c2de367f4a8a5700d8dc030cf1668b9fde55831)
diffstat:

 marketing_automation.py |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r 8881afada924 -r bff98117c662 marketing_automation.py
--- a/marketing_automation.py   Sat Oct 03 00:42:50 2020 +0200
+++ b/marketing_automation.py   Sat Oct 24 13:13:11 2020 +0200
@@ -831,9 +831,10 @@
 cls._cancel_opposite(record_activities)
 
 now = datetime.datetime.now()
+smtpd_datamanager = Transaction().join(SMTPDataManager())
 for record_activity in record_activities:
 record_activity.activity.execute(
-record_activity, smtpd_datamanager=SMTPDataManager(), **kwargs)
+record_activity, smtpd_datamanager=smtpd_datamanager, **kwargs)
 record_activity.at = now
 record_activity.state = 'done'
 cls.save(record_activities)



[tryton-commits] changeset in modules/account:5.6 Use getattr instead of testing ...

2020-10-30 Thread Cédric Krier
changeset f438a1981037 in modules/account:5.6
details: https://hg.tryton.org/modules/account?cmd=changeset;node=f438a1981037
description:
Use getattr instead of testing origin id

Since changeset b8d76b07910f, the reference value of a negative id is a 
string
so testing the id does not work. It is safer to call getattr with a 
default
empty string value.

issue9500
review304611002
(grafted from 64b7fe63694035a593bfb467408f9d1106d065f3)
diffstat:

 general_ledger.fodt |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r af1ffed741d6 -r f438a1981037 general_ledger.fodt
--- a/general_ledger.fodt   Sun Oct 18 20:49:47 2020 +0200
+++ b/general_ledger.fodt   Sun Oct 25 11:02:23 2020 +0100
@@ -894,7 +894,7 @@
   line.description or 
line.move_description or 

  
  
-  line.origin.rec_name if line.origin and 
line.origin.id = 0 else 
+  getattr(line.origin, rec_name, 
)
  
  
   line.state_string



[tryton-commits] changeset in proteus:5.4 PYSON's DateTime defaults to the curren...

2020-10-30 Thread Nicolas Évrard
changeset 9600736b94c0 in proteus:5.4
details: https://hg.tryton.org/proteus?cmd=changeset;node=9600736b94c0
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from 660d71752eafb9d6449fab76ebd8515d14764553)
diffstat:

 proteus/pyson.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 2755d3d7cd51 -r 9600736b94c0 proteus/pyson.py
--- a/proteus/pyson.py  Mon Dec 02 20:45:26 2019 +0100
+++ b/proteus/pyson.py  Thu Oct 22 12:11:09 2020 +0200
@@ -630,7 +630,7 @@
 and not isinstance(now, datetime.datetime)):
 now = datetime.datetime.combine(now, datetime.time())
 if not isinstance(now, datetime.datetime):
-now = datetime.datetime.now()
+now = datetime.datetime.utcnow()
 return now + relativedelta(
 year=dct['y'],
 month=dct['M'],



[tryton-commits] changeset in proteus:5.6 PYSON's DateTime defaults to the curren...

2020-10-30 Thread Nicolas Évrard
changeset e093f13fcc1f in proteus:5.6
details: https://hg.tryton.org/proteus?cmd=changeset;node=e093f13fcc1f
description:
PYSON's DateTime defaults to the current time in UTC

issue9698
review329211002
(grafted from 660d71752eafb9d6449fab76ebd8515d14764553)
diffstat:

 proteus/pyson.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 2f15bbad0824 -r e093f13fcc1f proteus/pyson.py
--- a/proteus/pyson.py  Mon May 04 12:02:22 2020 +0200
+++ b/proteus/pyson.py  Thu Oct 22 12:11:09 2020 +0200
@@ -630,7 +630,7 @@
 and not isinstance(now, datetime.datetime)):
 now = datetime.datetime.combine(now, datetime.time())
 if not isinstance(now, datetime.datetime):
-now = datetime.datetime.now()
+now = datetime.datetime.utcnow()
 return now + relativedelta(
 year=dct['y'],
 month=dct['M'],



[tryton-commits] changeset in modules/product_cost_fifo:5.6 Do not set fifo_quant...

2020-10-30 Thread Bernat
changeset 1c540c621623 in modules/product_cost_fifo:5.6
details: 
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=1c540c621623
description:
Do not set fifo_quantity greater than quantity

issue9664
review328231002
(grafted from c21747a2ee8454812ecf5f8e1592a520225e8c20)
diffstat:

 move.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

diff -r c8105e34f32c -r 1c540c621623 move.py
--- a/move.py   Wed Sep 16 14:33:46 2020 +0200
+++ b/move.py   Wed Oct 21 23:33:28 2020 +0200
@@ -95,6 +95,9 @@
 move_qty = Uom.compute_qty(self.product.default_uom, move_qty,
 move.uom, round=False)
 move.fifo_quantity = (move.fifo_quantity or 0.0) + move_qty
+# Due to float, the fifo quantity result can exceed the quantity.
+assert move.quantity >= move.fifo_quantity - move.uom.rounding
+move.fifo_quantity = min(move.fifo_quantity, move.quantity)
 to_save.append(move)
 if to_save:
 # TODO save in do method when product change



[tryton-commits] changeset in modules/product_cost_fifo:5.0 Do not set fifo_quant...

2020-10-30 Thread Bernat
changeset 76648eff51e3 in modules/product_cost_fifo:5.0
details: 
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=76648eff51e3
description:
Do not set fifo_quantity greater than quantity

issue9664
review328231002
(grafted from c21747a2ee8454812ecf5f8e1592a520225e8c20)
diffstat:

 move.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

diff -r cbfa7a6a48ef -r 76648eff51e3 move.py
--- a/move.py   Wed Sep 16 14:34:27 2020 +0200
+++ b/move.py   Wed Oct 21 23:33:28 2020 +0200
@@ -66,6 +66,9 @@
 move_qty = Uom.compute_qty(self.product.default_uom, move_qty,
 move.uom, round=False)
 move.fifo_quantity = (move.fifo_quantity or 0.0) + move_qty
+# Due to float, the fifo quantity result can exceed the quantity.
+assert move.quantity >= move.fifo_quantity - move.uom.rounding
+move.fifo_quantity = min(move.fifo_quantity, move.quantity)
 to_save.append(move)
 if to_save:
 # TODO save in do method when product change



[tryton-commits] changeset in modules/account:5.4 Use getattr instead of testing ...

2020-10-30 Thread Cédric Krier
changeset fcbba39920d0 in modules/account:5.4
details: https://hg.tryton.org/modules/account?cmd=changeset;node=fcbba39920d0
description:
Use getattr instead of testing origin id

Since changeset b8d76b07910f, the reference value of a negative id is a 
string
so testing the id does not work. It is safer to call getattr with a 
default
empty string value.

issue9500
review304611002
(grafted from 64b7fe63694035a593bfb467408f9d1106d065f3)
diffstat:

 general_ledger.fodt |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 0bf27d949d5e -r fcbba39920d0 general_ledger.fodt
--- a/general_ledger.fodt   Sun Oct 18 20:50:20 2020 +0200
+++ b/general_ledger.fodt   Sun Oct 25 11:02:23 2020 +0100
@@ -894,7 +894,7 @@
   line.description or 
line.move_description or 

  
  
-  line.origin.rec_name if line.origin and 
line.origin.id = 0 else 
+  getattr(line.origin, rec_name, 
)
  
  
   line.state_string



[tryton-commits] changeset in modules/product_cost_fifo:5.4 Do not set fifo_quant...

2020-10-30 Thread Bernat
changeset 7981da987b7e in modules/product_cost_fifo:5.4
details: 
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=7981da987b7e
description:
Do not set fifo_quantity greater than quantity

issue9664
review328231002
(grafted from c21747a2ee8454812ecf5f8e1592a520225e8c20)
diffstat:

 move.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

diff -r 14a9a7cd44b7 -r 7981da987b7e move.py
--- a/move.py   Wed Sep 16 14:34:07 2020 +0200
+++ b/move.py   Wed Oct 21 23:33:28 2020 +0200
@@ -95,6 +95,9 @@
 move_qty = Uom.compute_qty(self.product.default_uom, move_qty,
 move.uom, round=False)
 move.fifo_quantity = (move.fifo_quantity or 0.0) + move_qty
+# Due to float, the fifo quantity result can exceed the quantity.
+assert move.quantity >= move.fifo_quantity - move.uom.rounding
+move.fifo_quantity = min(move.fifo_quantity, move.quantity)
 to_save.append(move)
 if to_save:
 # TODO save in do method when product change



[tryton-commits] changeset in modules/marketing_automation:5.6 Register SMTPDataM...

2020-10-30 Thread Cédric Krier
changeset 2335edb9a927 in modules/marketing_automation:5.6
details: 
https://hg.tryton.org/modules/marketing_automation?cmd=changeset;node=2335edb9a927
description:
Register SMTPDataManager to the transaction

It must join explicitly a transaction to be finished when the 
transaction is
committed.

issue9721
review329281002
(grafted from 9c2de367f4a8a5700d8dc030cf1668b9fde55831)
diffstat:

 marketing_automation.py |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r 37fb1d6ddb0e -r 2335edb9a927 marketing_automation.py
--- a/marketing_automation.py   Sat Oct 03 00:42:32 2020 +0200
+++ b/marketing_automation.py   Sat Oct 24 13:13:11 2020 +0200
@@ -843,9 +843,10 @@
 cls._cancel_opposite(record_activities)
 
 now = datetime.datetime.now()
+smtpd_datamanager = Transaction().join(SMTPDataManager())
 for record_activity in record_activities:
 record_activity.activity.execute(
-record_activity, smtpd_datamanager=SMTPDataManager(), **kwargs)
+record_activity, smtpd_datamanager=smtpd_datamanager, **kwargs)
 record_activity.at = now
 record_activity.state = 'done'
 cls.save(record_activities)



[tryton-commits] changeset in sao:default Skip destroyed records when fetching da...

2020-10-30 Thread Nicolas Évrard
changeset e20c9e4289c1 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=e20c9e4289c1
description:
Skip destroyed records when fetching data from the server

issue9669
review294631002
diffstat:

 src/model.js |  18 --
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (56 lines):

diff -r 121dff050d3f -r e20c9e4289c1 src/model.js
--- a/src/model.js  Thu Oct 29 00:04:07 2020 +0100
+++ b/src/model.js  Fri Oct 30 19:01:11 2020 +0100
@@ -269,6 +269,7 @@
 context._timestamp = {};
 records.forEach(function(record) {
 jQuery.extend(context._timestamp, record.get_timestamp());
+record.destroy();
 });
 var record_ids = records.map(function(record) {
 return record.id;
@@ -560,6 +561,7 @@
 this.state_attrs = {};
 this.autocompletion = {};
 this.exception = false;
+this.destroyed = false;
 },
 has_changed: function() {
 return !jQuery.isEmptyObject(this._changed);
@@ -629,7 +631,7 @@
 if (async === undefined) {
 async = true;
 }
-if (this.is_loaded(name)) {
+if (this.destroyed || this.is_loaded(name)) {
 return async? jQuery.when() : this.model.fields[name];
 }
 if (this.group.prm.state() == 'pending') {
@@ -700,7 +702,9 @@
 10);
 
 var filter_group = function(record) {
-return !(name in record._loaded) && (record.id >= 0);
+return (!record.destroyed &&
+(record.id >= 0) &&
+!(name in record._loaded));
 };
 var filter_parent_group = function(record) {
 return (filter_group(record) &&
@@ -1431,6 +1435,16 @@
 this.button_clicks[name] = clicks;
 return clicks;
 }.bind(this));
+},
+destroy: function() {
+var vals = Object.values(this._values);
+for (var i=0; i < vals.length; i++) {
+var val = vals[i];
+if (val.hasOwnProperty('destroy')) {
+val.destroy();
+}
+}
+this.destroyed = true;
 }
 });
 



[tryton-commits] changeset in tryton:default Skip destroyed records when fetching...

2020-10-30 Thread Nicolas Évrard
changeset 07a24f922b0c in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=07a24f922b0c
description:
Skip destroyed records when fetching data from the server

issue9669
review294631002
diffstat:

 tryton/gui/window/view_form/model/group.py  |  1 +
 tryton/gui/window/view_form/model/record.py |  6 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r fdcb600a42bc -r 07a24f922b0c tryton/gui/window/view_form/model/group.py
--- a/tryton/gui/window/view_form/model/group.pyThu Oct 29 15:07:45 
2020 +0100
+++ b/tryton/gui/window/view_form/model/group.pyFri Oct 30 19:01:11 
2020 +0100
@@ -187,6 +187,7 @@
 ctx['_timestamp'] = {}
 for rec in records:
 ctx['_timestamp'].update(rec.get_timestamp())
+rec.destroy()
 record_ids = set(r.id for r in records)
 reload_ids = set(root_group.on_write_ids(list(record_ids)))
 reload_ids -= record_ids
diff -r fdcb600a42bc -r 07a24f922b0c tryton/gui/window/view_form/model/record.py
--- a/tryton/gui/window/view_form/model/record.py   Thu Oct 29 15:07:45 
2020 +0100
+++ b/tryton/gui/window/view_form/model/record.py   Fri Oct 30 19:01:11 
2020 +0100
@@ -40,7 +40,7 @@
 self.destroyed = False
 
 def __getitem__(self, name):
-if name not in self._loaded and self.id >= 0:
+if not self.destroyed and self.id >= 0 and name not in self._loaded:
 id2record = {
 self.id: self,
 }
@@ -82,7 +82,9 @@
 limit = int(CONFIG['client.limit'] / len(fnames))
 
 def filter_group(record):
-return name not in record._loaded and record.id >= 0
+return (not record.destroyed
+and record.id >= 0
+and name not in record._loaded)
 
 def filter_parent_group(record):
 return (filter_group(record)



[tryton-commits] changeset in cookiecutter:default Use github mirror

2020-10-30 Thread Sergi Almacellas Abellana
changeset d0ea46dd2440 in cookiecutter:default
details: https://hg.tryton.org/cookiecutter?cmd=changeset;node=d0ea46dd2440
description:
Use github mirror

issue9746
diffstat:

 {{ cookiecutter.module_name }}/setup.py |  2 +-
 {{ cookiecutter.module_name }}/tox.ini  |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 2c96bb8c48e9 -r d0ea46dd2440 {{ cookiecutter.module_name }}/setup.py
--- a/{{ cookiecutter.module_name }}/setup.py   Sat Oct 24 13:45:15 2020 +0200
+++ b/{{ cookiecutter.module_name }}/setup.py   Fri Oct 30 15:15:41 2020 +0100
@@ -78,7 +78,7 @@
 {%- endif %}
 dependency_links = []
 if minor_version % 2:
-dependency_links.append('https://trydevpi.tryton.org/{% if 
cookiecutter.prefix %}?mirror=bitbucket{% endif %}')
+dependency_links.append('https://trydevpi.tryton.org/{% if 
cookiecutter.prefix %}?mirror=github{% endif %}')
 
 setup(name=name,
 version=version,
diff -r 2c96bb8c48e9 -r d0ea46dd2440 {{ cookiecutter.module_name }}/tox.ini
--- a/{{ cookiecutter.module_name }}/tox.iniSat Oct 24 13:45:15 2020 +0200
+++ b/{{ cookiecutter.module_name }}/tox.iniFri Oct 30 15:15:41 2020 +0100
@@ -12,4 +12,4 @@
 postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
 sqlite: DB_NAME={env:SQLITE_NAME::memory:}
 postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
-install_command = pip install --pre --find-links 
https://trydevpi.tryton.org/{% if cookiecutter.prefix %}?mirror=bitbucket{% 
endif %} {opts} {packages}
+install_command = pip install --pre --find-links 
https://trydevpi.tryton.org/{% if cookiecutter.prefix %}?mirror=github{% endif 
%} {opts} {packages}



[tryton-commits] changeset in weblate:default Translated using Weblate (Dutch)

2020-10-30 Thread Bert Defoor
changeset 8ee8c0652d98 in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset;node=8ee8c0652d98
description:
Translated using Weblate (Dutch)

Currently translated at 100.0% (31 of 31 strings)

Translation: Tryton/sale_secondary_unit
Translate-URL: 
https://translate.tryton.org/projects/tryton/sale_secondary_unit/nl/
diffstat:

 modules/sale_secondary_unit/locale/nl.po |  10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r d2a3a51d9a7a -r 8ee8c0652d98 modules/sale_secondary_unit/locale/nl.po
--- a/modules/sale_secondary_unit/locale/nl.po  Fri Oct 30 10:28:55 2020 +
+++ b/modules/sale_secondary_unit/locale/nl.po  Fri Oct 30 10:29:42 2020 +
@@ -1,13 +1,13 @@
 #
 msgid ""
 msgstr ""
-"PO-Revision-Date: 2020-07-30 20:48+\n"
+"PO-Revision-Date: 2020-10-30 11:35+\n"
 "Last-Translator: Bert Defoor \n"
 "Language: nl\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.1.1\n"
+"X-Generator: Weblate 4.2.2\n"
 
 msgctxt "field:product.product,sale_secondary_uom:"
 msgid "Sale Secondary UOM"
@@ -77,7 +77,6 @@
 msgid "Sale Secondary UOM Rate"
 msgstr "Verkoop Secundair maateenheid-tarief"
 
-#, fuzzy
 msgctxt "help:product.product,sale_secondary_uom_factor:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -86,7 +85,6 @@
 "De coëfficiënt voor de formule:\n"
 "1 (verkoopeenheid) = coëfficiënt (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:product.product,sale_secondary_uom_rate:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -95,7 +93,6 @@
 "De coëfficiënt voor de formule:\n"
 "coëfficiënt (verkoopeenheid) = 1 (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:product.template,sale_secondary_uom_factor:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -104,7 +101,6 @@
 "De coëfficiënt voor de formule:\n"
 "1 (verkoopeenheid) = coëfficiënt (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:product.template,sale_secondary_uom_rate:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -113,7 +109,6 @@
 "De coëfficiënt voor de formule:\n"
 "coëfficiënt (verkoopeenheid) = 1 (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:sale.product_customer,sale_secondary_uom_factor:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -122,7 +117,6 @@
 "De coëfficiënt voor de formule:\n"
 "1 (verkoopeenheid) = coëfficiënt (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:sale.product_customer,sale_secondary_uom_rate:"
 msgid ""
 "The coefficient for the formula:\n"



[tryton-commits] changeset in weblate:default Translated using Weblate (Dutch)

2020-10-30 Thread Bert Defoor
changeset d2a3a51d9a7a in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset;node=d2a3a51d9a7a
description:
Translated using Weblate (Dutch)

Currently translated at 100.0% (32 of 32 strings)

Translation: Tryton/purchase_secondary_unit
Translate-URL: 
https://translate.tryton.org/projects/tryton/purchase_secondary_unit/nl/
diffstat:

 modules/purchase_secondary_unit/locale/nl.po |  10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r 3dbf1c855654 -r d2a3a51d9a7a 
modules/purchase_secondary_unit/locale/nl.po
--- a/modules/purchase_secondary_unit/locale/nl.po  Fri Oct 30 10:27:42 
2020 +
+++ b/modules/purchase_secondary_unit/locale/nl.po  Fri Oct 30 10:28:55 
2020 +
@@ -1,13 +1,13 @@
 #
 msgid ""
 msgstr ""
-"PO-Revision-Date: 2020-07-30 20:48+\n"
+"PO-Revision-Date: 2020-10-30 11:35+\n"
 "Last-Translator: Bert Defoor \n"
 "Language: nl\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.1.1\n"
+"X-Generator: Weblate 4.2.2\n"
 
 msgctxt "field:product.product,purchase_secondary_uom:"
 msgid "Purchase Secondary UOM"
@@ -81,7 +81,6 @@
 msgid "Product Secondary UOM Category"
 msgstr "Product secundaire maateenheid categorie"
 
-#, fuzzy
 msgctxt "help:product.product,purchase_secondary_uom_factor:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -90,7 +89,6 @@
 "De coëfficiënt voor de formule:\n"
 "1 (inkoopeenheid) = coëfficiënt (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:product.product,purchase_secondary_uom_rate:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -99,7 +97,6 @@
 "De coëfficiënt voor de formule:\n"
 "coëfficiënt (inkoopeenheid) = 1 (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:product.template,purchase_secondary_uom_factor:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -108,7 +105,6 @@
 "De coëfficiënt voor de formule:\n"
 "1 (inkoopeenheid) = coëfficiënt (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:product.template,purchase_secondary_uom_rate:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -117,7 +113,6 @@
 "De coëfficiënt voor de formule:\n"
 "coëfficiënt (inkoopeenheid) = 1 (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:purchase.product_supplier,purchase_secondary_uom_factor:"
 msgid ""
 "The coefficient for the formula:\n"
@@ -126,7 +121,6 @@
 "De coëfficiënt voor de formule:\n"
 "1 (inkoopeenheid) = coëfficiënt (secundaire eenheid)"
 
-#, fuzzy
 msgctxt "help:purchase.product_supplier,purchase_secondary_uom_rate:"
 msgid ""
 "The coefficient for the formula:\n"



[tryton-commits] changeset in weblate:default Translated using Weblate (Dutch)

2020-10-30 Thread Bert Defoor
changeset 3dbf1c855654 in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset;node=3dbf1c855654
description:
Translated using Weblate (Dutch)

Currently translated at 100.0% (843 of 843 strings)

Translation: Tryton/ir
Translate-URL: https://translate.tryton.org/projects/tryton/ir/nl/
diffstat:

 trytond/trytond/ir/locale/nl.po |  15 +--
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (70 lines):

diff -r 3e4ad8c18e01 -r 3dbf1c855654 trytond/trytond/ir/locale/nl.po
--- a/trytond/trytond/ir/locale/nl.po   Fri Oct 30 07:10:02 2020 +
+++ b/trytond/trytond/ir/locale/nl.po   Fri Oct 30 10:27:42 2020 +
@@ -1,7 +1,7 @@
 #
 msgid ""
 msgstr ""
-"PO-Revision-Date: 2020-10-14 00:18+\n"
+"PO-Revision-Date: 2020-10-30 11:34+\n"
 "Last-Translator: Bert Defoor \n"
 "Language: nl\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -1449,7 +1449,6 @@
 msgid "The field that contains the secondary recipient(s)."
 msgstr "Het veld dat de verborgen ontvanger(s) bevat."
 
-#, fuzzy
 msgctxt "help:ir.email.template,recipients_hidden_pyson:"
 msgid ""
 "A PYSON expression that generates a list of hidden recipients with the "
@@ -1458,7 +1457,6 @@
 "Een PYSON-expressie die een lijst met verborgen ontvangers genereert met het "
 "record vertegenwoordigd door \"self\"."
 
-#, fuzzy
 msgctxt "help:ir.email.template,recipients_pyson:"
 msgid ""
 "A PYSON expression that generates a list of recipients with the record "
@@ -1471,7 +1469,6 @@
 msgid "The field that contains the secondary recipient(s)."
 msgstr "Het veld dat de secundaire ontvanger(s) bevat."
 
-#, fuzzy
 msgctxt "help:ir.email.template,recipients_secondary_pyson:"
 msgid ""
 "A PYSON expression that generates a list of secondary recipients with the "
@@ -2365,14 +2362,13 @@
 msgid "Edited by"
 msgstr "Bewerk door"
 
-#, fuzzy
 msgctxt "model:ir.message,text:msg_email_template_invalid_body"
 msgid ""
 "Invalid body in e-mail template \"%(template)s\" with exception "
 "\"%(exception)s\"."
 msgstr ""
-"Ongeldige tekst in e-mailsjabloon \"%(template)s\" met uitzondering "
-"\"%(exception)s\""
+"Ongeldige tekst in e-mailsjabloon \"%(template)s\" met uitzondering \""
+"%(exception)s\"."
 
 msgctxt "model:ir.message,text:msg_email_template_invalid_field_pyson"
 msgid ""
@@ -2389,14 +2385,13 @@
 "Het PYSON %(field)s in e-mailsjabloon \"%(template)s\" moet een lijst "
 "genereren."
 
-#, fuzzy
 msgctxt "model:ir.message,text:msg_email_template_invalid_subject"
 msgid ""
 "Invalid subject in e-mail template \"%(template)s\" with exception "
 "\"%(exception)s\"."
 msgstr ""
-"Ongeldige onderwerp in e-mailsjabloon \"%(template)s\" met uitzondering "
-"\"%(exception)s\""
+"Ongeldige onderwerp in e-mailsjabloon \"%(template)s\" met uitzondering \""
+"%(exception)s\"."
 
 msgctxt "model:ir.message,text:msg_foreign_model_exist"
 msgid ""



[tryton-commits] changeset in weblate:default Translated using Weblate (German)

2020-10-30 Thread Korbinian Preisler
changeset 3e4ad8c18e01 in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset;node=3e4ad8c18e01
description:
Translated using Weblate (German)

Currently translated at 100.0% (88 of 88 strings)

Translation: Tryton/purchase_request_quotation
Translate-URL: 
https://translate.tryton.org/projects/tryton/purchase_request_quotation/de/
diffstat:

 modules/purchase_request_quotation/locale/de.po |  8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r c94a5d826e7e -r 3e4ad8c18e01 
modules/purchase_request_quotation/locale/de.po
--- a/modules/purchase_request_quotation/locale/de.po   Thu Oct 29 09:16:50 
2020 +
+++ b/modules/purchase_request_quotation/locale/de.po   Fri Oct 30 07:10:02 
2020 +
@@ -1,13 +1,13 @@
 #
 msgid ""
 msgstr ""
-"PO-Revision-Date: 2020-04-28 08:40+\n"
-"Last-Translator: Udo Spallek \n"
+"PO-Revision-Date: 2020-10-30 08:58+\n"
+"Last-Translator: Korbinian Preisler \n"
 "Language: de\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.11.3\n"
+"X-Generator: Weblate 4.2.2\n"
 
 msgctxt "field:purchase.configuration,purchase_request_quotation_sequence:"
 msgid "Purchase Request Quotation Sequence"
@@ -338,7 +338,7 @@
 
 msgctxt "view:purchase.request.quotation:"
 msgid "Quotation"
-msgstr "Angebot"
+msgstr "Angebotsanfrage"
 
 msgctxt "view:purchase.request.quotation:"
 msgid "Receive"