Intechnity-com / OdooJsonRpcClient

Odoo Client Json Rpc
MIT License
67 stars 29 forks source link

Duplicated Enum values in the OdooModelMapper.GetDotNetModel #50

Open manitra opened 1 year ago

manitra commented 1 year ago

I generated the .NET model for the res.users model on my Odoo 11 instance and there were few duplicated enum values :

res.users

[JsonConverter(typeof(StringEnumConverter))]
public enum TimezoneResUsersOdooEnum
{

[EnumMember(Value = "GMT-0")]
GMT0 = 445,

[EnumMember(Value = "GMT0")]
GMT0 = 446,                      // error CS0102: The type 'TimezoneResPartnerOdooEnum' already contains a definition for 'GMT0'

}

res.partner

[OdooTableName("res.partner")]
[JsonConverter(typeof(OdooModelConverter))]
public class ResPartnerOdooModel : IOdooModel
{

/// <summary>
/// Stat - char  <br />
/// Required: False, Readonly: False, Store: True, Sortable: True <br />
/// </summary>
[JsonProperty("Stat")]
public string Stat { get; set; }

/// <summary>
/// stat - char  <br />
/// Required: False, Readonly: False, Store: True, Sortable: True <br />
/// </summary>
[JsonProperty("stat")]
public string Stat { get; set; }

Odoo version: v11 .NET version : .NET Core 6 Platform : Mac M1

patricoos commented 1 year ago

Hi, quick fix - rename one of enum value (e.g. GMT0 => GMT00) but don't change value in attribute

manitra commented 1 year ago

Hi,

Thank you. Yes, done that ans d even deleted the enum value which were not used in my case :)

I’ll submit a merge request this evening.

Le sam. 11 mars 2023 à 12:15, Patrick @.***> a écrit :

Hi, quick fix - rename one of enum value (e.g. GMT0 => GMT00) but don't change value in attribute

— Reply to this email directly, view it on GitHub https://github.com/patricoos/PortaCapena.OdooJsonRpcClient/issues/50#issuecomment-1464868175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMT6TEL4XTIGTEUWRFKQUDW3Q7BNANCNFSM6AAAAAAVVQD7QY . You are receiving this because you authored the thread.Message ID: @.***>