diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-03-13 15:17:18 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-03-13 15:17:18 +0100 |
| commit | b255703166c7c648ecbcd311be55daa8acd7f31e (patch) | |
| tree | f30f85cddc68231d0e930d6d5ec8837d148b13f7 /addons/mail/static/src | |
| parent | ea4198254126cc5f88b2752052fc181fde436564 (diff) | |
| parent | 9568673e0f44c3c44d01dd90446bd1cf15f706a4 (diff) | |
[MERGE] from trunk
bzr revid: chm@openerp.com-20130313141718-dw76m7fvy0co3rfi
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 6 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail_followers.js | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 0b3bddffde1..e5c8f40eb2e 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -104,8 +104,8 @@ openerp.mail = function (session) { // returns the file type of a file based on its extension // As it only looks at the extension it is quite approximative. filetype: function(url){ - url = url.filename || url; - var tokens = (url+'').split('.'); + var url = url && url.filename || url; + var tokens = typeof url == 'string' ? url.split('.') : []; if(tokens.length <= 1){ return 'unknown'; } @@ -518,7 +518,7 @@ openerp.mail = function (session) { 'default_composition_mode': default_composition_mode, 'default_parent_id': self.id, 'default_body': mail.ChatterUtils.get_text2html(self.$el ? (self.$el.find('textarea:not(.oe_compact)').val() || '') : ''), - 'default_attachment_ids': self.attachment_ids, + 'default_attachment_ids': _.map(self.attachment_ids, function (file) {return file.id;}), 'default_partner_ids': partner_ids, }; if (default_composition_mode != 'reply' && self.context.default_model && self.context.default_res_id) { diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 03351c24ac2..41634fd2135 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -206,21 +206,23 @@ openerp_mail_followers = function(session, mail) { /** Fetch subtypes, only if current user is follower */ fetch_subtypes: function () { + var self = this; var subtype_list_ul = this.$('.oe_subtype_list').empty(); if (! this.message_is_follower) return; - var context = new session.web.CompoundContext(this.build_context(), {}); - this.ds_model.call('message_get_subscription_data', [[this.view.datarecord.id], context]).then(this.proxy('display_subtypes')); + var id = this.view.datarecord.id; + this.ds_model.call('message_get_subscription_data', [[id], new session.web.CompoundContext(this.build_context(), {})]) + .then(function (data) {self.display_subtypes(data, id);}); }, /** Display subtypes: {'name': default, followed} */ - display_subtypes:function (data) { + display_subtypes:function (data, id) { var self = this; var subtype_list_ul = this.$('.oe_subtype_list'); var records = []; var nb_subtype = 0; subtype_list_ul.empty(); - if (this.view.datarecord.id) { - records = data[this.view.datarecord.id].message_subtype_data; + if (data[id]) { + records = data[id].message_subtype_data; } _(records).each(function (record) {nb_subtype++;}); if (nb_subtype > 1) { |
