Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] mass_mailing_list_dynamic, mass_mailing_partner: allow bouncing synced contacts #1529

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

yajo
Copy link
Member

@yajo yajo commented Dec 26, 2024

The previous implementation in mass_mailing_partner overwrote create() and write() in a way that always updated all fields.

However, mass_mailing_list_dynamic added a constraint on 4 fields, called _check_no_manual_edits_on_fully_synced_lists().

The combination of these 2 things made that constraint to be checked always, regardless on which fields were being updated.

Thus, when sending a mass mailing based on a fully synced list, and processing bounces, we would get errors always. Even when the message_bounce field shouldn't be constrained.

2024-12-23 13:03:03,170 48 INFO prod odoo.addons.mail.models.fetchmail: Failed to process mail from outlook server [email protected].
Traceback (most recent call last):
  File "/opt/odoo/auto/addons/mail/models/fetchmail.py", line 238, in fetch_mail
    res_id = MailThread.with_context(**additionnal_context).message_process(server.object_id.model, data[0][1], save_original=server.original, strip_attachments=(not server.attach))
  File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 1260, in message_process
    routes = self.message_route(message, msg_dict, model, thread_id, custom_values)
  File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 1043, in message_route
    self._routing_handle_bounce(message, message_dict)
  File "/opt/odoo/auto/addons/mass_mailing/models/mail_thread.py", line 49, in _routing_handle_bounce
    super(MailThread, self)._routing_handle_bounce(email_message, message_dict)
  File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 732, in _routing_handle_bounce
    rec_bounce_w_email._message_receive_bounce(bounced_email, bounced_partner)
  File "/opt/odoo/auto/addons/mail/models/mail_thread_blacklist.py", line 105, in _message_receive_bounce
    record.message_bounce = record.message_bounce + 1
  File "/opt/odoo/custom/src/odoo/odoo/fields.py", line 1325, in __set__
    records.write({self.name: write_value})
  File "/opt/odoo/auto/addons/mass_mailing_partner/models/mailing_contact.py", line 85, in write
    super(MailingContact, contact).write(new_vals)
  File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 315, in write
    result = super(MailThread, self).write(values)
  File "/opt/odoo/custom/src/odoo/odoo/models.py", line 3807, in write
    real_recs._validate_fields(vals, inverse_fields)
  File "/opt/odoo/custom/src/odoo/odoo/models.py", line 1366, in _validate_fields
    check(self)
  File "/opt/odoo/auto/addons/mass_mailing_list_dynamic/models/mailing_contact.py", line 21, in _check_no_manual_edits_on_fully_synced_lists
    raise ValidationError(
odoo.exceptions.ValidationError: No se pueden editar manualmente los contactos en una lista completamente sincronizada. Cambie su método de sincronización o ejecute una sincronización manual en su lugar.

@moduon MT-8513

… synced contacts

The previous implementation in `mass_mailing_partner` overwrote `create()` and `write()` in a way that always updated all fields.

However, `mass_mailing_list_dynamic` added a constraint on 4 fields, called `_check_no_manual_edits_on_fully_synced_lists()`.

The combination of these 2 things made that constraint to be checked *always*, regardless on which fields were being updated.

Thus, when sending a mass mailing based on a fully synced list, and processing bounces, we would get errors always. Even when the `message_bounce` field shouldn't be constrained.

@moduon MT-8513
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants