Bhumi Thakkar (Open ERP) has proposed merging 
lp:~openerp-dev/openerp-web/6.1-opw-574925-bth into lp:openerp-web/6.1.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-574925-bth/+merge/110482

Hello,

   In web : click on lead which is created by shortcut it's throw error.

1. Sales => sales => Lead
2. Click on shortcut image. Lead displayed in shortcuts.
3. Reload Page.
4. Click on shortcut image. Warning coming for Constraint error. "Shortcut for 
this menu already exists!"
5. Again click on shortcut image. Error coming "AttributeError: 'str' object 
has no attribute 'getquoted'".

Observed: Warning is coming for constraint Error "Shortcut for this menu 
already exists!" and error   is coming "AttributeError: 'str' object has no 
attribute 'getquoted'".
Expected: After Came Warning for constraint error shortcut should not be 
create/remove.

Put condition if record is create succesfully then going to create shortcut 
else not.
for remove if id got then going to remove.

Thanks.

-- 
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-574925-bth/+merge/110482
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/6.1-opw-574925-bth.
=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js	2012-06-12 14:19:43 +0000
+++ addons/web/static/src/js/chrome.js	2012-06-15 07:36:21 +0000
@@ -691,26 +691,30 @@
             $(sc.binding).bind({
                 'add': function (e, attrs) {
                     shortcuts_ds.create(attrs, function (out) {
-                        $('<li>', {
-                            'data-shortcut-id':out.result,
-                            'data-id': attrs.res_id
-                        }).text(attrs.name)
-                          .appendTo(self.$element.find('.oe-shortcuts ul'));
-                        attrs.id = out.result;
-                        sc.push(attrs);
+                        if(out.result){
+                            $('<li>', {
+                                'data-shortcut-id':out.result,
+                                'data-id': attrs.res_id
+                            }).text(attrs.name)
+                            .appendTo(self.$element.find('.oe-shortcuts ul'));
+                            attrs.id = out.result;
+                            sc.push(attrs);
+                        }
                     });
                 },
                 'remove-current': function () {
                     var menu_id = self.session.active_id;
-                    var $shortcut = self.$element
-                        .find('.oe-shortcuts li[data-id=' + menu_id + ']');
-                    var shortcut_id = $shortcut.data('shortcut-id');
-                    $shortcut.remove();
-                    shortcuts_ds.unlink([shortcut_id]);
-                    var sc_new = _.reject(sc, function(shortcut){ return shortcut_id === shortcut.id});
-                    sc.splice(0, sc.length);
-                    sc.push.apply(sc, sc_new);
+                    if(menu_id){
+                        var $shortcut = self.$element
+                            .find('.oe-shortcuts li[data-id=' + menu_id + ']');
+                        var shortcut_id = $shortcut.data('shortcut-id');
+                        $shortcut.remove();
+                        shortcuts_ds.unlink([shortcut_id]);
+                        var sc_new = _.reject(sc, function(shortcut){ return shortcut_id === shortcut.id});
+                        sc.splice(0, sc.length);
+                        sc.push.apply(sc, sc_new);
                     }
+                }
             });
         }
         return this.rpc('/web/session/sc_list', {}, function(shortcuts) {

_______________________________________________
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