fix(Odoo Node): Prevent possible issues with some custom fields (#3496)

This commit is contained in:
Michael Kret 2022-07-04 11:48:38 +03:00 committed by GitHub
parent 224e008fb6
commit 7d968ec202
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,11 +118,16 @@ export class Odoo implements INodeType {
const userID = await odooGetUserID.call(this, db, username, password, url); const userID = await odooGetUserID.call(this, db, username, password, url);
const responce = await odooGetModelFields.call(this, db, userID, password, resource, url); const responce = await odooGetModelFields.call(this, db, userID, password, resource, url);
const options = Object.values(responce).map((field) => { const options = Object.values(responce).map((field) => {
const optionField = field as { [key: string]: string }; const optionField = field as { [key: string]: string };
let name = '';
try {
name = capitalCase(optionField.name);
} catch (error) {
name = optionField.name;
}
return { return {
name: capitalCase(optionField.name), name,
value: optionField.name, value: optionField.name,
// nodelinter-ignore-next-line // nodelinter-ignore-next-line
description: `name: ${optionField?.name}, type: ${optionField?.type} required: ${optionField?.required}`, description: `name: ${optionField?.name}, type: ${optionField?.type} required: ${optionField?.required}`,