From a4a0fb233b6f6ad696bca43deb3fbf1e9f6f1f30 Mon Sep 17 00:00:00 2001 From: "Loan (LSE)" Date: Mon, 6 Mar 2023 14:31:17 +0000 Subject: [PATCH] [FIX] web: JS traceback when trying to load unexisting field Correction of PR: https://github.com/odoo/odoo/pull/106101 According to experimental test and documentation: https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute > If the given attribute does not exist, the value returned will either be `null` or `""` > All modern web browsers return `null` when the specified attribute does not exist on the specified element. OPW-3071843 closes odoo/odoo#114494 X-original-commit: a91717ab65e3bee5f4c8d4bb85c18458fd3263c8 Signed-off-by: Loan (LSE) Signed-off-by: Aaron Bohy (aab) Signed-off-by: Sens Loan (lse) --- addons/web/static/src/legacy/legacy_load_views.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/legacy/legacy_load_views.js b/addons/web/static/src/legacy/legacy_load_views.js index f3654dd6304..0452e28f465 100644 --- a/addons/web/static/src/legacy/legacy_load_views.js +++ b/addons/web/static/src/legacy/legacy_load_views.js @@ -65,7 +65,7 @@ export function processArch(arch, viewType, resModel, models) { if (viewFields[fieldName] === undefined) { const viewFieldsInfo = models[resModel][fieldName]; const nodeString = node.getAttribute("string"); - if (nodeString === undefined && viewFieldsInfo === undefined) { + if (nodeString === null && viewFieldsInfo === undefined) { throw new Error(`Missing field string information for the field '${fieldName}' from the '${resModel}' model`); } viewFields[fieldName] = {