On Oct 19, 3:22 am, Cédric Krier <[email protected]> wrote: > On 18/10/10 00:40 -0700, Mohammad wrote: > > > Hi everyone, > > New question on how to implement search in Treeview for not a field, > > and not for a relational field. But for a field within 3rd lever > > relation. > > imagine we would like to define a pricelist, within a pricelist we > > have many contracts, within contracts we have many product line. Now > > in product line of course we have a product field (product.product > > relation) and some other staff which works as additional properties. > > Now we would like to implement standard search ( search boxes above > > the Treeview by select="1") . > > The question is how to implement it more beautiful. > > First I don't think there is a beautiful way to do it because it is not a > natural behavior. You want to search on something that is not displayed. > > > As it might be very applicable in other modules it's useful for me to > > give other members advises. > > I myself start with some rofth ideas: > > > 1. Implement a functional field within the parent (pricelist) model > > trying to extract products which are related to this pricelist > > 1.1. through navigaiton > > 1.2 using domains > > It is a possible way which is quite elegant. > > > 2. make a direct relation again to the child of the child field > > to have something in the main Treeview to add "select=1" to it :) . > > just because the feather of search child fields is not available ! > > sounds not logical. > > I'm not sure but it is perhaps a many2many. > > > i found an internal mechanism used by Tryton to hide search in > > Treeview when we are using it not as a main Treeview, But as child > > Treeview within the main Fromview. this mechanism hides search fields > > which is selected as a main search option during model definition > > ( for instance fields.char("sample", select="1") ). > > > The idea of implementing this mechanism is obvious. It exist because > > we need to have a nice user interface, and search within child fields > > is not necessary in many situation. but according to some developments > > it looks critical. > > > Therefore this mechanism (to hide searchbox above child treeview > > within form view) should exist, but we have to take control of it. > > No it is not logical to search this way on a one2many or many2many because > they represent a selection of data. > If you need to search inside the values of a one2many or many2many you must > create a relate button to open this lines in its own tabs and then you can > search on it because they are now independant from the parent.
Hi Cedric, Regarding your comments,i agree that standard fields are more beautiful codes. Actually i use this phrase "implement something more beautiful" generally to express my ideas not block of codes, solving some problems can demonstrate beauty in a mind and I'm a very big fan of beautiful minds :) Regarding option 2, you are almost right as it is a many2many relation, the question is how to handle domain? Is it really good to implement a domain on it. In addition i couldn't find any samples for domains like this within the code. I mean: translation of below sentence to a domain is a little bit confusing for me: "products which is a member of product_price which is a member of a contract which is a member of pricelist which has an id = current pricelist id" Regarding your last advise, it sounds very nice. i really hadn't thank about this ! and then in the new tab we don't have any parent field and it means freedom for searchboxes and many other things ! I appreciate it if you could give me direction on how to open and refer to a new tab in Tryton from a form view. Very thanks Seyed Mohammad Motahar. -- [email protected] mailing list
