Assert isinstance(value, (Target, type(None)))

Hi , I need to take the address of the party from a specific postion:

Here is the code:

       addr = fields.Many2One('party.address', 'Address',
        required=True, states=_states, depends=_depends + ['party'],
        domain=[('party', '=', Eval('party'))])
   @fields.depends('party')
    def on_change_party(self):
        self.addr= None
        if self.party:
            position = str(self.party.addresses[0]).find(',')
            self.addr = str(self.party.addresses[0])[position+1::]

but there was an error : assert isinstance(value, (Target, type(None))), Howi can fix that ??

addresses is a One2Many so you get a tuple of record. So when you take the first record, you get a record. From there you must choose what field you want to take from.