Skip to content

Commit dda28f1

Browse files
committed
[FIX] search for function "search" and "inverse" on fields + tests for OLS03018
1 parent 3dcf4a9 commit dda28f1

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

server/src/core/python_arch_eval_hooks.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,8 @@ impl PythonArchEvalHooks {
10311031
("comodel_name", "str"),
10321032
("related", "str"),
10331033
("compute", "str"),
1034+
("inverse", "str"),
1035+
("search", "str"),
10341036
("inverse_name", "str"),
10351037
("delegate", "bool"),
10361038
("required", "bool"),

server/tests/data/addons/module_1/models/diagnostics.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@ class ModelWithDiagnostics(models.Model):
88

99
int_field = fields.Integer()
1010
test_models = fields.One2many("pygls.tests.base_test_model", "diagnostics_id")
11-
test_models_wrong_dep = fields.One2many("module_2.custom_model", "diag_id") # OLS03015, OLS03021
11+
test_models_wrong_dep = fields.One2many("module_2.custom_model", "diag_id") # OLS03015
1212
test_models_wrong_dep_kw = fields.One2many(comodel_name="module_2.custom_model", inverse_name="diag_id") # OLS03015, OLS03021
1313
test_no_model = fields.Many2one("non.existent.model") # OLS03016
1414
test_no_model_kw = fields.Many2one(comodel_name="non.existent.model") # OLS03016
1515
test_related = fields.Integer(related="test_models.test_int")
1616
test_related_wrong = fields.Integer(related="test_models.diagnostics_ids") #OLS03017
17+
18+
test_method_search = fields.Integer(search="_search_1")
19+
test_method_search = fields.Integer(search="_search_2") # OLS03018
20+
test_method_search = fields.Integer(compute="_compute_1")
21+
test_method_search = fields.Integer(compute="_compute_2") # OLS03018
22+
test_method_search = fields.Integer(inverse="_inverse_1")
23+
test_method_search = fields.Integer(inverse="_inverse_2") # OLS03018
24+
1725
date = fields.Date()
1826

1927
to_compute = fields.Integer(compute="_compute_field")
@@ -82,4 +90,13 @@ def test_search_domain(self):
8290
@api.constrains("int_field")
8391
@api.constrains("wrong_field") # OLS03014
8492
def _compute_field(self):
93+
pass
94+
95+
def _search_1(self, operator, value):
96+
pass
97+
98+
def _compute_1(self):
99+
pass
100+
101+
def _inverse_1(self):
85102
pass

0 commit comments

Comments
 (0)