diff --git a/trytond/trytond/model/fields/function.py b/trytond/trytond/model/fields/function.py index 6b7d08dc28..6b2c0eb04d 100644 --- a/trytond/trytond/model/fields/function.py +++ b/trytond/trytond/model/fields/function.py @@ -240,10 +240,14 @@ class Function(Field): def searchable(self, model): return super().searchable(model) and ( - bool(self.searcher) or hasattr(model, f'domain_{self.name}')) + bool(self.searcher) + or hasattr(model, f'domain_{self.name}') + or hasattr(model, f'column_{self.name}')) def sortable(self, model): - return super().sortable(model) and hasattr(model, f'order_{self.name}') + return super().sortable(model) and ( + hasattr(model, f'order_{self.name}') + or hasattr(model, f'column_{self.name}')) def getter_multiple(self, method): "Returns True if getter function accepts multiple fields" diff --git a/trytond/trytond/tests/test_field_function.py b/trytond/trytond/tests/test_field_function.py index fb1e37888e..3b5b8b9afd 100644 --- a/trytond/trytond/tests/test_field_function.py +++ b/trytond/trytond/tests/test_field_function.py @@ -158,6 +158,7 @@ class FieldFunctionTestCase(TestCase): result = Model.search([('value_inc', '=', 43)]) self.assertEqual(result, [record]) + self.assertTrue(Model.value_inc.searchable(Model)) @with_transaction() def test_no_getter_order(self): @@ -174,6 +175,7 @@ class FieldFunctionTestCase(TestCase): self.assertEqual(asc, sorted(asc)) self.assertEqual(desc, sorted(asc, reverse=True)) + self.assertTrue(Model.value_inc.sortable(Model)) @with_transaction() def test_no_getter_relation(self):