Hi Cedric,
I was working on the feature of adding search for products within the
pricelist.
Pricelist>contracts>products>Pair of those Products and related
prices.
I am happy to get the result of searching for the products within the
pricelist.
What i did was to add a function field to the pricelist.first of all,
i set the get method of this function field to extract all the related
products within the list and then put them together as a long string !
(I know not good !). then i thought it might be possible to write a
searcher method to find an specific string on it.
Therefore i wrote a searcher method to return [('products',cause[2:])
But regarding my another post in Tryton Dev group. this cause an
infinite loop. So the easier way was not possible.
For anyone who is working on it , to pay attention to the return value
of searcher method for the functional field. searcher method should
return a template value which has been used by ORM to manipulate data
something like this res = [('party.id','==',10')]
Then the ORM can do the job for you.
But in some cases like my case (to find specific records within the
ORM and database), Everyone can use the search() or browse() method
and navigate through the ORM system.
Then you can find your own records,
Just put the ids of result in a list and then return this
template :
list = [1,2,8]
res = [('id','in', list)]
return res
In my opinion, it works fine now(Of course with some limitations), and
as we have some similar search issues within my module and the other
modules, we finally have to make our last decision to write them all
using a technique .
Therefore i would like to ask you whether it is possible to use this
technique or not.
I have to mention that i tried more than 13 different techniques and
patterns to find this using old fashioned try and error technique some
of them are working correctly, But probably this one looks and works
better
I am looking forward to see your remarks on that.
Mohammad
On Oct 19, 3:46 pm, Cédric Krier <[email protected]> wrote:
> On 18/10/10 18:57 -0700, Mohammad wrote:
>
>
>
>
>
>
>
>
>
> > 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"
>
> I'm not sure to understand what you want to filter.
> Is it pricelist based on products clause or product_price based on pricelist
> and product ?
>
> > 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.
>
> You can have a look
> athttp://hg.tryton.org/modules/sale/file/8efdec36973b/party.xml#l12
> It adds a relate button on party to show sales of the current party.
>
> --
> 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/
>
> application_pgp-signature_part
> < 1KViewDownload
--
[email protected] mailing list