From 79f7c233ec0bf5398695d8f4cc6b6d2913d79a56 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Mon, 24 Jan 2022 12:00:54 +0000 Subject: [PATCH] [FIX] web: do not send unmodified data to the server on record save Following recent conversion of onchanges to computes in the sale scope, it was observed that updating one line triggered price recomputation in other lines (which isn't expected). After investigation, it seems that the `product_packaging_id` field is considered modified and sent on SO save for all the lines, which triggers the `product_uom_qty` record computation, then the whole price computation is triggered, since it depends on that quantity field. This commit aims to fix this case by only considering a m2o field as modified if its value was effectively changed. closes odoo/odoo#83252 Signed-off-by: Victor Feyens (vfe) --- addons/web/static/src/legacy/js/views/basic/basic_model.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/legacy/js/views/basic/basic_model.js b/addons/web/static/src/legacy/js/views/basic/basic_model.js index 91e89c9f30f..c36a74147ab 100644 --- a/addons/web/static/src/legacy/js/views/basic/basic_model.js +++ b/addons/web/static/src/legacy/js/views/basic/basic_model.js @@ -1787,7 +1787,9 @@ var BasicModel = AbstractModel.extend({ id = rec.id; record._changes[name] = id; } - } else { + } else if (oldValue !== false) { + // if no value is provided for a m2o, + // we should only consider the field updated if it had a value before record._changes[name] = false; } } else if (field.type === 'reference') {