def METHOD_NAME(self):
    for att in self:
        partners = att.mapped("out_invoice_ids.partner_id")
        att.invoice_partner_id = False
        if len(partners) == 1:
            att.invoice_partner_id = partners.id