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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OdooRpc.CoreCLR.Client.V8.Models" Version="8.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OdooRpc.CoreCLR.Client.V8.Models --version 8.0.4                
#r "nuget: OdooRpc.CoreCLR.Client.V8.Models, 8.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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

Report Bug || Request Feature

version Downloads Contributors Issues License: MIT

About The Project

OdooRpc.CoreCLR.Client.V8.Models

Installation

Install

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:

  1. Adding Required Libraries
  2. Creating a Child Class
  3. 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

  • Dotnet
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
8.0.4 292 8/16/2024
8.0.3 82 8/3/2024

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