changeset d1e349389ead in modules/project:default
details: https://hg.tryton.org/modules/project?cmd=changeset;node=d1e349389ead
description:
        Remove domain on status when type is empty

        The 'in' clause on multiselection fields does not allow 'None' as value.

        issue7746
diffstat:

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

diffs (22 lines):

diff -r dca2bc7ae397 -r d1e349389ead work.py
--- a/work.py   Tue Jan 28 11:45:54 2020 +0100
+++ b/work.py   Tue Jan 28 19:10:46 2020 +0100
@@ -11,7 +11,7 @@
     ModelView, ModelSQL, fields, sequence_ordered, tree, DeactivableMixin)
 from trytond.transaction import Transaction
 from trytond.pool import Pool
-from trytond.pyson import Eval, PYSONEncoder
+from trytond.pyson import Eval, If, Bool, PYSONEncoder
 from trytond.tools import reduce_ids, grouped_slice
 
 from .exceptions import WorkProgressValidationError
@@ -195,7 +195,8 @@
         depends=['company'])
     status = fields.Many2One(
         'project.work.status', "Status", required=True, select=True,
-        domain=[('types', 'in', Eval('type'))], depends=['type'])
+        domain=[If(Bool(Eval('type')), ('types', 'in', Eval('type')), ())],
+        depends=['type'])
 
     @staticmethod
     def default_type():

Reply via email to