[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
This commit is contained in:
David Arnold
2018-03-12 10:14:01 +01:00
committed by Raphael Collet
parent 3360c550cc
commit 231cae2e7f
+4
View File
@@ -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)