changeset 73df1e42fd1a in modules/stock_quantity_early_planning:default
details: 
https://hg.tryton.org/modules/stock_quantity_early_planning?cmd=changeset&node=73df1e42fd1a
description:
        Do not display earliest percentage when earliest date is empty

        issue10823
        review385121002
diffstat:

 stock.py |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r d6aafaf066a2 -r 73df1e42fd1a stock.py
--- a/stock.py  Sun Jul 04 17:54:48 2021 +0200
+++ b/stock.py  Mon Oct 11 18:37:24 2021 +0200
@@ -37,7 +37,13 @@
     earliest_date = fields.Function(
         fields.Date("Earliest Date"), 'get_earliest_date')
     earliest_percentage = fields.Function(
-        fields.Float("Earliest Percentage"), 'get_earliest_percentage')
+        fields.Float(
+            "Earliest Percentage",
+            states={
+                'invisible': ~Eval('earliest_date'),
+                },
+            depends=['earliest_date']),
+        'get_earliest_percentage')
     warehouse = fields.Function(
         fields.Many2One('stock.location', "Warehouse"),
         'on_change_with_warehouse')

Reply via email to