From acfb356b187347e0767742fb206a72995689493c Mon Sep 17 00:00:00 2001 From: jorensjongers Date: Thu, 15 Sep 2022 17:30:41 +0200 Subject: [PATCH 1/3] Run npm install --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1e36182..840cc08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "async-odoo-xmlrpc", - "version": "1.0.1", + "version": "2.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "async-odoo-xmlrpc", - "version": "1.0.1", + "version": "2.0.0", "license": "Apache-2.0", "dependencies": { "lodash": "^4.17.20", From 65d58879fbafd8003e9f715061ce5a7478fa1ed1 Mon Sep 17 00:00:00 2001 From: jorensjongers Date: Thu, 15 Sep 2022 17:31:12 +0200 Subject: [PATCH 2/3] Support for context parameter in execute_kw --- lib/index.d.ts | 3 ++- lib/index.js | 8 ++++++-- src/index.js | 9 +++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 5adba7f..3a03840 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -17,8 +17,9 @@ declare class Odoo { * @param {String} model Model name in Odoo. * @param {String} method Name of method in Odoo. * @param {Array} params Params in to execute from Odoo. + * @param {Object} [context] Context parameterto execute from Odoo. */ - execute_kw: (model: string, method: string, params: Array) => Promise; + execute_kw: (model: string, method: string, params: Array, context?: Object | undefined) => Promise; /** * call workflow in odoo. * diff --git a/lib/index.js b/lib/index.js index 99e25c3..35335fd 100644 --- a/lib/index.js +++ b/lib/index.js @@ -100,8 +100,9 @@ var Odoo = /** @class */ (function () { * @param {String} model Model name in Odoo. * @param {String} method Name of method in Odoo. * @param {Array} params Params in to execute from Odoo. + * @param {Object} [context] Context parameterto execute from Odoo. */ - this.execute_kw = function (model, method, params) { return __awaiter(_this, void 0, void 0, function () { + this.execute_kw = function (model, method, params, context) { return __awaiter(_this, void 0, void 0, function () { var clientOptions, client, fparams; return __generator(this, function (_a) { clientOptions = { @@ -118,8 +119,11 @@ var Odoo = /** @class */ (function () { this.password, model, method, - params + params, ]; + if (context !== undefined) { + fparams.push(context); + } return [2 /*return*/, new Promise(function (resolve, reject) { client.methodCall('execute_kw', fparams, function (error, value) { error ? reject(error) : resolve(value); diff --git a/src/index.js b/src/index.js index cd98966..81bafb0 100644 --- a/src/index.js +++ b/src/index.js @@ -67,8 +67,9 @@ class Odoo { * @param {String} model Model name in Odoo. * @param {String} method Name of method in Odoo. * @param {Array} params Params in to execute from Odoo. + * @param {Object} [context] Context parameterto execute from Odoo. */ - this.execute_kw = async (model, method, params) => { + this.execute_kw = async (model, method, params, context) => { var clientOptions = { host: this.host, port: this.port, @@ -85,9 +86,13 @@ class Odoo { this.password, model, method, - params + params, ]; + if (context !== undefined) { + fparams.push(context) + } + return new Promise((resolve, reject) => { client.methodCall('execute_kw', fparams, (error, value) => { error ? reject(error) : resolve(value); From b91f61ea8d3ee58070c72c3c5e64908fc880338d Mon Sep 17 00:00:00 2001 From: jorensjongers Date: Thu, 15 Sep 2022 17:31:28 +0200 Subject: [PATCH 3/3] Version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 840cc08..f77e01f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "async-odoo-xmlrpc", - "version": "2.0.0", + "version": "2.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "async-odoo-xmlrpc", - "version": "2.0.0", + "version": "2.1.0", "license": "Apache-2.0", "dependencies": { "lodash": "^4.17.20", diff --git a/package.json b/package.json index 65315c7..be0b376 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "async-odoo-xmlrpc", - "version": "2.0.0", + "version": "2.1.0", "description": "Nodejs client to call Odoo RPC's through xmlrpc library.", "author": { "name": "NguyenVanTien2009",