summaryrefslogtreecommitdiff
path: root/odoo/addons/test_new_api/security
diff options
context:
space:
mode:
authorAdrian Torres <adt@odoo.com>2021-03-04 07:42:07 +0000
committerAdrian Torres <adt@odoo.com>2021-03-10 13:12:18 +0000
commitf5c7e861ee3ca0cdeb6c2f06d227ada07f923ed0 (patch)
tree2b8eee4e4f16821b040fd67d03e6115d17ba87d6 /odoo/addons/test_new_api/security
parent2e238f1e0202d65a98177939dac166dd659bb39c (diff)
[FIX] base: properly execute Selection field ondelete actions
With this commit, 2 changes are made to the way that the fields.Selection.ondelete cleanup action works: 1) We manually delete ir.model.fields.selection **before** the deletion of ir.model.fields purposefully to **avoid** SQL CASCADE deletes, as we do not know which selections are deleted in cascade and thus we cannot perform the corresponding ondelete cleanup action (which is implemented within the ORM). 2) In some actions, namely 'set default' and 'set null', we write a "safe" value to the records containing the Selection being deleted, before this commit this would go through the ORM (records.write()) but this is problematic if there's a write override for the record's model that raises an error for the field being written to. With this commit, we first try to go through the ORM but if there's a failure (because of the raise in a write override) then we will bypass the ORM and set it with SQL. opw-2451126 closes odoo/odoo#67253 Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
Diffstat (limited to 'odoo/addons/test_new_api/security')
-rw-r--r--odoo/addons/test_new_api/security/ir.model.access.csv1
1 files changed, 1 insertions, 0 deletions
diff --git a/odoo/addons/test_new_api/security/ir.model.access.csv b/odoo/addons/test_new_api/security/ir.model.access.csv
index 09ac7f1fc83..61785a225ea 100644
--- a/odoo/addons/test_new_api/security/ir.model.access.csv
+++ b/odoo/addons/test_new_api/security/ir.model.access.csv
@@ -61,6 +61,7 @@ access_test_new_api_monetary_order_line,access_test_new_api_monetary_order_line,
access_test_new_api_model_selection_base,access_test_new_api_model_selection_base,model_test_new_api_model_selection_base,,1,1,1,1
access_test_new_api_model_selection_required,access_test_new_api_model_selection_required,model_test_new_api_model_selection_required,,1,1,1,1
access_test_new_api_model_selection_non_stored,access_test_new_api_model_selection_non_stored,model_test_new_api_model_selection_non_stored,,1,1,1,1
+access_test_new_api_model_selection_required_for_write_override,access_test_new_api_model_selection_required_for_write_override,model_test_new_api_model_selection_required_for_write_override,,1,1,1,1
access_test_new_api_move,access_test_new_api_move,model_test_new_api_move,,1,1,1,1
access_test_new_api_move_line,access_test_new_api_move_line,model_test_new_api_move_line,,1,1,1,1
access_test_new_api_model_shared_cache_compute_parent,access_test_new_api.model_shared_cache_compute_parent,model_test_new_api_model_shared_cache_compute_parent,,1,1,1,1