This pull request fixes a panic error that occurs when attempting to get an entity with a field of type "binary" in a model. The "binary" field is typically used to store binary data, such as images or files, directly in the database.
But in some rare cases, this type of field can be used in another way. I faced the issue when tried to access a model that contains compute, non-stored binary field (amount_by_group in sale.order model in Odoo 13, or tax_totals in account.move model in Odoo 17).
The error occurs because the conversion logic expects a string, but in this case, it's receiving an []interface{} instead. This fix only ensures that string conversion errors will not cause panic. It might be worth introducing a new Binary field type to the go-odoo where we can handle the correct conversion for such compute fields.
Error: interface conversion: interface {} is []interface {}, not string
Hello,
This pull request fixes a panic error that occurs when attempting to get an entity with a field of type "binary" in a model. The "binary" field is typically used to store binary data, such as images or files, directly in the database.
But in some rare cases, this type of field can be used in another way. I faced the issue when tried to access a model that contains compute, non-stored binary field (
amount_by_group
insale.order
model in Odoo 13, ortax_totals
inaccount.move model
in Odoo 17).The error occurs because the conversion logic expects a
string
, but in this case, it's receiving an[]interface{}
instead. This fix only ensures that string conversion errors will not cause panic. It might be worth introducing a newBinary
field type to thego-odoo
where we can handle the correct conversion for such compute fields.Error:
interface conversion: interface {} is []interface {}, not string