Browse Source

[FIX] web_responsive: AppDrawer Discard

pull/1324/head
Mathias Markl 6 years ago
committed by OCA-git-bot
parent
commit
eb25ccef6c
  1. 1
      web_responsive/README.rst
  2. 18
      web_responsive/static/src/js/web_responsive.js

1
web_responsive/README.rst

@ -156,6 +156,7 @@ Contributors
* Dennis Sluijk <d.sluijk@onestein.nl> * Dennis Sluijk <d.sluijk@onestein.nl>
* Sergio Teruel <sergio.teruel@tecnativa.com> * Sergio Teruel <sergio.teruel@tecnativa.com>
* Alexandre Díaz <dev@redneboa.es> * Alexandre Díaz <dev@redneboa.es>
* Mathias Markl <mathias.markl@mukit.at>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~

18
web_responsive/static/src/js/web_responsive.js

@ -278,6 +278,8 @@ odoo.define('web_responsive', function (require) {
Menu.include({ Menu.include({
events: _.extend({ events: _.extend({
// Clicking on apps menu
"click .o_menu_apps a[data-toggle=dropdown]": "_onAppsMenuClick",
// Clicking a hamburger menu item should close the hamburger // Clicking a hamburger menu item should close the hamburger
"click .o_menu_sections [role=menuitem]": "_hideMobileSubmenus", "click .o_menu_sections [role=menuitem]": "_hideMobileSubmenus",
// Opening any dropdown in the navbar should hide the hamburger // Opening any dropdown in the navbar should hide the hamburger
@ -324,6 +326,22 @@ odoo.define('web_responsive', function (require) {
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
} }
}, },
/**
* Check if Controller can be removed
*/
_onAppsMenuClick: function(event, checkedCanBeRemoved) {
var action_manager = this.getParent().action_manager;
var controller = action_manager.getCurrentController();
if (controller && !checkedCanBeRemoved) {
controller.widget.canBeRemoved().done(function () {
$(event.currentTarget).trigger('click', [true]);
$(event.currentTarget).off('.bs.dropdown');
});
event.stopPropagation();
event.preventDefault();
}
},
}); });
RelationalFields.FieldStatus.include({ RelationalFields.FieldStatus.include({

Loading…
Cancel
Save