From 13814f4e3784178b5110c46a791d655b885655c2 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Tue, 22 Dec 2020 11:29:33 -0800 Subject: [PATCH] [ADD] web_auto_paginate: for Odoo 12 --- web_auto_paginate/__init__.py | 0 web_auto_paginate/__manifest__.py | 17 +++++++++++++++++ .../static/src/js/action_manager.js | 19 +++++++++++++++++++ web_auto_paginate/views/web_views.xml | 8 ++++++++ 4 files changed, 44 insertions(+) create mode 100644 web_auto_paginate/__init__.py create mode 100644 web_auto_paginate/__manifest__.py create mode 100644 web_auto_paginate/static/src/js/action_manager.js create mode 100644 web_auto_paginate/views/web_views.xml diff --git a/web_auto_paginate/__init__.py b/web_auto_paginate/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_auto_paginate/__manifest__.py b/web_auto_paginate/__manifest__.py new file mode 100644 index 00000000..35437f06 --- /dev/null +++ b/web_auto_paginate/__manifest__.py @@ -0,0 +1,17 @@ +{ + 'name': 'Web Auto Paginate', + 'version': '12.0.1.0.0', + 'author': 'Hibou Corp. ', + 'website': 'https://hibou.io/', + 'license': 'AGPL-3', + 'category': 'Tools', + 'complexity': 'expert', + 'depends': [ + 'web', + ], + 'data': [ + 'views/web_views.xml', + ], + 'installable': True, + 'auto_install': False, +} diff --git a/web_auto_paginate/static/src/js/action_manager.js b/web_auto_paginate/static/src/js/action_manager.js new file mode 100644 index 00000000..185f1948 --- /dev/null +++ b/web_auto_paginate/static/src/js/action_manager.js @@ -0,0 +1,19 @@ +odoo.define('web_auto_paginate.action_manager', function (require) { + "use strict"; + + var ActionManager = require('web.ActionManager'); + + ActionManager.include({ + _executeCloseAction: function (action, options) { + if (action.auto_paginate) { + var $_o_pager_next = $('button.o_pager_next'); + if ($_o_pager_next.length >= 1) { + setTimeout(function(){$_o_pager_next[0].click()}, 500) + } + } + return this._super(action, options); + } + }); + + return ActionManager; +}); diff --git a/web_auto_paginate/views/web_views.xml b/web_auto_paginate/views/web_views.xml new file mode 100644 index 00000000..e0a33790 --- /dev/null +++ b/web_auto_paginate/views/web_views.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file