diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 2ee5588ddc9..c2361939365 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -928,7 +928,7 @@ Update your business card, phone book, social media,... Send an email right now return 'crm.mt_lead_won' elif 'active' in init_values and record.probability == 0 and not record.active: return 'crm.mt_lead_lost' - elif 'stage_id' in init_values and record.probability == 0 and record.stage_id and record.stage_id.sequence <= 1: + elif 'stage_id' in init_values and record.stage_id and record.stage_id.sequence <= 1: return 'crm.mt_lead_create' elif 'stage_id' in init_values: return 'crm.mt_lead_stage' diff --git a/addons/hr/hr.py b/addons/hr/hr.py index ec8f736b3cb..4b3d61c1c63 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -3,6 +3,7 @@ import logging +from openerp import api from openerp import SUPERUSER_ID from openerp import tools from openerp.modules.module import get_module_resource @@ -103,6 +104,12 @@ class hr_job(osv.Model): }, context=context) return True + # TDE note: done in new api, because called with new api -> context is a + # frozendict -> error when tryign to manipulate it + @api.model + def create(self, values): + return super(hr_job, self.with_context(mail_create_nosubscribe=True)).create(values) + def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {} @@ -308,6 +315,9 @@ class hr_department(osv.osv): return res def create(self, cr, uid, vals, context=None): + if context is None: + context = {} + context['mail_create_nosubscribe'] = True # TDE note: auto-subscription of manager done by hand, because currently # the tracking allows to track+subscribe fields linked to a res.user record # An update of the limited behavior should come, but not currently done. diff --git a/addons/project/project.py b/addons/project/project.py index 633f929927d..cc7e226e59d 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -319,7 +319,8 @@ class project(osv.osv): # Prevent double project creation when 'use_tasks' is checked + alias management create_context = dict(context, project_creation_in_progress=True, alias_model_name=vals.get('alias_model', 'project.task'), - alias_parent_model_name=self._name) + alias_parent_model_name=self._name, + mail_create_nosubscribe=True) if vals.get('type', False) not in ('template', 'contract'): vals['type'] = 'contract' diff --git a/addons/sales_team/sales_team.py b/addons/sales_team/sales_team.py index 8c871b88bbc..ec99ca6bdf2 100644 --- a/addons/sales_team/sales_team.py +++ b/addons/sales_team/sales_team.py @@ -55,6 +55,12 @@ class crm_team(osv.Model): (osv.osv._check_recursion, 'Error ! You cannot create recursive Sales team.', ['parent_id']) ] + def create(self, cr, uid, values, context=None): + if context is None: + context = {} + context['mail_create_nosubscribe'] = True + return super(crm_team, self).create(cr, uid, values, context=context) + def name_get(self, cr, uid, ids, context=None): """Overrides orm name_get method""" if not isinstance(ids, list):