mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(Odoo Node): Model and fields dynamic fetching errors (#13511)
This commit is contained in:
parent
f5743176e5
commit
294f019414
|
@ -116,19 +116,18 @@ export class Odoo implements INodeType {
|
|||
const userID = await odooGetUserID.call(this, db, username, password, url);
|
||||
|
||||
const response = await odooGetModelFields.call(this, db, userID, password, resource, url);
|
||||
const options = Object.values(response).map((field) => {
|
||||
const options = Object.entries(response).map(([key, field]) => {
|
||||
const optionField = field as { [key: string]: string };
|
||||
let name = '';
|
||||
try {
|
||||
name = capitalCase(optionField.name);
|
||||
optionField.name = capitalCase(optionField.name);
|
||||
} catch (error) {
|
||||
name = optionField.name;
|
||||
optionField.name = optionField.string;
|
||||
}
|
||||
return {
|
||||
name,
|
||||
value: optionField.name,
|
||||
name: optionField.name,
|
||||
value: key,
|
||||
// nodelinter-ignore-next-line
|
||||
description: `name: ${optionField?.name}, type: ${optionField?.type} required: ${optionField?.required}`,
|
||||
description: `name: ${key}, type: ${optionField?.type} required: ${optionField?.required}`,
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -148,15 +147,7 @@ export class Odoo implements INodeType {
|
|||
params: {
|
||||
service: 'object',
|
||||
method: 'execute',
|
||||
args: [
|
||||
db,
|
||||
userID,
|
||||
password,
|
||||
'ir.model',
|
||||
'search_read',
|
||||
[],
|
||||
['name', 'model', 'modules'],
|
||||
],
|
||||
args: [db, userID, password, 'ir.model', 'search_read', [], ['name', 'model']],
|
||||
},
|
||||
id: randomInt(100),
|
||||
};
|
||||
|
@ -167,7 +158,7 @@ export class Odoo implements INodeType {
|
|||
return {
|
||||
name: model.name,
|
||||
value: model.model,
|
||||
description: `model: ${model.model}<br> modules: ${model.modules}`,
|
||||
description: `model: ${model.model}`,
|
||||
};
|
||||
});
|
||||
return options as INodePropertyOptions[];
|
||||
|
|
Loading…
Reference in a new issue