From 3826a2645b94e0f62c719814c4dbe4cc6502e1f2 Mon Sep 17 00:00:00 2001 From: Krzysztof Magusiak Date: Mon, 22 Mar 2021 10:25:58 +0000 Subject: [FIX] web: can update one2many with custom field widget One might design a custom field widget to display/interact with a one2many field. Before this commit, if this field widget triggered a field_changed event to update a related record, it crashed, because the code assumed that there was a view associated with the field. Closes #68276 opw~2468238 closes odoo/odoo#68294 Signed-off-by: Lucas Perais (lpe) Signed-off-by: Aaron Bohy (aab) Co-authored-by: Aaron Bohy --- addons/web/static/src/js/views/basic/basic_model.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic') 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 78606e717d7..c51f512b966 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2024,7 +2024,9 @@ var BasicModel = AbstractModel.extend({ case 'UPDATE': list._changes.push({operation: 'UPDATE', id: command.id}); if (command.data) { - defs.push(this._applyChange(command.id, command.data, { viewType: view.type })); + defs.push(this._applyChange(command.id, command.data, { + viewType: view && view.type, + })); } break; case 'FORGET': -- cgit v1.2.3