From fdce99424b292badd172df8efd81109115cc5d5f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 11 Mar 2019 10:04:08 +0000 Subject: [PATCH] [FIX] base_automation: do not read all fields vals may be an empty dict This may happen a write is done on a computed field, the call to _write will be empty (still needed to update write_uid/date). Before this commit, all fields were read in the read call. This was unecessary and may produce acess-rights errors or other side effect (e.g. in odoo/enterprise#3778 the technical field ticket_count was read, even if not present in the view or the write call) Only compute old_values on the fields that are modified Fixes odoo/enterprise#3778 opw-1949911 closes odoo/odoo#31737 Signed-off-by: Raphael Collet (rco) --- addons/base_automation/models/base_automation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_automation/models/base_automation.py b/addons/base_automation/models/base_automation.py index a482d7d5911..196ebe9965f 100644 --- a/addons/base_automation/models/base_automation.py +++ b/addons/base_automation/models/base_automation.py @@ -249,7 +249,7 @@ class BaseAutomation(models.Model): # read old values before the update old_values = { old_vals.pop('id'): old_vals - for old_vals in records.read(list(vals)) + for old_vals in (records.read(list(vals)) if vals else []) } # call original method _write.origin(records, vals, **kw)