summaryrefslogtreecommitdiff
path: root/addons/mass_mailing_event
diff options
context:
space:
mode:
authorRémy Voet <ryv@odoo.com>2019-12-13 11:48:36 +0000
committerThibault Delavallée <tde@odoo.com>2019-12-16 15:58:16 +0000
commitffe1d4047da181f97fafe2a69f64e6f283fbeb0e (patch)
tree1d477ff52f6768ada194c9cbe1b1f96c71bba28d /addons/mass_mailing_event
parent4c76247a889cde3f9708d12e2f38de0c2c74cc99 (diff)
[REF] mass_mailing: move from onchange / default to stored editable computed fields
PURPOSE Try to move from onchange / default_get to stored editable computed fields. Normally behavior should be the same (computed or set by user), with support in create / write + onchange without additional code. SPECIFICATIONS Update classic fields with onchange to stored editable computed fields. It means their value will come either from manual user input, either computed based on triggers. Purpose is to remove all onchange and default_get when possible. Clean fields definition inconsistencies, like default / required on computed fields. Indeed computed fields should always have a value, maybe coming from user input. They should not have default / required that are attributes for classic fields. LINKS Task ID 2088577 PR #41877 Enterprise PR odoo/enterprise#7278
Diffstat (limited to 'addons/mass_mailing_event')
-rw-r--r--addons/mass_mailing_event/models/mailing_mailing.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/addons/mass_mailing_event/models/mailing_mailing.py b/addons/mass_mailing_event/models/mailing_mailing.py
index cf70517af1c..ac454e5877d 100644
--- a/addons/mass_mailing_event/models/mailing_mailing.py
+++ b/addons/mass_mailing_event/models/mailing_mailing.py
@@ -4,10 +4,11 @@ from odoo import models, api
class MassMailingCampaign(models.Model):
_inherit = "mailing.mailing"
- @api.onchange('mailing_model_real', 'contact_list_ids')
- def _onchange_model_and_list(self):
+ @api.depends('mailing_model_real', 'contact_list_ids')
+ def _compute_mailing_domain(self):
# TDE FIXME: whuuut ?
- result = super(MassMailingCampaign, self)._onchange_model_and_list()
- if self.mailing_model_name == 'event.registration' and self.mailing_domain == '[]':
- self.mailing_domain = self.env.context.get('default_mailing_domain', '[]')
+ 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