[IMP] mail: add option copose_as_todo, to mark as todo the messages wrote by the composer of the root thread

bzr revid: chm@openerp.com-20121128145101-7lnw7zfrjp5k8fg3
This commit is contained in:
Christophe Matthieu 2012-11-28 15:51:01 +01:00
parent 89fce59283
commit 6b5bdc7e84
2 changed files with 10 additions and 5 deletions

View File

@ -42,7 +42,8 @@
<field name="params" eval="&quot;{
'domain': [('partner_ids.user_ids', 'in', [uid])],
'view_mailbox': True,
'read_action': 'read', }&quot;"/>
'read_action': 'read',
'show_compose_message': False }&quot;"/>
<field name="help" type="html">
<p>
<b>No private message.</b>
@ -64,7 +65,8 @@
<field name="params" eval="&quot;{
'domain': [('favorite_user_ids', 'in', [uid])],
'view_mailbox': True,
'read_action': 'read', }&quot;"/>
'read_action': 'read',
'compose_as_todo': True }&quot;"/>
<field name="help" type="html">
<p>
<b>No todo.</b>
@ -84,7 +86,8 @@
}</field>
<field name="params" eval="&quot;{
'domain': ['|', ('notification_ids.partner_id.user_ids', 'in', [uid]), ('author_id.user_ids', 'in', [uid])],
'view_mailbox': True, }&quot;"/>
'view_mailbox': True,
'show_compose_message': False }&quot;"/>
<field name="help" type="html">
<p>
No message found and no message sent yet.

View File

@ -952,7 +952,7 @@ openerp.mail = function (session) {
this.options = options.options;
this.options.root_thread = (options.options.root_thread != undefined ? options.options.root_thread : this);
this.options.show_compose_message = this.options.show_compose_message && (this.options.display_indented_thread >= this.thread_level || !this.thread_level);
this.options.show_compose_message = this.options.show_compose_message && !this.thread_level;
// record options and data
this.parent_message= parent.thread!= undefined ? parent : false ;
@ -989,7 +989,7 @@ openerp.mail = function (session) {
// add message composition form view
if (!this.compose_message) {
this.compose_message = new mail.ThreadComposeMessage(this, this, {
'context': this.context,
'context': this.options.compose_as_todo && !this.thread_level ? _.extend(this.context, { 'default_favorite_user_ids': [this.session.uid] }) : this.context,
'options': this.options,
});
if (!this.thread_level || this.thread_level > this.options.display_indented_thread) {
@ -1398,6 +1398,7 @@ openerp.mail = function (session) {
* When you use this option, the domain is not used for the fetch root.
* @param {String} [no_message] Message to display when there are no message
* @param {Boolean} [show_link_partner] Display partner (authors, followers...) on link or not
* @param {Boolean} [compose_as_todo] The root composer mark automatically the message as todo
*/
init: function (parent, action) {
this._super(parent, action);
@ -1418,6 +1419,7 @@ openerp.mail = function (session) {
'show_link_partner': true,
'view_inbox': false,
'message_ids': undefined,
'compose_as_todo' : false,
}, this.action.params);
this.action.params.help = this.action.help || false;