Foram Katharotiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-message-sub-type-apa-default-fka into 
lp:~openerp-dev/openobject-addons/trunk-message-sub-type-apa.

Requested reviews:
  Amit Patel (OpenERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-message-sub-type-apa-default-fka/+merge/121414

Hello sir,

   As per your suggestion display True default value of subtype in followers

thanks,
FKA
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-message-sub-type-apa-default-fka/+merge/121414
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-message-sub-type-apa.
=== modified file 'mail/static/src/js/mail_followers.js'
--- mail/static/src/js/mail_followers.js	2012-08-27 05:55:39 +0000
+++ mail/static/src/js/mail_followers.js	2012-08-27 12:28:34 +0000
@@ -44,13 +44,8 @@
             this._check_visibility();
             this.fetch_subtype();
             this.$el.find('div.oe_mail_recthread_subtype').click(function () {
-                var subtypelist = new Array();
-                _($(this).find('.oe_msg_subtype_check')).each(function (record){
-                   if($(record).is(':checked')) {
-                       subtypelist.push(parseInt($(record).attr('id')))}
-                 });
-                 self.ds_model.call('message_subscribe_udpate_subtypes',[[self.view.datarecord.id],self.session.uid,subtypelist])
-            })
+                self.update_subtype();
+                            })
             this.$el.find('button.oe_mail_button_followers').click(function () { self.do_toggle_followers(); });
 
             if (! this.params.display_control) {
@@ -108,6 +103,7 @@
         display_subscribers: function (records) {
             var self = this;
             this.is_subscriber = false;
+            if(this.view.get("actual_mode") == "edit"){self.update_subtype();}
             var user_list = this.$el.find('ul.oe_mail_followers_display').empty();
             this.$el.find('div.oe_mail_recthread_followers h4').html(this.params.title + ' (' + records.length + ')');
             _(records).each(function (record) {
@@ -125,10 +121,26 @@
                 this.$el.find('div.oe_mail_recthread_subtype').hide() }
         },
         
+        update_subtype: function (){
+         var self = this;
+         var cheklist = new Array();
+        _(this.$el.find('.oe_msg_subtype_check')).each(function(record){
+                if($(record).is(':checked')) {
+                       cheklist.push(parseInt($(record).attr('id')))}
+            });
+            self.ds_model.call('message_subscribe_udpate_subtypes',[[self.view.datarecord.id],self.session.uid,cheklist])
+        },
+        
         // Display the subtypes of each records.
         display_subtype: function(records) {
             var self = this
             var subtype_list = this.$el.find('div.oe_mail_recthread_subtype').empty();
+            _(records).each(function (record) {
+                record.name = record.name.toLowerCase().replace(/\b[a-z]/g, function(letter) {
+                    return letter.toUpperCase();
+                    });
+                $(session.web.qweb.render('mail.record_thread.subtype', {'record': record})).appendTo(subtype_list);
+            });
             var follower_ids = this.follower_model.call('search',[[['res_model','=',this.ds_model.model],['res_id','=',this.view.datarecord.id],['user_id','=',this.session.uid]]])
             follower_ids.then(function (record){
                var follower_read = self.follower_model.call('read',  [record,['subtype_ids']]);
@@ -140,12 +152,6 @@
                    }
                })
             });
-            _(records).each(function (record) {
-                record.name = record.name.toLowerCase().replace(/\b[a-z]/g, function(letter) {
-                    return letter.toUpperCase();
-                    });
-                $(session.web.qweb.render('mail.record_thread.subtype', {'record': record})).appendTo(subtype_list);
-            });
         },
             
         do_follow: function () {

=== modified file 'mail/static/src/xml/mail_followers.xml'
--- mail/static/src/xml/mail_followers.xml	2012-08-27 05:55:39 +0000
+++ mail/static/src/xml/mail_followers.xml	2012-08-27 12:28:34 +0000
@@ -40,7 +40,8 @@
                     <a t-attf-href="#model=mail.message.subtype&amp;id=#{record.id}"><t t-raw="record.name"/></a>
                 </td>
                 <td width="10%">
-                    <input type="checkbox" t-att-id="record.id" t-att-name="record.name" class="oe_msg_subtype_check"/>
+                    <t t-if ="record.default"><input type="checkbox" t-att-id="record.id" t-att-name="record.name"  checked="" class="oe_msg_subtype_check"/></t>
+                    <t t-if ="! record.default"><input type="checkbox" t-att-id="record.id" t-att-name="record.name"  class="oe_msg_subtype_check"/></t>
                 </td>
             </tr>
         </table>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to