I’m wondering how to use
One2Many fields and on
Function fields. Are there any examples?
My fields are:
__name__ = 'party.party'
organisation = fields.Many2One('party.party', 'Organisation')
contacts = fields.One2Many('party.party', 'organisation', 'Contacts')
__name__ = 'stock.move'
party = fields.Function(
You can find examples on the source code for party module:
You only need to include them on to fields_to_replace:
__name__ = 'party.replace'
return super(PartyReplace, cls).fields_to_replace() + [
You may also want to make active=False the source records as the party addresses does.
Thanks for the tip. Anyhow
organisation in the example is
Many2One, while I’m seeking examples for
Function fields do not store any data so it is their source that must be replaced.
One2Many use case was not considered in the implementation because party being referential, it is odd to have it inside such field.