changeset 781891848d05 in modules/production:default
details: 
https://hg.tryton.org/modules/production?cmd=changeset&node=781891848d05
description:
        Enforce positive timedelta

        issue11869
        review421921004
diffstat:

 product.py |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r f3b1a93023a5 -r 781891848d05 product.py
--- a/product.py        Mon Oct 31 17:25:00 2022 +0100
+++ b/product.py        Thu Nov 24 19:16:51 2022 +0100
@@ -5,7 +5,7 @@
     MatchMixin, ModelSQL, ModelView, fields, sequence_ordered)
 from trytond.model.exceptions import RecursionError
 from trytond.pool import PoolMeta
-from trytond.pyson import Bool, Eval, Get, If
+from trytond.pyson import Bool, Eval, Get, If, TimeDelta
 
 
 class Template(metaclass=PoolMeta):
@@ -116,7 +116,12 @@
                     Eval('product', -1),
                     Get(Eval('_parent_product', {}), 'id', 0))),
             ])
-    lead_time = fields.TimeDelta('Lead Time')
+    lead_time = fields.TimeDelta(
+        "Lead Time",
+        domain=['OR',
+            ('lead_time', '=', None),
+            ('lead_time', '>=', TimeDelta()),
+            ])
 
     @classmethod
     def __setup__(cls):

Reply via email to