changeset 659f781d137f in trytond:5.4
details: https://hg.tryton.org/trytond?cmd=changeset;node=659f781d137f
description:
        Do not check timestamp when it is None

        issue8779
        review268321002
        (grafted from 3e6a252d097b011a21818c0449cc856f5b278446)
diffstat:

 trytond/model/modelsql.py      |  2 ++
 trytond/tests/test_modelsql.py |  4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diffs (26 lines):

diff -r 6646563a4cd5 -r 659f781d137f trytond/model/modelsql.py
--- a/trytond/model/modelsql.py Mon Nov 04 12:45:29 2019 +0100
+++ b/trytond/model/modelsql.py Tue Nov 05 10:33:25 2019 +0100
@@ -539,6 +539,8 @@
                         '%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 -r 6646563a4cd5 -r 659f781d137f trytond/tests/test_modelsql.py
--- a/trytond/tests/test_modelsql.py    Mon Nov 04 12:45:29 2019 +0100
+++ b/trytond/tests/test_modelsql.py    Tue Nov 05 10:33:25 2019 +0100
@@ -305,6 +305,10 @@
         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()

Reply via email to