[Erp5-dev] getter for acquired property
Jérôme Perrin
jerome at nexedi.com
Tue Jan 3 09:55:00 CET 2006
Le Lundi 2 Janvier 2006 22:00, Bartłomiej Górny a écrit :
> Hi
>
> Another question - best described in an example:
>
> In the "Organisation" module there is an Organisation class which has
> and Organisation property sheet, which says:
>
> {'id' : 'social_capital_currency_id',
> 'type' : 'string',
> 'portal_type' : 'Currency',
> 'acquisition_base_category' : ('price_currency'),
> 'acquisition_portal_type' : ('Currency'),
> 'acquisition_copy_value' : 0,
> 'acquisition_mask_value' : 1,
> 'acquisition_sync_value' :0,
> 'acquisition_accessor_id' : 'getId',
> 'mode' : 'w' }
>
> (and the same for _title).
>
> After editing the object (with the stock form), Base_viewDict shows that
> social_capital_currency='currency_module/PLN'
You are unlucky, the form was buggy and has been fixed a few days ago. In that
case, the social capital currency is set through the 'price_currency'
category (in the same property sheet). The purpose of this accessor is to
give an alias to getPriceCurrencyId. It calls the method 'getId' on the
object related by the price_currency category (and with portal type
Currency).
If you want to see other examples of this technique, look at the Arrow
property sheet, it defines accessors like getDestinationTitle, which gives
access to the 'title' property on the object linked by the '<destination'
relation.
> The question is, how to get it by an appropriate getter?
> getSocialCapitalCurrencyId and getSocialCapitalCurrencyTitle exist but
> return nothing, getSocialCapitalCurrency does not exist, so what is the
> right function?
If you use setPriceCurrency('currency_module/PLN') or update your erp5_core
business template, it will work as expected
--
Jérome
More information about the Erp5-dev
mailing list