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.
<PackageVersion Include="OdooRpc.CoreCLR.Client.V8.Models" Version="8.0.4" />
                    
Directory.Packages.props
<PackageReference Include="OdooRpc.CoreCLR.Client.V8.Models" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version 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.
#:package OdooRpc.CoreCLR.Client.V8.Models@8.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OdooRpc.CoreCLR.Client.V8.Models&version=8.0.4
                    
Install as a Cake Addin
#tool nuget:?package=OdooRpc.CoreCLR.Client.V8.Models&version=8.0.4
                    
Install as a Cake Tool

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 654 8/16/2024
8.0.3 111 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