[Erp5-dev] trial balance

Jérôme Perrin jerome at nexedi.com
Sat Jan 14 18:36:52 CET 2006


Le Samedi 14 Janvier 2006 17:45, Bartłomiej Górny a écrit :
> > By the way, how to get from portal_catalog all objects that belong to a
> > subtree of a certain category?
>
> Oh, I think I got it:
>
> context.portal_categories.resolveCategory('base/sub').getCategoryMemberItem
>List(base=0,...)
>
> Is this the right one?

This one returns a list of items ready for use in a Formulator list field.

The easyiest way for you is to use accessors.
Let's take a simple example, with an Account a belonging to category 
account_type/income.

a.getAccountTypeValue(), the standard category accessor, returns the category 
object at portal_categories/account_type/income. 

In your case, you need related category accessors from this the category 
object, like that :

portal_categories.account_type.income.getAccountTypeRelatedValueList( portal_type=Account )

which returns the list of Account object related to that category.

This of course works with all categories (getGapRelatedValueList, 
getDestinationRelatedValueList and so on)

-- 
Jérome



More information about the Erp5-dev mailing list