skilld-labs / go-odoo

Golang wrapper for Odoo API
Apache License 2.0
86 stars 62 forks source link

Fetching recurring event gives an error due to missmatching event's ID type #21

Closed AnJ-Github closed 4 years ago

AnJ-Github commented 4 years ago

When fetching recurring calendar.event instead of event's ID beeing integer we get ID as a string. Something like this : 'id': '10842-20190730060000'

And because of it we get an error during run time: http: panic serving [::1]:58720: reflect.Set: value of type string is not assignable to type int64

Solution: Change Id type inside go-odoo > types from int64 to interface{} like this:

Id                       interface{} `xmlrpc:"id"`

Didn't check updating or deleting such records yet. But I guess it would not work as this methods still use int64.

ahuret commented 4 years ago

And why not string instead of interface{} ?

AnJ-Github commented 4 years ago

Because the Id sometimes is still just an Int. It would also break existing code: reflect.Set: value of type int64 is not assignable to type string

So the interface{} is the easiest solution - but not perfect and there is still work to be done with create, update etc...

ahuret commented 4 years ago

Hey @Gumaa. All go-odoo api has changed. Please check if issue still exists with new version. thx.

ahuret commented 4 years ago

Closing it. Reopen it if you still get the issue.