Thibault Delavallée (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-mail-state-tde 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-mail-state-tde/+merge/111358

Info: clean mailgateway, add a message_state for ex-'pending' state due to new 
messages
read/unread behavior (receive email -> unread; when viewing form view -> 
automatically read)
buttons "mark read / mark unread"
track in modules specific behavior of mailgateways to clean and update
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-mail-state-tde/+merge/111358
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-mail-state-tde.
=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js	2012-06-20 15:14:53 +0000
+++ addons/web/static/src/js/chrome.js	2012-06-21 08:54:39 +0000
@@ -666,31 +666,36 @@
      *
      * @param {Number} id the menu_id
      */
-    menu_click: function(id) {
-        if (id) {
-            // find back the menuitem in dom to get the action
-            var $item = this.$element.find('a[data-menu=' + id + ']');
-            if (!$item.length) {
-                $item = this.$secondary_menus.find('a[data-menu=' + id + ']');
-            }
-            var action_id = $item.data('action-id');
-            // If first level menu doesnt have action trigger first leaf
-            if (!action_id) {
-                if(this.$element.has($item).length) {
-                    $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']');
-                    $items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]');
-                    if($items.length) {
-                        action_id = $items.data('action-id');
-                        id = $items.data('menu');
-                    }
+    menu_click: function(id, needaction) {
+        if (!id) { return; }
+
+        this.do_hide_more();
+        // find back the menuitem in dom to get the action
+        var $item = this.$element.find('a[data-menu=' + id + ']');
+        if (!$item.length) {
+            $item = this.$secondary_menus.find('a[data-menu=' + id + ']');
+        }
+        var action_id = $item.data('action-id');
+        // If first level menu doesnt have action trigger first leaf
+        if (!action_id) {
+            if(this.$element.has($item).length) {
+                var $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']');
+                var $items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]');
+                if($items.length) {
+                    action_id = $items.data('action-id');
+                    id = $items.data('menu');
                 }
             }
-            this.open_menu(id);
-            this.current_menu = id;
-            this.session.active_id = id;
-            if (action_id) {
-                this.trigger('menu_click', action_id, id, $item);
-            }
+        }
+        this.open_menu(id);
+        this.current_menu = id;
+        this.session.active_id = id;
+        if (action_id) {
+            this.trigger('menu_click', {
+                action_id: action_id,
+                needaction: needaction,
+                id: id
+            }, $item);
         }
     },
     /**
@@ -699,8 +704,9 @@
      * @param {Event} ev the jquery event
      */
     on_menu_click: function(ev) {
-        ev.preventDefault();
-        this.menu_click($(ev.currentTarget).data('menu'));
+        var needaction = !!$(ev.target).filter('div.oe_menu_counter').length;
+		ev.preventDefault();
+        this.menu_click($(ev.currentTarget).data('menu'), needaction);
     },
 });
 
@@ -996,8 +1002,16 @@
         this._current_state = _.clone(state);
         $.bbq.pushState(url);
     },
-    on_menu_action: function(action) {
-        this.action_manager.do_action(action);
+    on_menu_action: function(options) {
+        var self = this;
+        this.rpc("/web/action/load", { action_id: options.action_id })
+            .then(function (result) {
+                var action = result.result;
+                if (options.needaction) {
+                    action.context.search_default_needaction_pending = true;
+                }
+                self.action_manager.do_action(action);
+            });
     },
     do_action: function(action) {
         var self = this;

_______________________________________________
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