From b8af68cf59e16d6c409eada480fb3c7d6c48daef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 5 Nov 2019 10:33:25 +0100 Subject: [PATCH] Do not check timestamp when it is None issue8779 review268321002 --- trytond/model/modelsql.py | 2 ++ trytond/tests/test_modelsql.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index ac5a5604bb..0ace0b7fdb 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -539,6 +539,8 @@ class ModelSQL(ModelStorage): '%s,%s' % (cls.__name__, id_)) except KeyError: continue + if timestamp is None: + continue sql_type = fields.Char('timestamp').sql_type().base where.append((table.id == id_) & (Extract('EPOCH', diff --git a/trytond/tests/test_modelsql.py b/trytond/tests/test_modelsql.py index 5c8b079eac..2e73b85f72 100644 --- a/trytond/tests/test_modelsql.py +++ b/trytond/tests/test_modelsql.py @@ -305,6 +305,10 @@ class ModelSQLTestCase(unittest.TestCase): self.assertRaises(ConcurrencyException, ModelsqlTimestamp.delete, [record]) + transaction.timestamp[str(record)] = None + ModelsqlTimestamp.write([record], {}) + transaction.commit() + transaction.timestamp.pop(str(record), None) ModelsqlTimestamp.write([record], {}) transaction.commit()