diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml index 913ce9fc612..465c876fae1 100644 --- a/addons/crm/crm_lead_demo.xml +++ b/addons/crm/crm_lead_demo.xml @@ -641,7 +641,6 @@ Andrew comment - crm.lead @@ -651,7 +650,6 @@ Andrew - Inquiry @@ -669,6 +667,9 @@ Andrew Want to know features and benefits to use the new software. comment + diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 28ac087edc0..cf691cceecf 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -682,12 +682,23 @@ class mail_message(osv.Model): (self._description, operation)) def create(self, cr, uid, values, context=None): + if context is None: + context = {} + default_starred = context.pop('default_starred', False) if not values.get('message_id') and values.get('res_id') and values.get('model'): values['message_id'] = tools.generate_tracking_message_id('%(res_id)s-%(model)s' % values) elif not values.get('message_id'): values['message_id'] = tools.generate_tracking_message_id('private') newid = super(mail_message, self).create(cr, uid, values, context) self._notify(cr, SUPERUSER_ID, newid, context=context) + # TDE FIXME: handle default_starred. Why not setting an inv on starred ? + # Because starred will call set_message_starred, that looks for notifications. + # When creating a new mail_message, it will create a notification to a message + # that does not exist, leading to an error (key not existing). Also this + # this means unread notifications will be created, yet we can not assure + # this is what we want. + if default_starred: + self.set_message_starred(cr, uid, [newid], True, context=context) return newid def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 453b464a409..31e77a6ec7d 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -990,8 +990,7 @@ openerp.mail = function (session) { // add message composition form view if (!this.compose_message) { this.compose_message = new mail.ThreadComposeMessage(this, this, { - // TDE FIXME: default_favorite_user_ids does not exist anymore -> you should create the message, set starred then update - 'context': this.options.compose_as_todo && !this.thread_level ? this.context : this.context, + 'context': this.options.compose_as_todo && !this.thread_level ? _.extend(this.context, { 'default_starred': true }) : this.context, 'options': this.options, }); if (!this.thread_level || this.thread_level > this.options.display_indented_thread) {