[FIX] mass_mailing_custom_unsubscribe: fix warning from override create method

Fixes an issue where the odoo.addons.mass_mailing_custom_unsubscribe.models.mail_unsubscribe model was not correctly overriding the create method to handle batch operations. The create method has now been adapted to handle batch record creation, ensuring that it works correctly in all situations.

TT44333
pull/1342/head
pilarvargas-tecnativa 2024-04-02 11:59:49 +02:00
parent 1d22b04d4a
commit fb3432f874
1 changed files with 7 additions and 6 deletions

View File

@ -86,12 +86,13 @@ class MailUnsubscription(models.Model):
_("Please provide details on why you are unsubscribing.")
)
@api.model
def create(self, vals):
# No reasons for subscriptions
if vals.get("action") in {"subscription", "blacklist_rm"}:
vals = dict(vals, reason_id=False, details=False)
return super().create(vals)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
# No reasons for subscriptions
if vals.get("action") in {"subscription", "blacklist_rm"}:
vals = dict(vals, reason_id=False, details=False)
return super().create(vals_list)
class MailUnsubscriptionReason(models.Model):