Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions OdooRpc.CoreCLR.Client.sln
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions global.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Simple Odoo JSON-RPC Client for .Net Core 1.0</Description>
<Authors>vmlf01;trafaelsilva</Authors>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>OdooRpc.CoreCLR.Client.Samples</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>OdooRpc.CoreCLR.Client.Samples</PackageId>
<PackageTags>odoo;openerp;dotnet code;json-rpc;dotnet</PackageTags>
<PackageProjectUrl>https://github.com/vmlf01/OdooRpc.CoreCLR.Client</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/vmlf01/OdooRpc.CoreCLR.Client</RepositoryUrl>
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\OdooRpc.CoreCLR.Client\OdooRpc.CoreCLR.Client.csproj" />
</ItemGroup>

</Project>
40 changes: 0 additions & 40 deletions src/OdooRpc.CoreCLR.Client.Samples/project.json

This file was deleted.

2 changes: 2 additions & 0 deletions src/OdooRpc.CoreCLR.Client/Interfaces/IOdooRpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public interface IOdooRpcClient
Task<T> Search<T>(OdooSearchParameters searchParameters, OdooPaginationParameters pagParameters);
Task<long> SearchCount(OdooSearchParameters parameters);

Task<long> ExecWorkFlow<T>(string model, string method, long id);
Task<long> Create<T>(string model, T newRecord);
Task<dynamic> CreateDynamic<T>(string model, string method, T newRecord);

Task Delete(string model, long id);
Task Delete(OdooDeleteParameters parameters);
Expand Down
39 changes: 39 additions & 0 deletions src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCreateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,43 @@ private OdooRpcRequest CreateCreateRequest(OdooSessionInfo sessionInfo, string m
};
}
}

// Needed for e.g.:
// var changeQuantity = OdooRpcClient.OdooCreateWithMethodCommand<dynamic>("stock.change.product.qty", "change_product_qty", 1 );
internal class OdooCreateDynamicCommand : OdooAbstractCommand
{
public OdooCreateDynamicCommand(IJsonRpcClient rpcClient)
: base(rpcClient)
{
}

public Task<dynamic> Execute<T>(OdooSessionInfo sessionInfo, string model, string method, T id)
{
return InvokeRpc<dynamic>(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
};
}

}

}
39 changes: 39 additions & 0 deletions src/OdooRpc.CoreCLR.Client/Internals/Commands/OdooCustomCommand.cs
Original file line number Diff line number Diff line change
@@ -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<long> Execute<T>(OdooSessionInfo sessionInfo, string model, string method, T id)
{
return InvokeRpc<long>(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
};
}
}
}
28 changes: 28 additions & 0 deletions src/OdooRpc.CoreCLR.Client/OdooRpc.CoreCLR.Client.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Simple Odoo JSON-RPC Client for .Net Core 2.0. Fork from https://github.com/vmlf01/OdooRpc.CoreCLR.Client</Description>
<Authors>LORDofDOOM;vmlf01;trafaelsilva</Authors>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>OdooRpc.CoreCLR.Client</AssemblyName>
<PackageId>OdooRpc.CoreCLR.Client.V2</PackageId>
<PackageTags>odoo;openerp;dotnet code;json-rpc;dotnet</PackageTags>
<PackageProjectUrl>https://github.com/GathSystemsOdoo/OdooRpc.CoreCLR.Client</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/GathSystemsOdoo/OdooRpc.CoreCLR.Client/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/GathSystemsOdoo/OdooRpc.CoreCLR.Client</RepositoryUrl>
<Version>2.0.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>LORDofDOOM;vmlf01;trafaelsilva</Company>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.IO" Version="4.3.0" />
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="JsonRpc.CoreCLR.Client" Version="1.0.1" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,25 @@ public Task<long> SearchCount(OdooSearchParameters searchParams)
return searchCommand.ExecuteCount(this.SessionInfo, searchParams);
}

public Task<long> ExecWorkFlow<T>(string model, string method, long id)
{
var createCommand = new OdooExecWorkFlowCommand(CreateRpcClient());
return createCommand.Execute(this.SessionInfo, model, method, id);
}

public Task<long> Create<T>(string model, T newRecord)
{
var createCommand = new OdooCreateCommand(CreateRpcClient());
return createCommand.Execute(this.SessionInfo, model, newRecord);
}

public Task<dynamic> CreateDynamic<T>(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 }));
Expand Down
35 changes: 0 additions & 35 deletions src/OdooRpc.CoreCLR.Client/project.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Simple Odoo JSON-RPC Client for .Net Core 1.0</Description>
<Authors>vmlf01;trafaelsilva</Authors>
<TargetFramework>netcoreapp1.0</TargetFramework>
<AssemblyName>OdooRpc.CoreCLR.Client.Tests</AssemblyName>
<PackageId>OdooRpc.CoreCLR.Client.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<PackageTags>odoo;openerp;dotnet code;json-rpc;dotnet</PackageTags>
<PackageProjectUrl>https://github.com/vmlf01/OdooRpc.CoreCLR.Client</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/vmlf01/OdooRpc.CoreCLR.Client/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/vmlf01/OdooRpc.CoreCLR.Client</RepositoryUrl>
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\OdooRpc.CoreCLR.Client\OdooRpc.CoreCLR.Client.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta5-build1225" />
<PackageReference Include="xunit" Version="2.2.0-beta5-build3474" />
</ItemGroup>

</Project>
40 changes: 0 additions & 40 deletions tests/OdooRpc.CoreCLR.Client.Tests/project.json

This file was deleted.