From 7e4031f921b48aefb3aa111fb7b2d785eea8ddf8 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Thu, 31 Aug 2017 04:09:34 +0200 Subject: [PATCH 1/5] [Core] Upgrade to csproj, create sln, upgrade to netstandard2.0 --- OdooRpc.CoreCLR.Client.sln | 31 ++++++++++++++ global.json | 4 -- .../OdooRpc.CoreCLR.Client.Samples.csproj | 22 ++++++++++ .../project.json | 40 ------------------- .../OdooRpc.CoreCLR.Client.csproj | 25 ++++++++++++ src/OdooRpc.CoreCLR.Client/project.json | 35 ---------------- .../OdooRpc.CoreCLR.Client.Tests.csproj | 28 +++++++++++++ .../OdooRpc.CoreCLR.Client.Tests/project.json | 40 ------------------- 8 files changed, 106 insertions(+), 119 deletions(-) create mode 100644 OdooRpc.CoreCLR.Client.sln delete mode 100644 global.json create mode 100644 src/OdooRpc.CoreCLR.Client.Samples/OdooRpc.CoreCLR.Client.Samples.csproj delete mode 100644 src/OdooRpc.CoreCLR.Client.Samples/project.json create mode 100644 src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj delete mode 100644 src/OdooRpc.CoreCLR.Client/project.json create mode 100644 tests/OdooRpc.CoreCLR.Client.Tests/OdooRpc.CoreCLR.Client.Tests.csproj delete mode 100644 tests/OdooRpc.CoreCLR.Client.Tests/project.json diff --git a/OdooRpc.CoreCLR.Client.sln b/OdooRpc.CoreCLR.Client.sln new file mode 100644 index 0000000..8d5a516 --- /dev/null +++ b/OdooRpc.CoreCLR.Client.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.8 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OdooRpc.CoreCLR.Client", "src\OdooRpc.CoreCLR.Client\OdooRpc.CoreCLR.Client.csproj", "{63A7DA18-D63F-4108-9CEB-EC1304461C24}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OdooRpc.CoreCLR.Client.Samples", "src\OdooRpc.CoreCLR.Client.Samples\OdooRpc.CoreCLR.Client.Samples.csproj", "{87BCC575-BD82-4B44-BD71-8D0D5C8EB841}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {63A7DA18-D63F-4108-9CEB-EC1304461C24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63A7DA18-D63F-4108-9CEB-EC1304461C24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63A7DA18-D63F-4108-9CEB-EC1304461C24}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63A7DA18-D63F-4108-9CEB-EC1304461C24}.Release|Any CPU.Build.0 = Release|Any CPU + {87BCC575-BD82-4B44-BD71-8D0D5C8EB841}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87BCC575-BD82-4B44-BD71-8D0D5C8EB841}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87BCC575-BD82-4B44-BD71-8D0D5C8EB841}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87BCC575-BD82-4B44-BD71-8D0D5C8EB841}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D4894610-CB54-4E73-A415-2A712320F921} + EndGlobalSection +EndGlobal diff --git a/global.json b/global.json deleted file mode 100644 index 0ea5ee2..0000000 --- a/global.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "sdk": { "version": "1.0.0-preview2-*" }, - "projects": [ "src", "tests" ] -} diff --git a/src/OdooRpc.CoreCLR.Client.Samples/OdooRpc.CoreCLR.Client.Samples.csproj b/src/OdooRpc.CoreCLR.Client.Samples/OdooRpc.CoreCLR.Client.Samples.csproj new file mode 100644 index 0000000..63cc630 --- /dev/null +++ b/src/OdooRpc.CoreCLR.Client.Samples/OdooRpc.CoreCLR.Client.Samples.csproj @@ -0,0 +1,22 @@ + + + + Simple Odoo JSON-RPC Client for .Net Core 1.0 + vmlf01;trafaelsilva + netcoreapp2.0 + OdooRpc.CoreCLR.Client.Samples + Exe + OdooRpc.CoreCLR.Client.Samples + odoo;openerp;dotnet code;json-rpc;dotnet + https://github.com/vmlf01/OdooRpc.CoreCLR.Client + https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE + git + https://github.com/vmlf01/OdooRpc.CoreCLR.Client + 1.0.4 + + + + + + + diff --git a/src/OdooRpc.CoreCLR.Client.Samples/project.json b/src/OdooRpc.CoreCLR.Client.Samples/project.json deleted file mode 100644 index 8b97184..0000000 --- a/src/OdooRpc.CoreCLR.Client.Samples/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "Simple Odoo JSON-RPC Client for .Net Core 1.0", - "authors": [ - "vmlf01", - "trafaelsilva" - ], - "buildOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "OdooRpc.CoreCLR.Client": "1.0.0" - }, - "commands": {}, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - }, - "packOptions": { - "tags": [ - "odoo", - "openerp", - "dotnet code", - "json-rpc", - "dotnet" - ], - "projectUrl": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client", - "licenseUrl": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE", - "repository": { - "type": "git", - "url": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client" - } - } -} diff --git a/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj b/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj new file mode 100644 index 0000000..b7b0849 --- /dev/null +++ b/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj @@ -0,0 +1,25 @@ + + + + Simple Odoo JSON-RPC Client for .Net Core 1.0 + vmlf01;trafaelsilva + netstandard2.0 + OdooRpc.CoreCLR.Client + OdooRpc.CoreCLR.Client + odoo;openerp;dotnet code;json-rpc;dotnet + https://github.com/vmlf01/OdooRpc.CoreCLR.Client + https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE + git + https://github.com/vmlf01/OdooRpc.CoreCLR.Client + + + + + + + + + + + + diff --git a/src/OdooRpc.CoreCLR.Client/project.json b/src/OdooRpc.CoreCLR.Client/project.json deleted file mode 100644 index 67208a6..0000000 --- a/src/OdooRpc.CoreCLR.Client/project.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "Simple Odoo JSON-RPC Client for .Net Core 1.0", - "authors": [ - "vmlf01", - "trafaelsilva" - ], - "dependencies": { - "System.Runtime": "4.1.0", - "System.IO": "4.1.0", - "System.Net.Requests": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "Newtonsoft.Json": "9.0.1", - "JsonRpc.CoreCLR.Client": "1.0.1" - }, - "commands": {}, - "frameworks": { - "netstandard1.1":{} - }, - "packOptions": { - "tags": [ - "odoo", - "openerp", - "dotnet code", - "json-rpc", - "dotnet" - ], - "projectUrl": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client", - "licenseUrl": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE", - "repository": { - "type": "git", - "url": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client" - } - } -} \ No newline at end of file diff --git a/tests/OdooRpc.CoreCLR.Client.Tests/OdooRpc.CoreCLR.Client.Tests.csproj b/tests/OdooRpc.CoreCLR.Client.Tests/OdooRpc.CoreCLR.Client.Tests.csproj new file mode 100644 index 0000000..e27100c --- /dev/null +++ b/tests/OdooRpc.CoreCLR.Client.Tests/OdooRpc.CoreCLR.Client.Tests.csproj @@ -0,0 +1,28 @@ + + + + Simple Odoo JSON-RPC Client for .Net Core 1.0 + vmlf01;trafaelsilva + netcoreapp1.0 + OdooRpc.CoreCLR.Client.Tests + OdooRpc.CoreCLR.Client.Tests + true + odoo;openerp;dotnet code;json-rpc;dotnet + https://github.com/vmlf01/OdooRpc.CoreCLR.Client + https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE + git + https://github.com/vmlf01/OdooRpc.CoreCLR.Client + 1.0.4 + + + + + + + + + + + + + diff --git a/tests/OdooRpc.CoreCLR.Client.Tests/project.json b/tests/OdooRpc.CoreCLR.Client.Tests/project.json deleted file mode 100644 index f3594a7..0000000 --- a/tests/OdooRpc.CoreCLR.Client.Tests/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "Simple Odoo JSON-RPC Client for .Net Core 1.0", - "authors": [ - "vmlf01", - "trafaelsilva" - ], - "testRunner": "xunit", - "dependencies": { - "xunit": "2.2.0-*", - "dotnet-test-xunit": "2.2.0-*", - "OdooRpc.CoreCLR.Client": "1.0.0-*" - }, - "commands": {}, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - }, - "packOptions": { - "tags": [ - "odoo", - "openerp", - "dotnet code", - "json-rpc", - "dotnet" - ], - "projectUrl": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client", - "licenseUrl": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE", - "repository": { - "type": "git", - "url": "https://github.com/vmlf01/OdooRpc.CoreCLR.Client" - } - } -} \ No newline at end of file From edac1dcdcbe7b436382b379ae8c461823cb9d620 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Thu, 31 Aug 2017 05:21:18 +0200 Subject: [PATCH 2/5] [Core] Add option to execute exec_workflow -> This can used to e.g. confirm a sale_order: OdooRpcClient.ExecWorkFlow("sale.order", "order_confirm", id.Result); --- .../Interfaces/IOdooRpcClient.cs | 1 + .../Internals/Commands/OdooCustomCommand.cs | 39 +++++++++++++++++++ src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs | 6 +++ 3 files changed, 46 insertions(+) create mode 100644 src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCustomCommand.cs diff --git a/src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs b/src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs index c7f5316..e65dbd2 100644 --- a/src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs +++ b/src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs @@ -33,6 +33,7 @@ public interface IOdooRpcClient Task Search(OdooSearchParameters searchParameters, OdooPaginationParameters pagParameters); Task SearchCount(OdooSearchParameters parameters); + Task ExecWorkFlow(string model, string method, long id); Task Create(string model, T newRecord); Task Delete(string model, long id); diff --git a/src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCustomCommand.cs b/src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCustomCommand.cs new file mode 100644 index 0000000..c7df781 --- /dev/null +++ b/src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCustomCommand.cs @@ -0,0 +1,39 @@ +using System.Threading.Tasks; +using OdooRpc.CoreCLR.Client.Internals.Interfaces; +using OdooRpc.CoreCLR.Client.Models; +using JsonRpc.CoreCLR.Client.Interfaces; + +namespace OdooRpc.CoreCLR.Client.Internals.Commands +{ + internal class OdooExecWorkFlowCommand : OdooAbstractCommand + { + public OdooExecWorkFlowCommand(IJsonRpcClient rpcClient) + : base(rpcClient) + { + } + + public Task Execute(OdooSessionInfo sessionInfo, string model, string method, T id) + { + return InvokeRpc(sessionInfo, CreateExecWorkFlowRequest(sessionInfo, model, method, id)); + } + + private OdooRpcRequest CreateExecWorkFlowRequest(OdooSessionInfo sessionInfo, string model, string method, object id) + { + return new OdooRpcRequest() + { + service = "object", + method = "exec_workflow", + args = new object[] + { + sessionInfo.Database, + sessionInfo.UserId, + sessionInfo.Password, + model, + method, + id + }, + context = sessionInfo.UserContext + }; + } + } +} \ No newline at end of file diff --git a/src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs b/src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs index e0d3baa..c468be4 100644 --- a/src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs +++ b/src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs @@ -132,6 +132,12 @@ public Task SearchCount(OdooSearchParameters searchParams) return searchCommand.ExecuteCount(this.SessionInfo, searchParams); } + public Task ExecWorkFlow(string model, string method, long id) + { + var createCommand = new OdooExecWorkFlowCommand(CreateRpcClient()); + return createCommand.Execute(this.SessionInfo, model, method, id); + } + public Task Create(string model, T newRecord) { var createCommand = new OdooCreateCommand(CreateRpcClient()); From e88f6d07b8b49917f417aa6f88775ccee55dfd67 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Wed, 13 Sep 2017 01:03:16 +0200 Subject: [PATCH 3/5] [Core] Upgrade Packages --- .../OdooRpc.CoreCLR.Client.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj b/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj index b7b0849..aec45c7 100644 --- a/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj +++ b/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj @@ -14,11 +14,11 @@ - - - - - + + + + + From d12cbf0521322c8214e68112fb48db1285e06035 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Tue, 19 Sep 2017 21:37:02 +0200 Subject: [PATCH 4/5] [Core] Add CreateDynamic -> Needed for e.g. update quantities (OdooRpcClient.OdooCreateWithMethodCommand("stock.change.product.qty", "change_product_qty", 1 );) --- .../Interfaces/IOdooRpcClient.cs | 1 + .../Internals/Commands/OdooCreateCommand.cs | 39 +++++++++++++++++++ src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs | 7 ++++ 3 files changed, 47 insertions(+) diff --git a/src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs b/src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs index e65dbd2..5b78dd0 100644 --- a/src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs +++ b/src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs @@ -35,6 +35,7 @@ public interface IOdooRpcClient Task ExecWorkFlow(string model, string method, long id); Task Create(string model, T newRecord); + Task CreateDynamic(string model, string method, T newRecord); Task Delete(string model, long id); Task Delete(OdooDeleteParameters parameters); diff --git a/src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCreateCommand.cs b/src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCreateCommand.cs index e3fae1c..f0b1d1e 100644 --- a/src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCreateCommand.cs +++ b/src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCreateCommand.cs @@ -39,4 +39,43 @@ private OdooRpcRequest CreateCreateRequest(OdooSessionInfo sessionInfo, string m }; } } + + // Needed for e.g.: + // var changeQuantity = OdooRpcClient.OdooCreateWithMethodCommand("stock.change.product.qty", "change_product_qty", 1 ); + internal class OdooCreateDynamicCommand : OdooAbstractCommand + { + public OdooCreateDynamicCommand(IJsonRpcClient rpcClient) + : base(rpcClient) + { + } + + public Task Execute(OdooSessionInfo sessionInfo, string model, string method, T id) + { + return InvokeRpc(sessionInfo, CreateCreateDynamicRequest(sessionInfo, model, method, id)); + } + + private OdooRpcRequest CreateCreateDynamicRequest(OdooSessionInfo sessionInfo, string model, string method, object id) + { + return new OdooRpcRequest() + { + service = "object", + method = "execute_kw", + args = new object[] + { + sessionInfo.Database, + sessionInfo.UserId, + sessionInfo.Password, + model, + method, + new object[] + { + id + } + }, + context = sessionInfo.UserContext + }; + } + + } + } \ No newline at end of file diff --git a/src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs b/src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs index c468be4..65e25da 100644 --- a/src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs +++ b/src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs @@ -144,6 +144,13 @@ public Task Create(string model, T newRecord) return createCommand.Execute(this.SessionInfo, model, newRecord); } + public Task CreateDynamic(string model, string method, T id) + { + var createCommand = new OdooCreateDynamicCommand(CreateRpcClient()); + return createCommand.Execute(this.SessionInfo, model, method, id); + } + + public Task Delete(string model, long id) { return Delete(new OdooDeleteParameters(model, new long[] { id })); From 595aee11d37c23089f969e34ff7c1415dd545085 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Tue, 19 Sep 2017 23:59:37 +0200 Subject: [PATCH 5/5] [nuget] Update nuget specs --- .../OdooRpc.CoreCLR.Client.csproj | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj b/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj index aec45c7..ceb127f 100644 --- a/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj +++ b/src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj @@ -1,16 +1,19 @@ - Simple Odoo JSON-RPC Client for .Net Core 1.0 - vmlf01;trafaelsilva + Simple Odoo JSON-RPC Client for .Net Core 2.0. Fork from https://github.com/vmlf01/OdooRpc.CoreCLR.Client + LORDofDOOM;vmlf01;trafaelsilva netstandard2.0 OdooRpc.CoreCLR.Client - OdooRpc.CoreCLR.Client + OdooRpc.CoreCLR.Client.V2 odoo;openerp;dotnet code;json-rpc;dotnet - https://github.com/vmlf01/OdooRpc.CoreCLR.Client - https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE + https://github.com/GathSystemsOdoo/OdooRpc.CoreCLR.Client + https://github.com/GathSystemsOdoo/OdooRpc.CoreCLR.Client/blob/master/LICENSE git - https://github.com/vmlf01/OdooRpc.CoreCLR.Client + https://github.com/GathSystemsOdoo/OdooRpc.CoreCLR.Client + 2.0.0 + true + LORDofDOOM;vmlf01;trafaelsilva