A Dimarts, 5 de juny de 2012 19:59:54, Tristian Paul Lopez Azuara va 
escriure:

> On Monday, May 28, 2012 3:57:22 PM UTC-7, Tristian Paul Lopez Azuara 
wrote:

> > Hello all,

> >

> > I've found my self in the need to pull data that is not stored in

> > tryton's database, the data is accessed from an

> > external REST API, however the information that is obtained from said 
API

> > needs to appear as a tree view, that

> >

> > created a few questions:

> > - Can views be created without necessarily having a ModelSQL ( to show

> > the external data as a tree view )?

> > - In where or how can I perform custom actions other than *on_write

> > *within my form (Maybe wizards?)?

> > - Can I create forms that do not write or store data, only for

> > displaying information, be it local or from

> > external sources?

> >

> > Thank you for your time.

> >

> > Regards, Tristian.

>

> Ok, so I've decided to modify the source code in trytond, basically what

> I've done is create a new file named *modeljsonapi.py* in which I have a

> class that

> inherits from *ModelStorage, *in this new class I override the CRUD

> methods, in the *read *method I call my json API by using the

> requests<http://docs.python-requests.org/en/latest/index.html>module, from

> the HTTP json response I build the dictionaries to be returned, in all of

> the CRUD methods I also call the parents CRUD (based on the

> *ModelSQL*implementation).

>

> Then I created a module, which has an *Order *model, this model inherits

> from my new model type, *ModelJSONAPI* and declares a couple of fields, 
the

> module

> itself is registered correctly, I created a tree view for the Order model

> and expected to see the data (the tree view is rendered correctly) from 
the

> JSON API,

> how ever the model's read method isn't called as I've added logging

> statements to no avail, my assumption is that to determine if the read

> method will be called,

> trytond first searches for a list of (infered from the read method's

> signature) since there are no Order records the database it simply doesn't

> call it, am I correct?,

> Am I lost on my path?

 

> Did you implement the search() function?

Hey, thanks a lot, that really solved the issue.

have a nice day. 

-- 
tryton@googlegroups.com mailing list

Reply via email to