mirror of https://github.com/OCA/web.git
[FIX] switch to external popup
parent
324cf5f27a
commit
5c30b488a6
|
@ -1 +1,2 @@
|
||||||
from . import model
|
from . import model
|
||||||
|
from . import controller
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
# coding: utf-8
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Odoo, Open Source Management Solution
|
||||||
|
# Copyright (C) 2015-TODAY Akretion (<http://www.akretion.com>).
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
from openerp.http import Controller, route, request
|
||||||
|
|
||||||
|
|
||||||
|
class MyController(Controller):
|
||||||
|
@route([
|
||||||
|
"/help/<int:action_id>",
|
||||||
|
], 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 """<html>
|
||||||
|
<head>
|
||||||
|
<title>{{title}}</title>
|
||||||
|
{{head}}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>{{h1}}</h1>
|
||||||
|
{{body}}
|
||||||
|
</body>
|
||||||
|
</html>"""
|
|
@ -20,7 +20,6 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp import models, fields
|
from openerp import models, fields
|
||||||
from openerp.http import Controller, route
|
|
||||||
|
|
||||||
|
|
||||||
class IrActionsActwindow(models.Model):
|
class IrActionsActwindow(models.Model):
|
||||||
|
@ -29,9 +28,3 @@ class IrActionsActwindow(models.Model):
|
||||||
custom_help = fields.Text(
|
custom_help = fields.Text(
|
||||||
string="Custom Help",
|
string="Custom Help",
|
||||||
help="Use this field to add custom content for documentation purpose")
|
help="Use this field to add custom content for documentation purpose")
|
||||||
|
|
||||||
|
|
||||||
class MyController(Controller):
|
|
||||||
@route('/help', auth='public')
|
|
||||||
def handler(self):
|
|
||||||
return 'blabla'
|
|
||||||
|
|
|
@ -12,29 +12,13 @@ openerp.help_contextual_popup = function(instance, local) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$elem.data('click-init', true);
|
$elem.data('click-init', true);
|
||||||
|
|
||||||
var help_html = '';
|
|
||||||
help_html += '<a href="http://localhost:8069/help" target="_blank" onclick="window.open(this.href,\'nom_Popup\','
|
|
||||||
help_html += '\'height=400 , width=400 , location=no , resizable=yes , scrollbars=no\');return false;">'
|
|
||||||
help_html += '→ Exemple ←</a>'
|
|
||||||
if (self.action.help) {
|
|
||||||
help_html += '<h3>Odoo Help</h3>'
|
|
||||||
help_html += '<div id="erp_help">' + self.action.help + '</div>';
|
|
||||||
}
|
|
||||||
if (self.action.custom_help) {
|
|
||||||
help_html += '<h3>Specific Help</h3>'
|
|
||||||
help_html += '<div id="custom_help">' + self.action.custom_help + '</div>'
|
|
||||||
}
|
|
||||||
|
|
||||||
$elem.on('click', function(e) {
|
$elem.on('click', function(e) {
|
||||||
|
var params = 'height=400, width=600, location=no, ';
|
||||||
new instance.web.Dialog(self, {
|
params += 'resizable=yes, menubar=yes, titlebar=Bla';
|
||||||
size: 'medium',
|
path = self.action.id;
|
||||||
title: _t("Help: ") + self.action.name,
|
my_window = window.open('/help/' + path, 'Help', params);
|
||||||
buttons: [
|
// allows to back to the window if opened previoulsy
|
||||||
{text: _t("Ok"), click: function() { this.parents('.modal').modal('hide');}}
|
setTimeout('my_window.focus()', 1);
|
||||||
]
|
|
||||||
}, help_html).open(); // self.action.res_model
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue