Open digitalsatori opened 1 year ago
Hi,
Well, it should work as shown in the example. You define list of fields that should be fetched for specific model and base class should do the job.
However linter says that overriding fields should be avoided so oFields
and others will be replaces with getters that should be overridden.
Thanks for your reply. I tried both the examples for res.user
in example folder and the res.partner
example in ReadMe. The res.user
example comes with an overrided searchRead
, it is running OK, while for the res.partner
example, when I run the app, it prompts a Type error to show that the name field has a value of null
, which can not be converted to a valid record value.
I traced down the code a bit. It seems that the oFields
getter on the PartnerRecord
is not used when fetching data from Odoo, instead, the original oFields
on OdooRecord
class with the value of ['id', '__last_update']
is used, thus the null value for partner name.
I've tried the following to circumvent the problem. Pass the fields list through constructor param of OdooRepository
class (adding a param on the said class) or overriding a getter for oFields
on OdooRepository
class , and use oFields
instead of OdooRecord.oFields
in the searchRead
method on the OdooRepository
class.
Both ways worked without overriding searchRead
method in extended classes, but I'm not sure whether there is a better way.
Thank you @lem8r for your awesome project. I'm learning flutter now.
It seems the original
search_read
method can only readid
and__last_update
fields. When I assign more fields in theoFields
property of my implementation of model specificOdooRecord
, it won't pick up by the originalsearch_read
. thus, I have to override the existingsearch_read
and put in the neededoFields
from the given type.Is this a known limitation? or do I misunderstood anything?
Sorry for opening an issue for just a question.