Nicolas (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-manual-reconciliation-rga into lp:openerp-web.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-manual-reconciliation-rga/+merge/123946
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-manual-reconciliation-rga/+merge/123946
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-manual-reconciliation-rga.
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js	2012-09-12 12:01:55 +0000
+++ addons/web/static/src/js/view_form.js	2012-09-12 12:31:38 +0000
@@ -159,8 +159,8 @@
         this.has_been_loaded.resolve();
 
         // Add bounce effect on button 'Edit' when click on readonly page view.
-        this.$el.find(".oe_form_field,label").on('click', function (e) {
-            if(self.get("actual_mode") == "view") {
+        this.$el.find(".oe_form_field, .oe_form_group_cell").on('click', function (e) {
+            if(self.get("actual_mode") == "view" && self.options.$buttons) {
                 var $button = self.options.$buttons.find(".oe_form_button_edit");
                 $button.effect('bounce', {distance: 18, times: 5}, 150)
             }
@@ -398,7 +398,7 @@
                     this.dataset.index = this.dataset.ids.length - 1;
                     break;
             }
-            this.reload();
+            return this.reload();
         }
     },
     init_pager: function() {

=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js	2012-09-11 06:36:07 +0000
+++ addons/web/static/src/js/view_list.js	2012-09-12 12:31:38 +0000
@@ -482,6 +482,22 @@
             }, callback);
         }
     },
+    
+    do_selection : function(ids){
+         this.$el.find('th.oe_list_record_selector input')
+                .closest('tr').each(function () {
+            if(_.include(ids, $(this).data('id'))){
+                $(this).find('th.oe_list_record_selector input').prop('checked', true)
+                }});
+     },
+     
+    default_selection: function(){
+        var self = this
+        selection_method = this.fields_view.arch.attrs.default_selection;
+        if(selection_method){
+            this.dataset.call(selection_method, [this.dataset.ids], this.context).then(_.bind(self.do_selection, self));
+        }
+    },
     /**
      * re-renders the content of the list view
      *
@@ -501,6 +517,7 @@
                         self.dataset.index = 0;
                     }
                 }
+                self.default_selection();
                 self.compute_aggregates();
                 reloaded.resolve();
             }));
@@ -2047,20 +2064,31 @@
         this._super(id, '', {string: string});
     }
 });
+
+
+
 instance.web.list.Button = instance.web.list.Column.extend({
     /**
      * Return an actual ``<button>`` tag
      */
     format: function (row_data, options) {
-        return _.template('<button type="button" title="<%-title%>" <%=additional_attributes%> >' +
-            '<img src="<%-prefix%>/web/static/src/img/icons/<%-icon%>.png" alt="<%-alt%>"/>' +
-            '</button>', {
+        var readonly = false
+        for (var a in this.modifiers) {
+            if (a === 'readonly') {
+                 readonly = instance.web.form.compute_domain(this.modifiers[a], row_data);
+            }
+        }
+        return _.template('<button type="button" title="<%-title%>" <%=klass%> <%=additional_attributes%> >' +
+            '<%=img%>' + '</button>', {
                 title: this.string || '',
-                additional_attributes: isNaN(row_data["id"].value) && instance.web.BufferedDataSet.virtual_id_regex.test(row_data["id"].value) ?
+                additional_attributes: (isNaN(row_data["id"].value) && instance.web.BufferedDataSet.virtual_id_regex.test(row_data["id"].value)) || readonly ?
                     'disabled="disabled" class="oe_list_button_disabled"' : '',
-                prefix: instance.session.prefix,
-                icon: this.icon,
-                alt: this.string || ''
+                img: this.icon ? _.template('<img src="<%-prefix%>/web/static/src/img/icons/<%-icon%>.png" alt="<%-alt%>"/>',{
+                                prefix: instance.session.prefix, 
+                                icon: this.icon,
+                                alt: this.string || ''
+                                }) : this.string || '',
+                klass: this.class ? _.str.sprintf('class="%s"',this.class) : ''
             });
     }
 });

_______________________________________________
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