From e4fd9bb1054beab504ecf306121e1c5c095886ef Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 4 Jul 2013 14:06:31 +0530 Subject: [IMP] improved view and code to show default alias for job bzr revid: tpa@tinyerp.com-20130704083631-e0cyn2fxpqfhg5hb --- addons/mail/mail_thread.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'addons/mail/mail_thread.py') diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 2744e6df231..069c12abec5 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -106,10 +106,11 @@ class mail_thread(osv.AbstractModel): object_id.alias_id.alias_model_id.model == self._name and \ object_id.alias_id.alias_force_thread_id == 0: alias = object_id.alias_id - elif catchall_domain and model: # no specific res_id given -> generic help message, take an example alias (i.e. alias of some section_id) + + if catchall_domain and model and not alias: #check for example alias if res_id not given or given res_id dose not contain alias-> generic help message, take an example alias (i.e. alias of some section_id) model_id = self.pool.get('ir.model').search(cr, uid, [("model", "=", self._name)], context=context)[0] alias_obj = self.pool.get('mail.alias') - alias_ids = alias_obj.search(cr, uid, [("alias_model_id", "=", model_id), ("alias_name", "!=", False), ('alias_force_thread_id', '=', 0)], context=context, order='id ASC') + alias_ids = alias_obj.search(cr, uid, [("alias_model_id", "=", model_id), ("alias_name", "!=", False), ('alias_force_thread_id', '=', False), ('alias_parent_thread_id', '=', False)], context=context, order='id ASC') if alias_ids and len(alias_ids) == 1: # if several aliases -> incoherent to propose one guessed from nowhere, therefore avoid if several aliases alias = alias_obj.browse(cr, uid, alias_ids[0], context=context) -- cgit v1.2.3 From ee471832f9d9a3eae6260bd0ba95951321bbb874 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 10 Feb 2014 18:46:09 +0530 Subject: [IMP] improved code to show default alias id bzr revid: tpa@tinyerp.com-20140210131609-v5cxl5pexk37pt6d --- addons/mail/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/mail/mail_thread.py') diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index d338a134c16..ec813455898 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -115,7 +115,7 @@ class mail_thread(osv.AbstractModel): alias = object_id.alias_id if catchall_domain and model and not alias: #check for example alias if res_id not given or given res_id dose not contain alias-> generic help message, take an example alias (i.e. alias of some section_id) alias_obj = self.pool.get('mail.alias') - alias_ids = alias_obj.search(cr, uid, [("alias_parent_model_id.model", "=", model), ("alias_name", "!=", False), ('alias_force_thread_id', '=', False)], context=context, order='id ASC') + alias_ids = alias_obj.search(cr, uid, [("alias_parent_model_id.model", "=", model), ("alias_name", "!=", False), ('alias_force_thread_id', '=', False), ('alias_parent_thread_id', '=', False)], context=context, order='id ASC') if alias_ids and len(alias_ids) == 1: alias = alias_obj.browse(cr, uid, alias_ids[0], context=context) -- cgit v1.2.3 From 4be860c167c53ffaacfbe6247b856228da873693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 10 Feb 2014 15:46:11 +0100 Subject: [REVIEW] mail: mail_thread: cleaned comment of modified code in get_empty_list_help bzr revid: tde@openerp.com-20140210144611-16nkcju2yerc80e5 --- addons/mail/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/mail/mail_thread.py') diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index ec813455898..94918032886 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -113,7 +113,7 @@ class mail_thread(osv.AbstractModel): object_id.alias_id.alias_model_id.model == self._name and \ object_id.alias_id.alias_force_thread_id == 0: alias = object_id.alias_id - if catchall_domain and model and not alias: #check for example alias if res_id not given or given res_id dose not contain alias-> generic help message, take an example alias (i.e. alias of some section_id) + if not alias and catchall_domain and model: # no res_id or res_id not linked to an alias -> generic help message, take a generic alias of the model alias_obj = self.pool.get('mail.alias') alias_ids = alias_obj.search(cr, uid, [("alias_parent_model_id.model", "=", model), ("alias_name", "!=", False), ('alias_force_thread_id', '=', False), ('alias_parent_thread_id', '=', False)], context=context, order='id ASC') if alias_ids and len(alias_ids) == 1: -- cgit v1.2.3 From 96d36934418d81251981f0265377661f3d1aee25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 10 Feb 2014 18:13:50 +0100 Subject: [FIX] mail_alias: avoid performing tracking when migrating to alias. Indeed in this method, we have unitialized inherited fields because the orm is updating. A new no_track key (already intorduced in 7.0, added in this branch because of a missing forward-port) in mail_thread allows to avoid doing the tracking of values and is used in mail_alias. bzr revid: tde@openerp.com-20140210171350-ajwxwau2ar1gu9io --- addons/mail/mail_thread.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'addons/mail/mail_thread.py') diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 94918032886..9a8adee31c3 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -384,7 +384,10 @@ class mail_thread(osv.AbstractModel): track_ctx = dict(context) if 'lang' not in track_ctx: track_ctx['lang'] = self.pool.get('res.users').browse(cr, uid, uid, context=context).lang - tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=track_ctx) + if not context.get('mail_notrack'): + tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=track_ctx) + else: + tracked_fields = [] if tracked_fields: records = self.browse(cr, uid, ids, context=track_ctx) initial_values = dict((this.id, dict((key, getattr(this, key)) for key in tracked_fields.keys())) for this in records) -- cgit v1.2.3