diff --git a/help_contextual_popup/__init__.py b/help_contextual_popup/__init__.py index 9186ee3a..14e0972c 100644 --- a/help_contextual_popup/__init__.py +++ b/help_contextual_popup/__init__.py @@ -1 +1,2 @@ from . import model +from . import controller diff --git a/help_contextual_popup/controller.py b/help_contextual_popup/controller.py new file mode 100644 index 00000000..e3b00d91 --- /dev/null +++ b/help_contextual_popup/controller.py @@ -0,0 +1,43 @@ +# coding: utf-8 +############################################################################## +# +# Odoo, Open Source Management Solution +# Copyright (C) 2015-TODAY Akretion (). +# +# 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 . +# +############################################################################## + +from openerp.http import Controller, route, request + + +class MyController(Controller): + @route([ + "/help/", + ], type='http', auth="public") + def handler(self, action_id, *args, **kwargs): + req = request.session.model('ir.actions.act_window') + return 'blabla %s db %s' % (action_id, req) + + def _get_html_tpl(self): + return """ + + {{title}} + {{head}} + + +

{{h1}}

+{{body}} + +""" diff --git a/help_contextual_popup/model.py b/help_contextual_popup/model.py index fa42b452..f3b8f93e 100644 --- a/help_contextual_popup/model.py +++ b/help_contextual_popup/model.py @@ -20,7 +20,6 @@ ############################################################################## from openerp import models, fields -from openerp.http import Controller, route class IrActionsActwindow(models.Model): @@ -29,9 +28,3 @@ class IrActionsActwindow(models.Model): custom_help = fields.Text( string="Custom Help", help="Use this field to add custom content for documentation purpose") - - -class MyController(Controller): - @route('/help', auth='public') - def handler(self): - return 'blabla' diff --git a/help_contextual_popup/static/src/js/popup_help.js b/help_contextual_popup/static/src/js/popup_help.js index 09e38888..7ab4ed59 100644 --- a/help_contextual_popup/static/src/js/popup_help.js +++ b/help_contextual_popup/static/src/js/popup_help.js @@ -12,29 +12,13 @@ openerp.help_contextual_popup = function(instance, local) { return true; } $elem.data('click-init', true); - - var help_html = ''; - help_html += '' - help_html += '→ Exemple ←' - if (self.action.help) { - help_html += '

Odoo Help

' - help_html += '
' + self.action.help + '
'; - } - if (self.action.custom_help) { - help_html += '

Specific Help

' - help_html += '
' + self.action.custom_help + '
' - } - $elem.on('click', function(e) { - - new instance.web.Dialog(self, { - size: 'medium', - title: _t("Help: ") + self.action.name, - buttons: [ - {text: _t("Ok"), click: function() { this.parents('.modal').modal('hide');}} - ] - }, help_html).open(); // self.action.res_model + var params = 'height=400, width=600, location=no, '; + params += 'resizable=yes, menubar=yes, titlebar=Bla'; + path = self.action.id; + my_window = window.open('/help/' + path, 'Help', params); + // allows to back to the window if opened previoulsy + setTimeout('my_window.focus()', 1); }); return true;