Closed JRB202 closed 1 year ago
Read the readme carefully. You need to fetch the model.
Thanks Patrick,
For answer.
Creating constant class is a problem in an Odoo configuration in which each model can be enriched at any time. It means we have to update our code after each Odoo model enrichment which is clearly unpredictable and never announced ...
Then, I suggest you to investigate in following direction :
As we are already able to fetch the Oddo model structure
Please build some code to dynamically create Odoo models class accepting the table name as parameter (Template.Product or account.invoice ...) fetching the odoo model and using the result to dynamically build the class needed to use the rest of you API
Visual studio is offering dynamic construction of class : https://learn.microsoft.com/en-us/dotnet/csharp/advanced-topics/interop/walkthrough-creating-and-using-dynamic-objects
Best regards
Jean-Regis
On Wed, Apr 26, 2023 at 4:41 PM Patrick @.***> wrote:
Read the readme carefully. You need to fetch the model.
— Reply to this email directly, view it on GitHub https://github.com/Intechnity-com/OdooJsonRpcClient/issues/71#issuecomment-1523540399, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT5UEH46S77P2746UIYA33XDEXYXANCNFSM6AAAAAAXMRD7MQ . You are receiving this because you authored the thread.Message ID: @.***>
Patrick,
Read this very good article about dynamicall building of class based on source dictionary : https://www.dotnetcurry.com/csharp/dynamic-class-creation-roslyn
On Wed, Apr 26, 2023 at 8:40 PM Jean-Regis BOULET @.***> wrote:
Thanks Patrick,
For answer.
Creating constant class is a problem in an Odoo configuration in which each model can be enriched at any time. It means we have to update our code after each Odoo model enrichment which is clearly unpredictable and never announced ...
Then, I suggest you to investigate in following direction :
As we are already able to fetch the Oddo model structure
Please build some code to dynamically create Odoo models class accepting the table name as parameter (Template.Product or account.invoice ...) fetching the odoo model and using the result to dynamically build the class needed to use the rest of you API
Visual studio is offering dynamic construction of class :
Best regards
Jean-Regis
On Wed, Apr 26, 2023 at 4:41 PM Patrick @.***> wrote:
Read the readme carefully. You need to fetch the model.
— Reply to this email directly, view it on GitHub https://github.com/Intechnity-com/OdooJsonRpcClient/issues/71#issuecomment-1523540399, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT5UEH46S77P2746UIYA33XDEXYXANCNFSM6AAAAAAXMRD7MQ . You are receiving this because you authored the thread.Message ID: @.***>
You can use dictionary with this library, read documentation and take a look on repository
This C# line of your OdooJsonRpcClient example :
var repository = new OdooRepository(config);
is transformed into this one in VB Dim repository = New OdooRepository(Of ProductProductOdooModel)(config)
But ProductProductOdooModel is not recognized by compiler
and in your examples ProductProductOdooModel is never declared
How can I make ProductProductOdooModel reference recognised ?