summaryrefslogtreecommitdiff
path: root/odoo/addons/test_new_api/ir.model.access.csv
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2017-03-15 17:11:16 +0100
committerNicolas Lempereur <nle@odoo.com>2017-03-16 11:57:04 +0100
commitcc1c15327cddf2b512e01e0b7b31e2aa6a1d34fe (patch)
treecfb1d840e285c63ec461fd450070dfdeb09ec142 /odoo/addons/test_new_api/ir.model.access.csv
parent27f656a23e92df52b2f78fdd7c31b8c045b1f39b (diff)
[FIX] expression: improve o2m with m2o integer
We sometimes use in Odoo a One2many field with an inverse Integer field instead of a usual Many2one. This allow for example in several instances to have a "Many2one" which can be reference from several models, eg: Model Ranking: name = String field res_id = Integer field res_model = String field Model Toy: rank = One2many [inverse: Ranking -> res_id] [domain: res_model == Toy] Model Tool: rank = One2many [inverse: Ranking -> res_id] [domain: res_model == Tool] This enable us to have a shared feature between otherwise unrelated models. But there was several issue when searching on these One2many: 1) if the Integer Many2one was not stored (eg. it came from an inherits) on the searched model, this could lead to an error. 2) when we searched: - by IDs (rank in ['55']) with at least one id not respecting the domain - by IDs with a negative operator - with a negative operator on unfound string (rank != "no rank has this") - with a false value (rank = False) we would not apply the One2many domain (eg. res_model == Toy) and thus possibly getting Toy 3 errenously because a Tool 3 was found without the domain being applied. This fix modify the search on One2many and for: 1. if the inverse is an Integer not stored field instead of Many2one manage it. 2. if the field is an Integer field instead of Many2one and there is a domain on the One2many: apply the domain on the inverse model found. So only some search on One2many with a domain whose inverse field is an Integer could be impacted. This would also be nice to have for all One2many with a domain but the probability of it being useful versus risk for performance is not judged high enough. opw-710508
Diffstat (limited to 'odoo/addons/test_new_api/ir.model.access.csv')
-rw-r--r--odoo/addons/test_new_api/ir.model.access.csv3
1 files changed, 3 insertions, 0 deletions
diff --git a/odoo/addons/test_new_api/ir.model.access.csv b/odoo/addons/test_new_api/ir.model.access.csv
index 3862f4ce84f..0dd4efcda72 100644
--- a/odoo/addons/test_new_api/ir.model.access.csv
+++ b/odoo/addons/test_new_api/ir.model.access.csv
@@ -5,6 +5,9 @@ access_message,test_new_api_message,test_new_api.model_test_new_api_message,,1,1
access_emailmessage,test_new_api_emailmessage,test_new_api.model_test_new_api_emailmessage,,1,1,1,1
access_multi,test_new_api_multi,test_new_api.model_test_new_api_multi,,1,1,1,1
access_multi_line,test_new_api_multi_line,test_new_api.model_test_new_api_multi_line,,1,1,1,1
+access_creativework_edition,test_new_api_creativework_edition,model_test_new_api_creativework_edition,,1,1,1,1
+access_creativework_book,test_new_api_creativework_book,model_test_new_api_creativework_book,,1,1,1,1
+access_creativework_movie,test_new_api_creativework_movie,model_test_new_api_creativework_movie,,1,1,1,1
access_mixed,test_new_api_mixed,test_new_api.model_test_new_api_mixed,,1,1,1,1
access_domain_bool,access_domain_bool,model_domain_bool,,1,1,1,1
access_test_new_api_foo,access_test_new_api_foo,model_test_new_api_foo,,1,1,1,1