You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.1 KiB
26 lines
1.1 KiB
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!-- Copyright 2018 Tecnativa - Jairo Llopis
|
|
Copyright 2019 initOS GmbH - Florian Kantelberg
|
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
|
<data>
|
|
<record id="sync_blacklist" model="ir.actions.server">
|
|
<field name="name">Sync partner's email blacklist status</field>
|
|
<field name="model_id" ref="model_privacy_consent" />
|
|
<field name="crud_model_id" ref="base.model_res_partner" />
|
|
<field name="state">code</field>
|
|
<field name="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)
|
|
</field>
|
|
</record>
|
|
</data>
|