Vidhin Mehta  (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-bug-884207-vme into lp:openerp-web.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)
Related bugs:
  Bug #884207 in OpenERP Web: "Performing an action in an o2m list row errors 
out when the row has not been saved"
  https://bugs.launchpad.net/openerp-web/+bug/884207

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-884207-vme/+merge/86390

Hello,

     In this branch there are two issue solved.In list view make appropriate 
button disable for record 
which not yet save and in other reload view after do_execute_action function.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-884207-vme/+merge/86390
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-bug-884207-vme.
=== modified file 'addons/web/static/src/js/formats.js'
--- addons/web/static/src/js/formats.js	2011-12-15 18:32:59 +0000
+++ addons/web/static/src/js/formats.js	2011-12-20 12:27:43 +0000
@@ -253,13 +253,15 @@
     if (attrs.invisible) { return ''; }
     if (column.tag === 'button') {
         return [
-            '<button type="button" title="', column.string || '', '">',
+            '<button type="button" title="', column.string || '', '" ',
+                (isNaN(row_data["id"].value)
+                    && openerp.web.BufferedDataSet.virtual_id_regex.test(row_data["id"].value))
+                    ?'disabled="disabled"':'','>',
                 '<img src="', openerp.connection.prefix, '/web/static/src/img/icons/', column.icon, '.png"',
                     ' alt="', column.string || '', '"/>',
             '</button>'
         ].join('')
     }
-
     if (!row_data[column.id]) {
         return value_if_empty === undefined ? '' : value_if_empty;
     }

=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js	2011-12-19 16:28:05 +0000
+++ addons/web/static/src/js/view_list.js	2011-12-20 12:27:43 +0000
@@ -557,6 +557,7 @@
      * @param {Function} callback should be called after the action is executed, if non-null
      */
     do_button_action: function (name, id, callback) {
+        var self = this;
         var action = _.detect(this.columns, function (field) {
             return field.name === name;
         });
@@ -575,7 +576,9 @@
             c.add(action.context);
         }
         action.context = c;
-        this.do_execute_action(action, this.dataset, id, callback);
+        this.do_execute_action(action, this.dataset, id, function(){
+            self.o2m.view.reload();
+        });
     },
     /**
      * Handles the activation of a record (clicking on it)

_______________________________________________
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