Browse Source
Merge pull request #729 from StefanRijnhart/10.0/web_ir_actions_act_window_page
Merge pull request #729 from StefanRijnhart/10.0/web_ir_actions_act_window_page
[MIG][10.0] web ir actions act window pagepull/730/head
Pedro M. Baeza
7 years ago
committed by
GitHub
6 changed files with 139 additions and 70 deletions
-
55web_ir_actions_act_window_page/README.md
-
42web_ir_actions_act_window_page/__manifest__.py
-
35web_ir_actions_act_window_page/demo/demo_action.xml
-
53web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js
-
13web_ir_actions_act_window_page/view/qweb.xml
-
11web_ir_actions_act_window_page/views/assets.xml
@ -1,31 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# 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/>. |
|||
# |
|||
############################################################################## |
|||
# coding: utf-8 |
|||
# © 2013-2015 Therp BV (<http://therp.nl>) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) |
|||
{ |
|||
"name": "Window actions for client side paging", |
|||
"summary": ("Allows a developer to trigger a pager to show the previous " |
|||
"or next next record in the form view"), |
|||
"version": "8.0.1.0.0", |
|||
"author": "Therp BV,Odoo Community Association (OCA)", |
|||
"category": "Dependency", |
|||
"depends": ['web'], |
|||
'data': ['view/qweb.xml'], |
|||
'installable': False, |
|||
"version": "10.0.1.0.0", |
|||
"category": "Technical", |
|||
"depends": [ |
|||
'web', |
|||
], |
|||
'data': [ |
|||
'views/assets.xml', |
|||
], |
|||
'demo': [ |
|||
'demo/demo_action.xml', |
|||
], |
|||
'installable': True, |
|||
'license': 'AGPL-3', |
|||
'url': 'https://github.com/oca/web', |
|||
} |
@ -0,0 +1,35 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
|
|||
<record model="ir.actions.server" id="demo_pager_previous"> |
|||
<field name="name">Previous partner</field> |
|||
<field name="model_id" ref="base.model_res_partner"/> |
|||
<field name="code">action = {"type": "ir_actions_act_window_page_prev"}</field> |
|||
</record> |
|||
|
|||
<record model="ir.actions.server" id="demo_pager_next"> |
|||
<field name="name">Next partner</field> |
|||
<field name="model_id" ref="base.model_res_partner"/> |
|||
<field name="code">action = {"type": "ir_actions_act_window_page_next"}</field> |
|||
</record> |
|||
|
|||
<!-- Adding some redundant buttons to the partner form so that this module can be tested on runbot. |
|||
You might be more interested in returning this action type from a method in your code. --> |
|||
<record id="view_partner_form" model="ir.ui.view"> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_form"/> |
|||
<field name="arch" type="xml"> |
|||
<div class="oe_button_box" position="inside"> |
|||
<button name="%(web_ir_actions_act_window_page.demo_pager_previous)d" |
|||
type="action" string="Previous Partner" |
|||
icon="fa-arrow-left" |
|||
class="oe_stat_button"/> |
|||
<button name="%(web_ir_actions_act_window_page.demo_pager_next)d" |
|||
type="action" string="Next Partner" |
|||
icon="fa-arrow-right" |
|||
class="oe_stat_button"/> |
|||
</div> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -1,44 +1,33 @@ |
|||
//-*- coding: utf-8 -*-
|
|||
//############################################################################
|
|||
//
|
|||
// 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/>.
|
|||
//
|
|||
//############################################################################
|
|||
// coding: utf-8
|
|||
// © 2013-2015 Therp BV (<http://therp.nl>)
|
|||
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
|||
odoo.define('web.ir_actions_act_window_page', function(require) { |
|||
|
|||
openerp.web_ir_actions_act_window_page = function(instance) |
|||
{ |
|||
instance.web.ActionManager.include({ |
|||
var ActionManager = require('web.ActionManager'); |
|||
ActionManager.include({ |
|||
ir_actions_act_window_page_prev: function(action, options) |
|||
{ |
|||
if(this.inner_widget && this.inner_widget.active_view == 'form' && |
|||
this.inner_widget.views[this.inner_widget.active_view]) |
|||
if(this.inner_widget && this.inner_widget.active_view.type == 'form' && |
|||
this.inner_widget.active_view) |
|||
{ |
|||
this.inner_widget.views[this.inner_widget.active_view] |
|||
.controller.execute_pager_action('previous'); |
|||
this.inner_widget.active_view.controller.pager.previous(); |
|||
} |
|||
if(options && options.on_close) |
|||
{ |
|||
options.on_close(); |
|||
} |
|||
}, |
|||
ir_actions_act_window_page_next: function(action, options) |
|||
{ |
|||
if(this.inner_widget && this.inner_widget.active_view == 'form' && |
|||
this.inner_widget.views[this.inner_widget.active_view]) |
|||
if(this.inner_widget && this.inner_widget.active_view.type == 'form' && |
|||
this.inner_widget.active_view) |
|||
{ |
|||
this.inner_widget.active_view.controller.pager.next(); |
|||
} |
|||
if(options && options.on_close) |
|||
{ |
|||
this.inner_widget.views[this.inner_widget.active_view] |
|||
.controller.execute_pager_action('next'); |
|||
options.on_close(); |
|||
} |
|||
}, |
|||
}); |
|||
} |
|||
}); |
@ -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> |
@ -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> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue