[Erp5-dev] own getTitle
Tomasz Brzezina
tomasz at brzezina.pl
Fri Mar 28 15:31:17 CET 2008
Jérome Perrin pisze:
> bartek a écrit :
>> Tomasz Brzezina wrote:
>>> I need to mask getTitle for my own portal_type - in the same way like
>>> getTitle in Person - How to?
>> There is in the experimental repository a patch called
>> XMLObject_type_based_title - see here:
>>
>> http://svn.erp5.org/experimental/Experimental/patches/XMLObject_type_based_title.py?view=markup
>>
>> It does exactly what you need - allows you to customize title generation
>> per portal type by creating appropriately named scripts. However, AFAIK
>> Nexedi saw some serious flaws in it, so it is not certain if it will
>> ever make its way to the core, or maybe it'll be reimplemented.
>>
>
> Hello,
>
> It's also possible to do this in a property sheet using a trick similar
> to the Object_getSizeColourReference example in
> http://www.erp5.org/HowToUsePropertySheets
>
> Use a property sheet like this one:
>
> class FunkyTitle:
>
> _properties = (
> { 'id' : 'title',
> 'type' : 'string',
> 'default' : '',
> 'acquisition_base_category' : (),
> 'acquisition_portal_type' : (),
> 'acquisition_copy_value' : 0,
> 'acquisition_mask_value' : 1,
> 'acquisition_depends' : None,
> 'acquisition_accessor_id' : 'getTitle',
> 'acquisition_depends' : None,
> 'alt_accessor_id' : ('Base_getFunkyTitle', ),
> 'override' : 1,
> 'mode' : 'w' },
>
> )
>
> What's important is the "override : 1", this will override the default
> getTitle accessor.
Well - the only way to push it to work is change acquisition_mask_value to 0
but then there's no need to use most of settings:
> _properties = (
> { 'id' : 'title',
> 'type' : 'string',
> 'default' : '',
> 'acquisition_base_category' : (),
> 'acquisition_portal_type' : (),
> 'acquisition_mask_value' : 0,
> 'acquisition_accessor_id' : 'getTitle',
> 'alt_accessor_id' : ('Base_getFunkyTitle', ),
> 'mode' : 'w' },
>
> )
also works correctly - so is override really necessary?
And I saw somewhere that if 'acquisition_mask_value' is equal 0, the
getTitle everytime executes Base_getFunkyTitle. I need to create Title
once, and change it only when some fields are changed. How to?
--
Tomasz Brzezina
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3327 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20080328/ca0a4704/attachment.bin>
More information about the Erp5-dev
mailing list