changeset d6d4842f34b2 in trytond:5.0
details: https://hg.tryton.org/trytond?cmd=changeset;node=d6d4842f34b2
description:
        Disable sortable and searchable on ModelView only

        Those feature depends on the Model having a search method.

        issue7878
        review56491002
        (grafted from 517ffd25f88001c5a46d28615d209f93386bb69f)
diffstat:

 trytond/model/model.py |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (25 lines):

diff -r 8b2e9b5b396f -r d6d4842f34b2 trytond/model/model.py
--- a/trytond/model/model.py    Mon Dec 03 11:29:43 2018 +0100
+++ b/trytond/model/model.py    Mon Dec 17 23:03:19 2018 +0100
@@ -242,14 +242,17 @@
                         and getattr(cls._fields[field], arg):
                     res[field][arg] = copy.copy(getattr(cls._fields[field],
                         arg))
-            if (isinstance(cls._fields[field],
-                        (fields.Function, fields.One2Many, fields.Many2Many))
-                    and not getattr(cls, 'order_%s' % field, None)):
+            if ((isinstance(cls._fields[field],
+                            (fields.Function, fields.One2Many,
+                                fields.Many2Many))
+                        and not getattr(cls, 'order_%s' % field, None))
+                    or not hasattr(cls, 'search')):
                 res[field]['sortable'] = False
             if ((isinstance(cls._fields[field], fields.Function)
                         and not (cls._fields[field].searcher
                             or getattr(cls, 'domain_%s' % field, None)))
-                    or (cls._fields[field]._type in ('binary', 'sha'))):
+                    or (cls._fields[field]._type in ('binary', 'sha'))
+                    or not hasattr(cls, 'search')):
                 res[field]['searchable'] = False
             else:
                 res[field]['searchable'] = True

Reply via email to