summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2018-11-29 15:07:47 +0000
committerGéry Debongnie <ged@odoo.com>2018-11-30 08:56:29 +0000
commit25d63eee7c2be719fecd17b769c1ee1872367f9e (patch)
treea533fb16f822f63245cc96a8004b8ba667d6f323 /addons/web/static/src/js/views/basic
parentfd9b2c9f36bb758cf7b27f2be25ede45fae137f9 (diff)
[FIX] web: prevent crash in some cases (o2m)
Recent works in the orm (see [1] for example) changed the behaviour of the server in the case of onchanges: it tries to optimize Odoo by sending a minimal diff to the web client in onchanges. Concretely, this means that the web client receives commands 4 (link to) instead of command 1 (update + record data). It also sends a minimal diff in that case. This is a big issue for the web client, because it relied on the knowledge of the data from the command 1 to be able to evaluate some modifiers. The good news is that we can mitigate the issue in one case: we do not actually need to evaluate the modifiers in the case of a command 4 (comming from the server), because we can assume that the record is valid. So, we simply bypass the check in that case. Note that this should fix most of the problem, but a deeper problem still remains: a crash can still happen when an onchange modifies a record in a one2many (but in a different page), and we also have a modifier which needs to be evaluated. opw: #1904514 [1] https://github.com/odoo/odoo/pull/29086 closes odoo/odoo#29172
Diffstat (limited to 'addons/web/static/src/js/views/basic')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index 1df7c4f2e1c..cc923642047 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -3404,6 +3404,7 @@ var BasicModel = AbstractModel.extend({
_.each(element._changes, function (command) {
if (command.operation === 'DELETE' ||
command.operation === 'FORGET' ||
+ (command.operation === 'ADD' && !command.isNew)||
command.operation === 'REMOVE_ALL') {
return;
}