On 28/09/10 19:13 -0700, Mohammad wrote:
> Hi everyone,
> Hope everything goes well using Tryton.
>
> Here we have a scenario which needs to have a dynamic sort of values,
>
> Like the other feathers, at first we went into the code to investigate
> how it works :)
>
> 1. Within the __init__(self) method we had something like this:
>
> self._order.insert(0, ('name', 'ASC'))
>
> Ok, We have a vaiable _order which is something like this:
>
> [('field name','ASC'),('field name','DESC')]
>
> a list that defines the list of orders for the records in the model.
>
> Also we had a sequence value in our Tree view,
>
> But my question is that when we add a new field to the tree view
> nothing will be changed( I mean sorting) until we save the current
> record (and then click on the refresh button).
>
> So it seems to me that having this kind of dynamic sort is not
> possible, What's your view on that?No because sort is done on server side so it requires that records are saved. When the client need to add a new record to a list (group), there is two options, the default it adds it at the end or on editable tree with editable equals 'top', it is added on top. This is done in new_model_position of screen.py perhaps it should be possible to improve this to try to insert it on the right place. > And then, I would like to know weather we can simulate refresh button > using any methods or not. > > I wish i was able to simulate some actions like creating a new method > or refreshing current page, (Not only for this issue but for some > other issues) > I used a print to find out when exactly the create event happens and > print command returns a value when: > > 1. we create a new record > 2 Put data > 3. click on the save button (Now the Create method of the ORM will be > called by the client ! ) > > i think we can simulate create event using for example default method > for a field within the model. > Now what we can do within this method to force client to refresh the > page? This is a bad idea because it breaks the pattern define in Tryton where it saves only once the record. -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgpF9YJPUFLvR.pgp
Description: PGP signature
