From 231cae2e7f72774c8dfc20f549e3c8dc3bcb4cf6 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Mon, 12 Mar 2018 04:14:01 -0500 Subject: [PATCH] [FIX] fields: copy_cache with failed values onto sudo env (#23122) Do not copy failed values, as they usually reveal access error that should not occur in the sudoed env. Closes #23121 --- odoo/fields.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/odoo/fields.py b/odoo/fields.py index 16e5e881fab..d19778a0a6a 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -69,6 +69,10 @@ def copy_cache(records, env): for record_id in record_ids: if record_id in src_cache: # copy the cached value as such + if isinstance(src_cache[record_id], FailedValue): + # But not if it's a FailedValue, which often is an access error + # because the other environment (eg. sudo()) is well expected to have access. + continue value = dst_cache[record_id] = src_cache[record_id] if field.relational and isinstance(value, tuple): todo[field.comodel_name].update(value)