From 596358e25beecc47c6f947784e37977b6ebe9fb2 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 28 Mar 2023 07:40:39 +0000 Subject: [PATCH] [FIX] core: onchange() snapshot should only contain expected fields This fixes an issue with an override of onchange() on account.asset, which asks for less fields to be considered in the snapshot. This also guarantees that onchange() does not return values for unexpected fields. Part-of: odoo/odoo#116779 --- odoo/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odoo/models.py b/odoo/models.py index 81261cc2e63..504b5ec500c 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -6484,7 +6484,8 @@ class BaseModel(metaclass=MetaModel): # update snapshot0 with changed values for name in names: - snapshot0.fetch(name) + if name in nametree: + snapshot0.fetch(name) # Determine which field(s) should be triggered an onchange. On the first # call, 'names' only contains fields with a default. If 'self' is a new