From be560c282830d72e3e75ea41bb7047560bd4b6f8 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Thu, 6 Jun 2019 08:19:16 +0000 Subject: [PATCH] [FIX] models: new() cannot not trigger any recomputation Set the flag `validate=False` to prevent `convert_to_cache` on x2many fields from triggering recomputations with command 1 (update). --- odoo/fields.py | 5 ++++- odoo/models.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/odoo/fields.py b/odoo/fields.py index 033aa713ae6..e61b7e2297a 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -2329,7 +2329,10 @@ class _RelationalMulti(_Relational): ids.add(comodel.new(command[2], ref=command[1]).id) elif command[0] == 1: line = browse(command[1]) - line.update(command[2]) + if validate: + line.update(command[2]) + else: + line._update_cache(command[2], validate=False) ids.add(line.id) elif command[0] in (2, 3): ids.discard(browse(command[1]).id) diff --git a/odoo/models.py b/odoo/models.py index aea99451a78..dd6d577d260 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -5018,7 +5018,7 @@ Fields: if origin is not None: origin = origin.id record = self.browse([NewId(origin, ref)]) - record._update_cache(values) + record._update_cache(values, validate=False) return record @property @@ -5596,7 +5596,7 @@ Fields: # store changed values in cache, and update snapshot0 for name, value in changed_x2many.items(): - record._update_cache({name: value}) + record._update_cache({name: value}, validate=False) snapshot0.fetch(name) # determine which field(s) should be triggered an onchange