2023-01-27 03:22:44 -08:00
|
|
|
import type {
|
2023-03-09 09:13:15 -08:00
|
|
|
IDataObject,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
IExecuteFunctions,
|
|
|
|
IHookFunctions,
|
|
|
|
ILoadOptionsFunctions,
|
2023-03-09 09:13:15 -08:00
|
|
|
JsonObject,
|
2024-02-14 07:29:09 -08:00
|
|
|
IRequestOptions,
|
2023-03-09 09:13:15 -08:00
|
|
|
} from 'n8n-workflow';
|
2023-01-27 03:22:44 -08:00
|
|
|
import { NodeApiError } from 'n8n-workflow';
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
|
|
|
|
const serviceJSONRPC = 'object';
|
|
|
|
const methodJSONRPC = 'execute';
|
|
|
|
|
|
|
|
export const mapOperationToJSONRPC = {
|
|
|
|
create: 'create',
|
|
|
|
get: 'read',
|
|
|
|
getAll: 'search_read',
|
|
|
|
update: 'write',
|
|
|
|
delete: 'unlink',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mapOdooResources: { [key: string]: string } = {
|
|
|
|
contact: 'res.partner',
|
|
|
|
opportunity: 'crm.lead',
|
|
|
|
note: 'note.note',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mapFilterOperationToJSONRPC = {
|
|
|
|
equal: '=',
|
|
|
|
notEqual: '!=',
|
|
|
|
greaterThen: '>',
|
|
|
|
lesserThen: '<',
|
|
|
|
greaterOrEqual: '>=',
|
|
|
|
lesserOrEqual: '<=',
|
|
|
|
like: 'like',
|
|
|
|
in: 'in',
|
|
|
|
notIn: 'not in',
|
|
|
|
childOf: 'child_of',
|
|
|
|
};
|
|
|
|
|
|
|
|
type FilterOperation =
|
|
|
|
| 'equal'
|
|
|
|
| 'notEqual'
|
|
|
|
| 'greaterThen'
|
|
|
|
| 'lesserThen'
|
|
|
|
| 'greaterOrEqual'
|
|
|
|
| 'lesserOrEqual'
|
|
|
|
| 'like'
|
|
|
|
| 'in'
|
|
|
|
| 'notIn'
|
|
|
|
| 'childOf';
|
|
|
|
|
|
|
|
export interface IOdooFilterOperations {
|
|
|
|
filter: Array<{
|
|
|
|
fieldName: string;
|
|
|
|
operator: string;
|
|
|
|
value: string;
|
|
|
|
}>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IOdooNameValueFields {
|
|
|
|
fields: Array<{
|
|
|
|
fieldName: string;
|
|
|
|
fieldValue: string;
|
|
|
|
}>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IOdooResponceFields {
|
|
|
|
fields: Array<{
|
|
|
|
field: string;
|
|
|
|
fromList?: boolean;
|
|
|
|
}>;
|
|
|
|
}
|
|
|
|
|
|
|
|
type OdooCRUD = 'create' | 'update' | 'delete' | 'get' | 'getAll';
|
|
|
|
|
2022-08-17 08:50:24 -07:00
|
|
|
export function odooGetDBName(databaseName: string | undefined, url: string) {
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
if (databaseName) return databaseName;
|
|
|
|
const odooURL = new URL(url);
|
|
|
|
const hostname = odooURL.hostname;
|
|
|
|
if (!hostname) return '';
|
|
|
|
return odooURL.hostname.split('.')[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
function processFilters(value: IOdooFilterOperations) {
|
|
|
|
return value.filter?.map((item) => {
|
|
|
|
const operator = item.operator as FilterOperation;
|
|
|
|
item.operator = mapFilterOperationToJSONRPC[operator];
|
|
|
|
return Object.values(item);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function processNameValueFields(value: IDataObject) {
|
|
|
|
const data = value as unknown as IOdooNameValueFields;
|
|
|
|
return data?.fields?.reduce((acc, record) => {
|
|
|
|
return Object.assign(acc, { [record.fieldName]: record.fieldValue });
|
|
|
|
}, {});
|
|
|
|
}
|
|
|
|
|
|
|
|
// function processResponceFields(value: IDataObject) {
|
|
|
|
// const data = value as unknown as IOdooResponceFields;
|
|
|
|
// return data?.fields?.map((entry) => entry.field);
|
|
|
|
// }
|
|
|
|
|
|
|
|
export async function odooJSONRPCRequest(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
body: IDataObject,
|
|
|
|
url: string,
|
|
|
|
): Promise<IDataObject | IDataObject[]> {
|
|
|
|
try {
|
2024-02-14 07:29:09 -08:00
|
|
|
const options: IRequestOptions = {
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
headers: {
|
|
|
|
'User-Agent': 'n8n',
|
|
|
|
Connection: 'keep-alive',
|
|
|
|
Accept: '*/*',
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
},
|
|
|
|
method: 'POST',
|
|
|
|
body,
|
|
|
|
uri: `${url}/jsonrpc`,
|
|
|
|
json: true,
|
|
|
|
};
|
|
|
|
|
2022-12-23 10:09:52 -08:00
|
|
|
const responce = await this.helpers.request(options);
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
if (responce.error) {
|
2023-02-27 19:39:43 -08:00
|
|
|
throw new NodeApiError(this.getNode(), responce.error.data as JsonObject, {
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
message: responce.error.data.message,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return responce.result;
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function odooGetModelFields(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
db: string,
|
|
|
|
userID: number,
|
|
|
|
password: string,
|
|
|
|
resource: string,
|
|
|
|
url: string,
|
|
|
|
) {
|
|
|
|
try {
|
|
|
|
const body = {
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
method: 'call',
|
|
|
|
params: {
|
|
|
|
service: serviceJSONRPC,
|
|
|
|
method: methodJSONRPC,
|
|
|
|
args: [
|
|
|
|
db,
|
|
|
|
userID,
|
|
|
|
password,
|
|
|
|
mapOdooResources[resource] || resource,
|
|
|
|
'fields_get',
|
|
|
|
[],
|
|
|
|
['string', 'type', 'help', 'required', 'name'],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
id: Math.floor(Math.random() * 100),
|
|
|
|
};
|
|
|
|
|
|
|
|
const result = await odooJSONRPCRequest.call(this, body, url);
|
|
|
|
return result;
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function odooCreate(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
db: string,
|
|
|
|
userID: number,
|
|
|
|
password: string,
|
|
|
|
resource: string,
|
|
|
|
operation: OdooCRUD,
|
|
|
|
url: string,
|
|
|
|
newItem: IDataObject,
|
|
|
|
) {
|
|
|
|
try {
|
|
|
|
const body = {
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
method: 'call',
|
|
|
|
params: {
|
|
|
|
service: serviceJSONRPC,
|
|
|
|
method: methodJSONRPC,
|
|
|
|
args: [
|
|
|
|
db,
|
|
|
|
userID,
|
|
|
|
password,
|
|
|
|
mapOdooResources[resource] || resource,
|
|
|
|
mapOperationToJSONRPC[operation],
|
|
|
|
newItem || {},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
id: Math.floor(Math.random() * 100),
|
|
|
|
};
|
|
|
|
|
|
|
|
const result = await odooJSONRPCRequest.call(this, body, url);
|
|
|
|
return { id: result };
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function odooGet(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
db: string,
|
|
|
|
userID: number,
|
|
|
|
password: string,
|
|
|
|
resource: string,
|
|
|
|
operation: OdooCRUD,
|
|
|
|
url: string,
|
|
|
|
itemsID: string,
|
|
|
|
fieldsToReturn?: IDataObject[],
|
|
|
|
) {
|
|
|
|
try {
|
|
|
|
if (!/^\d+$/.test(itemsID) || !parseInt(itemsID, 10)) {
|
|
|
|
throw new NodeApiError(this.getNode(), {
|
|
|
|
status: 'Error',
|
|
|
|
message: `Please specify a valid ID: ${itemsID}`,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
const body = {
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
method: 'call',
|
|
|
|
params: {
|
|
|
|
service: serviceJSONRPC,
|
|
|
|
method: methodJSONRPC,
|
|
|
|
args: [
|
|
|
|
db,
|
|
|
|
userID,
|
|
|
|
password,
|
|
|
|
mapOdooResources[resource] || resource,
|
|
|
|
mapOperationToJSONRPC[operation],
|
2023-11-09 08:50:59 -08:00
|
|
|
itemsID ? [+itemsID] : [],
|
2023-01-19 04:37:19 -08:00
|
|
|
fieldsToReturn || [],
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
id: Math.floor(Math.random() * 100),
|
|
|
|
};
|
|
|
|
|
|
|
|
const result = await odooJSONRPCRequest.call(this, body, url);
|
|
|
|
return result;
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function odooGetAll(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
db: string,
|
|
|
|
userID: number,
|
|
|
|
password: string,
|
|
|
|
resource: string,
|
|
|
|
operation: OdooCRUD,
|
|
|
|
url: string,
|
|
|
|
filters?: IOdooFilterOperations,
|
|
|
|
fieldsToReturn?: IDataObject[],
|
|
|
|
limit = 0,
|
|
|
|
) {
|
|
|
|
try {
|
|
|
|
const body = {
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
method: 'call',
|
|
|
|
params: {
|
|
|
|
service: serviceJSONRPC,
|
|
|
|
method: methodJSONRPC,
|
|
|
|
args: [
|
|
|
|
db,
|
|
|
|
userID,
|
|
|
|
password,
|
|
|
|
mapOdooResources[resource] || resource,
|
|
|
|
mapOperationToJSONRPC[operation],
|
|
|
|
(filters && processFilters(filters)) || [],
|
2023-01-19 04:37:19 -08:00
|
|
|
fieldsToReturn || [],
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
0, // offset
|
|
|
|
limit,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
id: Math.floor(Math.random() * 100),
|
|
|
|
};
|
|
|
|
|
|
|
|
const result = await odooJSONRPCRequest.call(this, body, url);
|
|
|
|
return result;
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function odooUpdate(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
db: string,
|
|
|
|
userID: number,
|
|
|
|
password: string,
|
|
|
|
resource: string,
|
|
|
|
operation: OdooCRUD,
|
|
|
|
url: string,
|
|
|
|
itemsID: string,
|
|
|
|
fieldsToUpdate: IDataObject,
|
|
|
|
) {
|
|
|
|
try {
|
|
|
|
if (!Object.keys(fieldsToUpdate).length) {
|
|
|
|
throw new NodeApiError(this.getNode(), {
|
|
|
|
status: 'Error',
|
2022-12-29 03:20:43 -08:00
|
|
|
message: 'Please specify at least one field to update',
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
if (!/^\d+$/.test(itemsID) || !parseInt(itemsID, 10)) {
|
|
|
|
throw new NodeApiError(this.getNode(), {
|
|
|
|
status: 'Error',
|
|
|
|
message: `Please specify a valid ID: ${itemsID}`,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
const body = {
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
method: 'call',
|
|
|
|
params: {
|
|
|
|
service: serviceJSONRPC,
|
|
|
|
method: methodJSONRPC,
|
|
|
|
args: [
|
|
|
|
db,
|
|
|
|
userID,
|
|
|
|
password,
|
|
|
|
mapOdooResources[resource] || resource,
|
|
|
|
mapOperationToJSONRPC[operation],
|
2023-11-09 08:50:59 -08:00
|
|
|
itemsID ? [+itemsID] : [],
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
fieldsToUpdate,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
id: Math.floor(Math.random() * 100),
|
|
|
|
};
|
|
|
|
|
|
|
|
await odooJSONRPCRequest.call(this, body, url);
|
|
|
|
return { id: itemsID };
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function odooDelete(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
db: string,
|
|
|
|
userID: number,
|
|
|
|
password: string,
|
|
|
|
resource: string,
|
|
|
|
operation: OdooCRUD,
|
|
|
|
url: string,
|
|
|
|
itemsID: string,
|
|
|
|
) {
|
|
|
|
if (!/^\d+$/.test(itemsID) || !parseInt(itemsID, 10)) {
|
|
|
|
throw new NodeApiError(this.getNode(), {
|
|
|
|
status: 'Error',
|
|
|
|
message: `Please specify a valid ID: ${itemsID}`,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
const body = {
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
method: 'call',
|
|
|
|
params: {
|
|
|
|
service: serviceJSONRPC,
|
|
|
|
method: methodJSONRPC,
|
|
|
|
args: [
|
|
|
|
db,
|
|
|
|
userID,
|
|
|
|
password,
|
|
|
|
mapOdooResources[resource] || resource,
|
|
|
|
mapOperationToJSONRPC[operation],
|
2023-11-09 08:50:59 -08:00
|
|
|
itemsID ? [+itemsID] : [],
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
id: Math.floor(Math.random() * 100),
|
|
|
|
};
|
|
|
|
|
|
|
|
await odooJSONRPCRequest.call(this, body, url);
|
|
|
|
return { success: true };
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function odooGetUserID(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
db: string,
|
|
|
|
username: string,
|
|
|
|
password: string,
|
|
|
|
url: string,
|
|
|
|
): Promise<number> {
|
|
|
|
try {
|
|
|
|
const body = {
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
method: 'call',
|
|
|
|
params: {
|
|
|
|
service: 'common',
|
|
|
|
method: 'login',
|
|
|
|
args: [db, username, password],
|
|
|
|
},
|
|
|
|
id: Math.floor(Math.random() * 100),
|
|
|
|
};
|
|
|
|
const loginResult = await odooJSONRPCRequest.call(this, body, url);
|
|
|
|
return loginResult as unknown as number;
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function odooGetServerVersion(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
:sparkles: Add Odoo Node (#2601)
* added odoo scaffolding
* update getting data from odoo instance
* added scaffolding for main loop and request functions
* added functions for CRUD opperations
* improoved error handling for odooJSONRPCRequest
* updated odoo node and fixing nodelinter issues
* fixed alpabetical order
* fixed types in odoo node
* fixing linter errors
* fixing linter errors
* fixed data shape returned from man loop
* updated node input types, added fields list to models
* update when custom resource is selected options for fields list will be populated dynamicly
* minor fixes
* :hammer: fixed credential test, updating CRUD methods
* :hammer: added additional fields to crm resource
* :hammer: added descriptions, fixed credentials test bug
* :hammer: standardize node and descriptions design
* :hammer: removed comments
* :hammer: added pagination to getAll operation
* :zap: removed leftover function from previous implementation, removed required from optional fields
* :zap: fixed id field, added indication of type and if required to field description, replaced string input in filters to fetched list of fields
* :hammer: fetching list of models from odoo, added selection of fields to be returned to predefined models, fixes accordingly to review
* :zap: Small improvements
* :hammer: extracted adress fields into collection, changed fields to include in descriptions, minor tweaks
* :zap: Improvements
* :hammer: working on review
* :hammer: fixed linter errors
* :hammer: review wip
* :hammer: review wip
* :hammer: review wip
* :zap: updated display name for URL in credentials
* :hammer: added checks for valid id to delete and update
* :zap: Minor improvements
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-03-05 11:33:42 -08:00
|
|
|
url: string,
|
|
|
|
) {
|
|
|
|
try {
|
|
|
|
const body = {
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
method: 'call',
|
|
|
|
params: {
|
|
|
|
service: 'common',
|
|
|
|
method: 'version',
|
|
|
|
args: [],
|
|
|
|
},
|
|
|
|
id: Math.floor(Math.random() * 100),
|
|
|
|
};
|
|
|
|
const result = await odooJSONRPCRequest.call(this, body, url);
|
|
|
|
return result;
|
|
|
|
} catch (error) {
|
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
|
|
}
|
|
|
|
}
|