3
0
Fork 0

[MIG][10.0] web_ir_actions_act_window_page

10.0
Stefan Rijnhart 2017-09-14 13:59:04 +02:00
parent ef61526e26
commit a7843d6049
5 changed files with 91 additions and 70 deletions

View File

@ -1,3 +1,8 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
==================
Client side paging Client side paging
================== ==================
@ -11,3 +16,51 @@ or::
which trigger the form's controller to page into the requested direction on the which trigger the form's controller to page into the requested direction on the
client side. client side.
A use case could be the case of a validation flow. As a developer, you set up a tree view with a domain on records to be validated. The user opens the first record in a form view and validates the record. The validation method returns the 'next' action type so that the browser window of the user is presented with the next record in the form view.
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/162/10.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/web/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
* Stefan Rijnhart <stefan@opener.amsterdam>
Do not contact contributors directly about support or help with technical issues.
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

View File

@ -1,31 +1,20 @@
# -*- coding: utf-8 -*- # coding: utf-8
############################################################################## # © 2013-2015 Therp BV (<http://therp.nl>)
# # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{ {
"name": "Window actions for client side paging", "name": "Window actions for client side paging",
"summary": ("Allows a developer to trigger a pager to show the previous " "summary": ("Allows a developer to trigger a pager to show the previous "
"or next next record in the form view"), "or next next record in the form view"),
"version": "8.0.1.0.0",
"author": "Therp BV,Odoo Community Association (OCA)", "author": "Therp BV,Odoo Community Association (OCA)",
"category": "Dependency", "version": "10.0.1.0.0",
"depends": ['web'], "category": "Technical",
'data': ['view/qweb.xml'], "depends": [
'installable': False, 'web',
],
'data': [
'views/assets.xml',
],
'installable': True,
'license': 'AGPL-3',
'url': 'https://github.com/oca/web',
} }

View File

@ -1,34 +1,16 @@
//-*- coding: utf-8 -*- // coding: utf-8
//############################################################################ // © 2013-2015 Therp BV (<http://therp.nl>)
// // License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
// OpenERP, Open Source Management Solution odoo.define('web.ir_actions_act_window_page', function(require) {
// This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>).
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//############################################################################
openerp.web_ir_actions_act_window_page = function(instance) var ActionManager = require('web.ActionManager');
{ ActionManager.include({
instance.web.ActionManager.include({
ir_actions_act_window_page_prev: function(action, options) ir_actions_act_window_page_prev: function(action, options)
{ {
if(this.inner_widget && this.inner_widget.active_view == 'form' && if(this.inner_widget && this.inner_widget.active_view.type == 'form' &&
this.inner_widget.views[this.inner_widget.active_view]) this.inner_widget.active_view)
{ {
this.inner_widget.views[this.inner_widget.active_view] this.inner_widget.active_view.controller.pager.previous();
.controller.execute_pager_action('previous');
} }
if(options && options.on_close) if(options && options.on_close)
{ {
@ -37,11 +19,10 @@ openerp.web_ir_actions_act_window_page = function(instance)
}, },
ir_actions_act_window_page_next: function(action, options) ir_actions_act_window_page_next: function(action, options)
{ {
if(this.inner_widget && this.inner_widget.active_view == 'form' && if(this.inner_widget && this.inner_widget.active_view.type == 'form' &&
this.inner_widget.views[this.inner_widget.active_view]) this.inner_widget.active_view)
{ {
this.inner_widget.views[this.inner_widget.active_view] this.inner_widget.active_view.controller.pager.next();
.controller.execute_pager_action('next');
} }
if(options && options.on_close) if(options && options.on_close)
{ {
@ -49,4 +30,4 @@ openerp.web_ir_actions_act_window_page = function(instance)
} }
}, },
}); });
} });

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="assets_backend"
name="web_ir_actions_act_window_page assets"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript"
src="/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js"></script>
</xpath>
</template>
</data>
</openerp>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="assets_backend"
name="web_ir_actions_act_window_page assets"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript"
src="/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js"></script>
</xpath>
</template>
</odoo>