diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-04-16 13:35:57 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-04-17 06:51:46 +0000 |
| commit | 7cfd364db54e88970ef51c798df3bd4df44222b3 (patch) | |
| tree | 9ee4b25b2f3e708428acc0dff1cbf9a65165ae9e /addons/mail/models/mail_alias.py | |
| parent | 4b3589359bd5bace5035eeeb6fd04ed29075cb1e (diff) | |
[REF] mail, various: clean usage of mail alias
Clean the usage of mail aliases and more specifically its associated mixin
`mail.alias.mixin` .
Stop using context for model of aliases, and correctly give model_id and
parent_model_id to the call chain through a cleaned code easier to override.
We also merge methods get_alias_model_name and get_alias_values in single one
called before record creation (alias first values) and right after (to have
values depending on actual record).
LINKS
Task ID 1919277
Community PR odoo/odoo#41160
Enterprise PR odoo/enterprise#6983
Upgrade PR odoo/upgrade#872
Co-Authored-By: Rémy Voet <ryv@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Diffstat (limited to 'addons/mail/models/mail_alias.py')
| -rw-r--r-- | addons/mail/models/mail_alias.py | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/addons/mail/models/mail_alias.py b/addons/mail/models/mail_alias.py index 1c781edff7a..ed36d8a3a63 100644 --- a/addons/mail/models/mail_alias.py +++ b/addons/mail/models/mail_alias.py @@ -94,16 +94,8 @@ class Alias(models.Model): model ID of the ``model_name`` context value, if provided. Also, it raises UserError if given alias name is already assigned. """ - model_name = self._context.get('alias_model_name') - parent_model_name = self._context.get('alias_parent_model_name') if vals.get('alias_name'): vals['alias_name'] = self._clean_and_check_unique(vals.get('alias_name')) - if model_name: - model = self.env['ir.model']._get(model_name) - vals['alias_model_id'] = model.id - if parent_model_name: - model = self.env['ir.model']._get(parent_model_name) - vals['alias_parent_model_id'] = model.id return super(Alias, self).create(vals) def write(self, vals): |
