Skip to content

Commit 8988ebf

Browse files
sergio-teruelyajo
authored andcommitted
[9.0][IMP] web_responsive: Load default kanban view for small screen and One2many related fields. (OCA#536)
* [9.0][IMP] web_responsive: Load default kanban view for small screen and One2many related fields. * [9.0][IMP] web_responsive: Remove unnecessary One2Many rewrite. * Spell checking
1 parent 1a6504f commit 8988ebf

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

web_responsive/README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Features:
1212

1313
* New navigation with an App drawer
1414
* Keyboard shortcuts for easier navigation
15+
* Display kanban views for small screens format if an action or field One2x
16+
has a kanban view
1517

1618

1719
Installation
@@ -52,6 +54,8 @@ this module.
5254
* Adding ``oe_main_menu_navbar`` ID to the top navigation bar triggers some
5355
great styles, but also `JavaScript that causes issues on mobile
5456
<https://github.com/OCA/web/pull/446#issuecomment-254827880>`_
57+
* The kanban view not is shown if an action window has no kanban mode view
58+
5559

5660
Bug Tracker
5761
===========
@@ -75,6 +79,7 @@ Contributors
7579

7680
* Dave Lasley <dave@laslabs.com>
7781
* Jairo Llopis <jairo.llopis@tecnativa.com>
82+
* Sergio Teruel <sergio.teruel@tecnativa.com>
7883

7984
Maintainer
8085
----------

web_responsive/static/src/js/web_responsive.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ odoo.define('web_responsive', function(require) {
88
var Class = require('web.Class');
99
var SearchView = require('web.SearchView');
1010
var core = require('web.core');
11+
var config = require('web.config');
12+
var FieldOne2Many = core.form_widget_registry.get('one2many');
13+
var ViewManager = require('web.ViewManager');
1114

1215
Menu.include({
1316

@@ -292,10 +295,24 @@ odoo.define('web_responsive', function(require) {
292295
new AppDrawer();
293296
});
294297

298+
// if we are in small screen change default view to kanban if exists
299+
ViewManager.include({
300+
get_default_view: function() {
301+
var default_view = this._super()
302+
if (config.device.size_class <= config.device.SIZES.XS &&
303+
default_view != 'kanban' &&
304+
this.views['kanban']){
305+
default_view = 'kanban';
306+
};
307+
return default_view;
308+
},
309+
});
310+
295311
return {
296312
'AppDrawer': AppDrawer,
297313
'SearchView': SearchView,
298314
'Menu': Menu,
315+
'ViewManager': ViewManager,
299316
};
300317

301318
});

0 commit comments

Comments
 (0)