OdooRpc.CoreCLR.Client.V8.Models
8.0.4
dotnet add package OdooRpc.CoreCLR.Client.V8.Models --version 8.0.4
NuGet\Install-Package OdooRpc.CoreCLR.Client.V8.Models -Version 8.0.4
<PackageReference Include="OdooRpc.CoreCLR.Client.V8.Models" Version="8.0.4" />
paket add OdooRpc.CoreCLR.Client.V8.Models --version 8.0.4
#r "nuget: OdooRpc.CoreCLR.Client.V8.Models, 8.0.4"
// Install OdooRpc.CoreCLR.Client.V8.Models as a Cake Addin #addin nuget:?package=OdooRpc.CoreCLR.Client.V8.Models&version=8.0.4 // Install OdooRpc.CoreCLR.Client.V8.Models as a Cake Tool #tool nuget:?package=OdooRpc.CoreCLR.Client.V8.Models&version=8.0.4
OdooRpc.CoreCLR.Client.V8.Models
All Models for Simple Odoo JSON-RPC Client .NET 8
About The Project
OdooRpc.CoreCLR.Client.V8.Models
- All Models for Simple Odoo JSON-RPC Client .NET 8
- This repository contains all default models and fields for Odoo Version 17 (Released November, 2023)
- Easily extend and utilize these models in your projects
- All Models: https://github.com/akifmt/OdooRpc.CoreCLR.Client.V8.Models/blob/main/Models.md
Installation
Install
- Check provided options from NuGet:
- https://www.nuget.org/packages/OdooRpc.CoreCLR.Client.V8.Models
Usage
We will create a custom model that extends the existing ProductProduct class, allowing us to interact with Odoo's product data more effectively. We will also include the necessary NuGet packages, a detailed explanation of the code, and how to make requests using the custom model.
Steps:
- Adding Required Libraries
- Creating a Child Class
- Making Requests with the Custom Model
1. Adding Required Libraries
You need to add the following packages to your .csproj file:
<ItemGroup>
<PackageReference Include="OdooRpc.CoreCLR.Client.V8" Version="8.0.4" />
<PackageReference Include="OdooRpc.CoreCLR.Client.V8.Models" Version="8.0.4" />
</ItemGroup>
2. Creating a Child Class
The custom class ProductProductCustom extends the ProductProduct class. Here’s a breakdown of its components:
using OdooRpc.CoreCLR.Client.V8.Models;
using OdooRpc.CoreCLR.Client.V8.Models.Items;
using System.Text.Json.Serialization;
namespace ConsoleApp1Test.Specs.Models;
public class ProductProductCustom : ProductProduct
{
[JsonIgnore]
public Many2OneItem create_u => new Many2OneItem(this.create_uid);
[JsonIgnore]
public Many2OneItem write_u => new Many2OneItem(this.write_uid);
[JsonIgnore]
public Many2OneItem categ => new Many2OneItem(this.categ_id);
}
3. Making Requests with the Custom Model
The following code, demonstrates how to make an asynchronous request to fetch products using the custom model:
// Fetch products using the custom model
public async Task<ProductProductCustom[]> FetchProductsAsync()
{
OdooConnectionInfo odooConnectionInfo = new OdooConnectionInfo { Database = "YOUR_DB_NAME", Host = "YOUR_HOST", Port = 443, IsSSL = true, Username = "YOUR_USERNAME", Password = "YOUR_PASSWORD" };
OdooRpcClient client = new OdooRpcClient(odooConnectionInfo);
ProductProductCustom[] products = await client.Get<ProductProductCustom[]>(
new OdooSearchParameters(ModelNames.ProductProduct, new OdooDomainFilter()));
return products;
}
Release Notes
- No extra library dependencies
Contributing
Any contributions you make are greatly appreciated.
- If you have suggestions for adding or removing projects, feel free to open an issue to discuss it.
- Please make sure you check your spelling and grammar.
- Create individual PR for each suggestion.
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Project Link: https://github.com/akifmt/OdooRpc.CoreCLR.Client.V8.Models
Acknowledgments
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
All Models for Simple Odoo JSON-RPC Client .NET 8. This repository contains all default models and fields for Odoo Version 17 (Released November, 2023). Easily extend and utilize these models in your projects. All Models: https://github.com/akifmt/OdooRpc.CoreCLR.Client.V8.Models/blob/main/Models.md