diff --git a/web_dashboard_open_action/README.rst b/web_dashboard_open_action/README.rst new file mode 100644 index 00000000..2f5b935a --- /dev/null +++ b/web_dashboard_open_action/README.rst @@ -0,0 +1,39 @@ +Open a dashboard's action +========================= + +This module adds a button to open a dashboard's action in the usual view, thus enabling filtering and any other actions you can apply on the resulting records. Basically, this is the inverso to `Add to dashboard`. + +Usage +===== + +After installation, a dashboard has a `Maximize`-button that loads the dashboard's action in a normal view. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + + +Credits +======= + +Contributors +------------ + +* Holger Brunn + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://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 http://odoo-community.org. diff --git a/web_dashboard_open_action/__init__.py b/web_dashboard_open_action/__init__.py new file mode 100644 index 00000000..faef9dac --- /dev/null +++ b/web_dashboard_open_action/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## diff --git a/web_dashboard_open_action/__openerp__.py b/web_dashboard_open_action/__openerp__.py new file mode 100644 index 00000000..96ba7620 --- /dev/null +++ b/web_dashboard_open_action/__openerp__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## +{ + "name": "Open a dashboard's action", + "version": "1.0", + "author": "Therp BV,Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Hidden", + "summary": "Adds a button to open a dashboard in full mode", + "depends": [ + 'board', + ], + "data": [ + 'views/templates.xml', + ], + "qweb": [ + 'static/src/xml/web_dashboard_open_action.xml', + ], + "test": [ + ], + "auto_install": False, + "installable": True, + "application": False, + "external_dependencies": { + 'python': [], + }, +} diff --git a/web_dashboard_open_action/static/description/icon.png b/web_dashboard_open_action/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_dashboard_open_action/static/description/icon.png differ diff --git a/web_dashboard_open_action/static/src/css/web_dashboard_open_action.css b/web_dashboard_open_action/static/src/css/web_dashboard_open_action.css new file mode 100644 index 00000000..e395efdc --- /dev/null +++ b/web_dashboard_open_action/static/src/css/web_dashboard_open_action.css @@ -0,0 +1,7 @@ +.openerp .oe_dashboard .oe_action span.oe_web_dashboard_open_action:before +{ + font-size: 10px; + margin-left: 4px; + position: relative; + top: -1px; +} diff --git a/web_dashboard_open_action/static/src/js/web_dashboard_open_action.js b/web_dashboard_open_action/static/src/js/web_dashboard_open_action.js new file mode 100644 index 00000000..ab4b0a8c --- /dev/null +++ b/web_dashboard_open_action/static/src/js/web_dashboard_open_action.js @@ -0,0 +1,44 @@ +//-*- coding: utf-8 -*- +//############################################################################ +// +// OpenERP, Open Source Management Solution +// This module copyright (C) 2015 Therp BV . +// +// 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 . +// +//############################################################################ + +openerp.web_dashboard_open_action = function(instance) +{ + instance.web.form.DashBoard.include({ + on_load_action: function(result, index, action_attrs) + { + var self = this, action = _.extend({flags: {}}, result); + action.context_string = action_attrs.context; + action.context = instance.web.pyeval.eval( + 'context', action_attrs.context || {}); + action.domain_string = action_attrs.domain; + action.domain = instance.web.pyeval.eval( + 'domain', action_attrs.domain || [], action_attrs.context); + jQuery('#' + this.view.element_id + '_action_' + index) + .parent() + .find('.oe_web_dashboard_open_action') + .click(function() + { + self.do_action(action); + }); + return this._super.apply(this, arguments); + }, + }); +} diff --git a/web_dashboard_open_action/static/src/xml/web_dashboard_open_action.xml b/web_dashboard_open_action/static/src/xml/web_dashboard_open_action.xml new file mode 100644 index 00000000..358c2153 --- /dev/null +++ b/web_dashboard_open_action/static/src/xml/web_dashboard_open_action.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/web_dashboard_open_action/views/templates.xml b/web_dashboard_open_action/views/templates.xml new file mode 100644 index 00000000..625bf50a --- /dev/null +++ b/web_dashboard_open_action/views/templates.xml @@ -0,0 +1,11 @@ + + + + + +