Hello everyone,
I am trying to emulate a One2Many field. The idea is to set a list of parties and to show if meets some condition with another field.
At the time I have done 2 classes. The first one has the One2Many field function, and the second class is a ModelView class only.
The code is something like this (is not the same code, but it has the same behaviour):
class Contact(ModelSQL,ModelView):
(......)
party = fields.Many2One('Party')
contacts = fields.Function(
fields.One2Many('party.contact',None,'Contacts'),
'get_contacts')
def get_contacts(self,name):
res = [ ]
res.append(
{
'party': self.party.id,
'status': 'unreached',
})
return (res)
class PartyContact(ModelView):
' Party Contact '
__name__ = 'party.contact'
party = fields.Many2One('party.party','Party')
status = fields.Char('Status)
Each time I change the view or pass from one record to another or close the tab, tryton ask me to save the record.
Any help on that?
Thank you very much. Regards
Francisco