Sync partner's email blacklist status code for consent in records: email = consent.partner_id.email # Skip records without email, although highly improbable if not email: continue # Choose method to sync acceptance and blacklisting if consent.accepted: method = env["mail.blacklist"]._remove else: method = env["mail.blacklist"]._add # Apply user desire method(email)