[Erp5-dev] catalog usage in listboxes

bartek bartek at erp5.pl
Fri Nov 30 12:36:48 CET 2007


Łukasz Nowak wrote:
> Hello,
> 
> On 2007-10-16, 19:00:55
> Jérome Perrin <jerome at nexedi.com> wrote:
> 
> (...)
>>>  * I'm not able to search/sort on source/destination
>>>
>>> I've tried to use parent.source_title, movement.source_title - but
>>> none of those works (if I set it explicitly in sortable/search-able
>>> columns it won't help me...).
>> Look at generated query, and
>> portal_catalog/erp5_mysql_innodb/z_catalog_movement_category_list : 
>> acquired categories are not catalogued for movements (this is an 
>> optimisation).
>> With related keys, like "movement_source_title" that joins on
>> source_uid column from movement table, searching / sorting should
>> work.
> 
> Hm. I've played a lot with it, and I cannot search/sort on
> source/destination_title:
> 
> === Code ===
> org = context.restrictedTraverse('organisation_module/22')
> pc = context.portal_catalog
> 
> search_kw = {
>   'movement.source_title' : org.getTitle(), # XXX
>   'portal_type' : ['Purchase Packing List Line','Sale Packing List
> Line'], 'limit' : 10
> }
> 
> print pc(src__=1,**search_kw)
> 
> 
> for q in pc(**search_kw):
>   print q.getRelativeUrl()
> 
> return printed
> === /Code ===
> 
> In this case everything is returned.
> If XXX will become:
>   'movement_source_title' : org.getTitle(), # XXX
> everything is returned.
> 
> If XXX will become:
>   'movement.source_uid' : org.getUid(), # XXX
> it is working as excepted, but I really do not know how to use it in
> listbox - shall I play with editable listbox'es fields for it?
> 
> But if XXX become:
>   'movement.source_section_uid' : org.getUid(), # XXX
> Again everything is returned...
> 
> Is it possible to use above code with ability to search/sort on
> source/destination (and section) in listbox?
> 
> I'll try to achieve it, but I worry that only experimentation has
> left. _Maybe_ I'll hit good solution...
> 

Doesn't this page:

http://www.erp5.org/HowToSearchPortalCatalog

address some of your problems?

B.

> (...)
> 
> Regards,
> Luke
> 


-- 
"feelings affect productivity. (...) unhappy people write worse 
software, and less of it."
Karl Fogel, "Producing Open Source Software"



More information about the Erp5-dev mailing list