On 20 Oct 12:41, Mariano Ramon wrote:
> Thanks.. this solves many cases where I have to do this.
>
> I defined the function field like this in familymember:
>
> familygroup = fields.Function(
> fields.Char('FAMILY GROUP', readonly=True),
> 'get_familygroup')
>
> def familygroup(self, name):
> return "A string"
>
> yet no matter what the getter returns is always show empty in the view form
> (both edit and create) any idea what this may be?
At creation it is normal because Function fields are only computed on
stored records (you can define a default value).
> Another question..
> Let's say that familymember has a unidirectional relationship with Party.
>
> class FamilyMember(ModelSQL, ModelView):
> 'Family Member'
> __name__ = 'custom.family_member'
>
>
> party = fields.Many2One(
> 'party.party', 'Party', required=True,
> domain=[('is_person', '=', True)],
> help='Family Member')
>
>
> and I have to show the same familygroup description in the party view.
> How do I query familymember (or familygroup directly for that matter) from
> party?
You have to create the reverse One2Many fields on Party.
--
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
pgppQCkIWyqXG.pgp
Description: PGP signature
