diff options
| author | Thibault Delavallée <tde@odoo.com> | 2019-12-16 12:51:49 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-12-16 15:58:16 +0000 |
| commit | 110decad006c89c6462308245a4f295c5bf570f5 (patch) | |
| tree | 6d3e4c58d003a821797ea669ab4a3e40d4c4cb5e /addons/mass_mailing_event | |
| parent | ffe1d4047da181f97fafe2a69f64e6f283fbeb0e (diff) | |
[REF] mass_mailing(_sms): force domain reset when changing model / type
In this commit we rewrite the compute on mailing domain to simply reset it
once the mailing domain is changed. Indeed trying to keep a previous domain
based on try / except has no meaning from functional point of view. If model
changes then domain should change as it is a business record, not just a
technical domain to try to apply.
LINKS
Task ID 2088577
PR #41877
Enterprise PR odoo/enterprise#7278
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Co-Authored-By: Aurélien Warnon <awa@odoo.com>
Diffstat (limited to 'addons/mass_mailing_event')
| -rw-r--r-- | addons/mass_mailing_event/models/__init__.py | 1 | ||||
| -rw-r--r-- | addons/mass_mailing_event/models/event.py | 6 | ||||
| -rw-r--r-- | addons/mass_mailing_event/models/mailing_mailing.py | 14 |
3 files changed, 1 insertions, 20 deletions
diff --git a/addons/mass_mailing_event/models/__init__.py b/addons/mass_mailing_event/models/__init__.py index 87f0737c96a..80862024115 100644 --- a/addons/mass_mailing_event/models/__init__.py +++ b/addons/mass_mailing_event/models/__init__.py @@ -2,4 +2,3 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import event -from . import mailing_mailing diff --git a/addons/mass_mailing_event/models/event.py b/addons/mass_mailing_event/models/event.py index e0443acc7d3..88def04d85f 100644 --- a/addons/mass_mailing_event/models/event.py +++ b/addons/mass_mailing_event/models/event.py @@ -8,10 +8,6 @@ class Event(models.Model): _inherit = "event.event" def action_mass_mailing_attendees(self): - if len(self) == 1: - domain = "[('event_id', '=', {})]".format(self.id) - else: - domain = "[('event_id', 'in', {})]".format(self.ids) mass_mailing_action = dict( name='Mass Mail Attendees', type='ir.actions.act_window', @@ -20,7 +16,7 @@ class Event(models.Model): target='current', context=dict( default_mailing_model_id=self.env.ref('event.model_event_registration').id, - default_mailing_domain=domain, + default_mailing_domain=repr([('event_id', 'in', self.ids)]) ), ) return mass_mailing_action diff --git a/addons/mass_mailing_event/models/mailing_mailing.py b/addons/mass_mailing_event/models/mailing_mailing.py deleted file mode 100644 index ac454e5877d..00000000000 --- a/addons/mass_mailing_event/models/mailing_mailing.py +++ /dev/null @@ -1,14 +0,0 @@ -from odoo import models, api - - -class MassMailingCampaign(models.Model): - _inherit = "mailing.mailing" - - @api.depends('mailing_model_real', 'contact_list_ids') - def _compute_mailing_domain(self): - # TDE FIXME: whuuut ? - result = super(MassMailingCampaign, self)._compute_mailing_domain() - for mailing in self: - if mailing.mailing_model_name == 'event.registration' and mailing.mailing_domain == '[]': - mailing.mailing_domain = self.env.context.get('default_mailing_domain', '[]') - return result |
