Skip to content

Commit

Permalink
[MIG] web_ir_actions_act_window_message: Migration to 10. Also added …
Browse files Browse the repository at this point in the history
…HTML handling
  • Loading branch information
benwillig committed May 23, 2017
1 parent b853cc7 commit ef4acaf
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
1 change: 1 addition & 0 deletions setup/web_ir_actions_act_window_message/odoo/__init__.py
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
6 changes: 6 additions & 0 deletions setup/web_ir_actions_act_window_message/setup.py
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
5 changes: 4 additions & 1 deletion web_ir_actions_act_window_message/README.rst
Expand Up @@ -19,6 +19,8 @@ Depend on this module and return
# you can create your own close button with an action of type
# ir.actions.act_window_close
'close_button_title': 'Make this window go away',
# Use HTML instead of text
'is_html_message': True,
# this is an optional list of buttons to show
'buttons': [
# a button can be any action (also ir.actions.report.xml et al)
Expand Down Expand Up @@ -73,6 +75,7 @@ Contributors

* Holger Brunn <hbrunn@therp.nl>
* Zakaria Makrelouf (ACSONE SA/NV) <z.makrelouf@gmail.com>
* Benjamin Willig (ACSONE SA/NV) <benjamin.willig@acsone.eu>

Maintainer
----------
Expand All @@ -85,4 +88,4 @@ 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.
To contribute to this module, please visit http://odoo-community.org.
2 changes: 1 addition & 1 deletion web_ir_actions_act_window_message/__manifest__.py
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Client side message boxes",
"version": "9.0.1.0.0",
"version": "10.0.1.0.0",
"author": "Therp BV, "
"ACSONE SA/NV, "
"Odoo Community Association (OCA)",
Expand Down
Expand Up @@ -7,7 +7,6 @@ odoo.define('web.web_ir_actions_act_window_message', function(require)

var ActionManager = require('web.ActionManager'),
core = require('web.core'),
_ = require('_'),
Model = require('web.Model'),
Dialog = require('web.Dialog');

Expand All @@ -33,20 +32,29 @@ odoo.define('web.web_ir_actions_act_window_message', function(require)
})
}

var is_html = action.is_html_message === true;
var content_properties = {};

if (is_html) {
content_properties = {
html: action.message,
};
} else {
content_properties = {
text: action.message,
css: {
'white-space': 'pre-line',
}
};
}

var dialog = new Dialog(
this,
_.extend(
{
size: 'medium',
title: action.title,
$content: $('<div>',
{
text: action.message,
css: {
'white-space': 'pre-line',
}
}
),
$content: $('<div>', content_properties),
buttons: buttons.concat(
this.ir_actions_act_window_message_get_buttons(
action, function() { dialog.close() })
Expand Down

0 comments on commit ef4acaf

Please sign in to comment.