diff options
| author | Ravish (Open ERP) <rmu@tinyerp.com> | 2013-05-16 10:44:37 +0530 |
|---|---|---|
| committer | Ravish (Open ERP) <rmu@tinyerp.com> | 2013-05-16 10:44:37 +0530 |
| commit | fa9f18359fccc836a460736d2d07fe9b9ba0463a (patch) | |
| tree | 24f77e99fd00eee9f8ed833b4ad45aee22f628a7 /addons/mail/static/src | |
| parent | dd81c8f9c340ed78db09f3c9c0b273ad86faa056 (diff) | |
| parent | 1bb278384c4a3e6053a8f9072f4515d2e42d0455 (diff) | |
[merge] with lateset 7.0
bzr revid: rmu@tinyerp.com-20130516051437-1bdcjgxey3efpw31
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 3 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/mail/static/src/img/email_icon.png | bin | 924 -> 924 bytes | |||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 67 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail_followers.js | 2 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 27 |
5 files changed, 64 insertions, 35 deletions
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 77dfb806f77..a3d8dca6490 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -57,6 +57,9 @@ .openerp .oe_mail .oe_msg.oe_msg_nobody{ background: #F8F8F8; } +.openerp .oe_mail .oe_msg.oe_msg_notification{ + background: #F8F8F8; +} .openerp .oe_mail .oe_msg .oe_msg_left{ position: absolute; left:0; top: 0; bottom: 0; width: 40px; diff --git a/addons/mail/static/src/img/email_icon.png b/addons/mail/static/src/img/email_icon.png Binary files differindex 78c131c0ff2..78c131c0ff2 100755..100644 --- a/addons/mail/static/src/img/email_icon.png +++ b/addons/mail/static/src/img/email_icon.png diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index f992a385c3e..f3e762d1f31 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -217,6 +217,7 @@ openerp.mail = function (session) { this.res_id = datasets.res_id || this.context.default_res_id || false, this.parent_id = datasets.parent_id || false, this.type = datasets.type || false, + this.subtype = datasets.subtype || false, this.is_author = datasets.is_author || false, this.is_private = datasets.is_private || false, this.subject = datasets.subject || false, @@ -619,7 +620,10 @@ openerp.mail = function (session) { // have unknown names -> call message_get_partner_info_from_emails to try to find partner_id var find_done = $.Deferred(); if (names_to_find.length > 0) { - find_done = self.parent_thread.ds_thread._model.call('message_get_partner_info_from_emails', [names_to_find]); + var values = { + 'res_id': this.context.default_res_id, + } + find_done = self.parent_thread.ds_thread._model.call('message_get_partner_info_from_emails', [names_to_find], values); } else { find_done.resolve([]); @@ -665,7 +669,11 @@ openerp.mail = function (session) { var new_names_to_find = _.difference(names_to_find, names_to_remove); find_done = $.Deferred(); if (new_names_to_find.length > 0) { - find_done = self.parent_thread.ds_thread._model.call('message_get_partner_info_from_emails', [new_names_to_find, true]); + var values = { + 'link_mail': true, + 'res_id': self.context.default_res_id, + } + find_done = self.parent_thread.ds_thread._model.call('message_get_partner_info_from_emails', [new_names_to_find], values); } else { find_done.resolve([]); @@ -1048,9 +1056,7 @@ openerp.mail = function (session) { msg.renderElement(); msg.start(); } - if( self.options.root_thread.__parentedParent.__parentedParent.do_reload_menu_emails ) { - self.options.root_thread.__parentedParent.__parentedParent.do_reload_menu_emails(); - } + self.options.root_thread.MailWidget.do_reload_menu_emails(); }); }); @@ -1190,6 +1196,7 @@ openerp.mail = function (session) { init: function (parent, datasets, options) { var self = this; this._super(parent, options); + this.MailWidget = parent.__proto__ == mail.Widget.prototype ? parent : false; this.domain = options.domain || []; this.context = _.extend(options.context || {}); @@ -1423,11 +1430,16 @@ openerp.mail = function (session) { message_fetch_set_read: function (message_list) { if (! this.context.mail_read_set_read) return; - this.render_mutex.exec(_.bind(function() { + var self = this; + this.render_mutex.exec(function() { msg_ids = _.pluck(message_list, 'id'); - return this.ds_message.call('set_message_read', [ - msg_ids, true, false, this.context]); - }, this)); + return self.ds_message.call('set_message_read', [msg_ids, true, false, self.context]) + .then(function (nb_read) { + if (nb_read) { + self.options.root_thread.MailWidget.do_reload_menu_emails(); + } + }); + }); }, /** @@ -1693,6 +1705,22 @@ openerp.mail = function (session) { }, /** + * crete an object "related_menu" + * contain the menu widget and the the sub menu related of this wall + */ + do_reload_menu_emails: function () { + var menu = session.webclient.menu; + if (!menu || !menu.current_menu) { + return $.when(); + } + return menu.rpc("/web/menu/load_needaction", {'menu_ids': [menu.current_menu]}).done(function(r) { + menu.on_needaction_loaded(r); + }).then(function () { + menu.trigger("need_action_reloaded"); + }); + }, + + /** *Create the root thread and display this object in the DOM. * Call the no_message method then c all the message_fetch method * of this root thread to display the messages. @@ -1741,6 +1769,7 @@ openerp.mail = function (session) { init: function (parent, node) { this._super.apply(this, arguments); + this.ParentViewManager = parent; this.node = _.clone(node); this.node.params = _.extend({ 'display_indented_thread': -1, @@ -1760,7 +1789,7 @@ openerp.mail = function (session) { this.domain = this.node.params && this.node.params.domain || []; - if (!this.__parentedParent.is_action_enabled('edit')) { + if (!this.ParentViewManager.is_action_enabled('edit')) { this.node.params.show_link = false; } }, @@ -1831,6 +1860,7 @@ openerp.mail = function (session) { */ init: function (parent, action) { this._super(parent, action); + this.ActionManager = parent; this.action = _.clone(action); this.domain = this.action.params.domain || this.action.domain || []; @@ -1864,23 +1894,6 @@ openerp.mail = function (session) { }, /** - * crete an object "related_menu" - * contain the menu widget and the the sub menu related of this wall - */ - do_reload_menu_emails: function () { - var menu = this.__parentedParent.__parentedParent.menu; - // return this.rpc("/web/menu/load", {'menu_id': 100}).done(function(r) { - // _.each(menu.data.data.children, function (val) { - // if (val.id == 100) { - // val.children = _.find(r.data.children, function (r_val) {return r_val.id == 100;}).children; - // } - // }); - // var r = menu.data; - // window.setTimeout(function(){menu.do_reload();}, 0); - // }); - }, - - /** * Load the mail.message search view * @param {Object} defaults ?? */ diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 5dfc1946587..bbfa52791af 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -148,8 +148,6 @@ openerp_mail_followers = function(session, mail) { }).then(self.proxy('display_generic')); }, _format_followers: function(count){ - // TDE note: why redefining _t ? - function _t(str) { return str; } var str = ''; if(count <= 0){ str = _t('No followers'); diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 2b3e0129959..ab82d650f30 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -144,7 +144,9 @@ <t t-foreach='widget.recipients' t-as='recipient'> <label t-attf-title="Add as recipient and follower (reason: #{recipient.reason})"> <input type="checkbox" t-att-checked="recipient.checked ? 'checked' : undefined" t-att-data="recipient.email_address"/> - <t t-raw="recipient.name"/> (<t t-raw="recipient.email_address"/>) + <t t-raw="recipient.name"/> + <t t-if="recipient.email_address">(<t t-raw="recipient.email_address"/>)</t> + <t t-if="!recipient.email_address">(no email address)</t> </label> </t> </div> @@ -226,7 +228,7 @@ <!-- default layout --> <t t-name="mail.thread.message"> - <div t-attf-class="oe_msg #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''} #{widget.partner_ids.length == 0 ? 'oe_msg_nobody' : ''} oe_msg_#{widget.type}"> + <div t-attf-class="oe_msg #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''} #{widget.subtype ? '' : 'oe_msg_nobody'} oe_msg_#{widget.type}"> <div class='oe_msg_left'> <a t-if="widget.options.show_link" t-attf-href="#model=res.partner&id=#{widget.author_id[0]}" t-att-title="widget.author_id[1]"> @@ -250,7 +252,7 @@ <t t-raw="widget.record_name"/> </a> <span t-if="!widget.options.show_link and widget.show_record_name"><t t-raw="widget.record_name"/></span> - <t t-if="widget.subject">: </t> + <t t-if="widget.show_record_name and widget.subject">: </t> <t t-if="widget.subject" t-raw="widget.subject"/> </h1> <div class="oe_msg_body"> @@ -263,13 +265,23 @@ </t> <a t-if="widget.author_id and widget.options.show_link and widget.author_id[0]" t-attf-href="#model=res.partner&id=#{widget.author_id[0]}"><t t-raw="widget.author_id[2]"/></a> <span t-if="widget.author_id and (!widget.options.show_link or !widget.author_id[0])"><t t-raw="widget.author_id[2]"/></span> - <t t-if="widget.partner_ids.length == 0"> + <t t-if="widget.type == 'notification'"> + updated document + <t t-if="widget.partner_ids.length > 0"> + <span class='oe_subtle'>•</span> + </t> + </t> + <t t-if="widget.type == 'comment' and ! widget.subtype"> logged a note </t> - <t t-if="widget.partner_ids.length > 0"> + <t t-if="(widget.type == 'comment' or widget.type == 'email') and widget.subtype"> to + <t t-if="widget.partner_ids.length == 0"> + nobody + </t> </t> - <t t-foreach="widget.partner_ids.slice(0, 3)" t-as="partner"> + <t t-if="widget.type == 'notification' or ( (widget.type == 'email' or widget.type == 'comment') and widget.subtype)" + t-foreach="widget.partner_ids.slice(0, 3)" t-as="partner"> <span t-attf-class="oe_partner_follower"> <a t-if="widget.options.show_link" t-attf-href="#model=res.partner&id=#{partner[0]}"><t t-raw="partner[1]"/></a> <t t-if="!widget.options.show_link" t-raw="partner[1]"/> @@ -279,6 +291,9 @@ <t t-if="widget.partner_ids.length > 3"> <span t-att-title="widget.extra_partners_str">and <t t-raw="widget.extra_partners_nbr"/> more</span> </t> + <t t-if="widget.type == 'notification' and widget.partner_ids.length > 0"> + notified + </t> <span class='oe_subtle'>•</span> <span t-att-title="widget.date"><t t-if="widget.timerelative" t-raw="widget.timerelative"/><t t-if="!widget.timerelative" t-raw="widget.date"/></span> <span t-if="!widget.options.readonly" class='oe_subtle'>•</span> |
