[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) <lse@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Sens Loan (lse) <lse@odoo.com>
This commit is contained in:
Loan (LSE)
2023-03-07 02:56:54 +01:00
parent 324ee454da
commit a4a0fb233b
@@ -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] = {