Browse Source

[ADD] web_ir_actions_act_window_message

pull/99/head
Holger Brunn 10 years ago
parent
commit
d472033565
  1. 50
      web_ir_actions_act_window_message/README.rst
  2. 20
      web_ir_actions_act_window_message/__init__.py
  3. 43
      web_ir_actions_act_window_message/__openerp__.py
  4. BIN
      web_ir_actions_act_window_message/static/description/icon.png
  5. 50
      web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js
  6. 5
      web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml
  7. 10
      web_ir_actions_act_window_message/views/templates.xml

50
web_ir_actions_act_window_message/README.rst

@ -0,0 +1,50 @@
Client side message boxes
=========================
This module allows to show a message popup on the client side as result of a button.
Usage
=====
Depend on this module and return
.. code:: python
{
'type': 'ir.actions.act_window.message',
'title': 'My title',
'message': 'My message'
}
You are responsible for translating the messages.
* https://www.odoo.com/forum/help-1
Known issues / Roadmap
======================
* add `message_type` to differenciate between warnings, errors, etc.
* have one `message_type` to show a nonmodal warning on top right
* have `button_title` to set the button title
* have `buttons` containing button names and action definitions for triggering actions from the message box
Credits
=======
Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
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.

20
web_ir_actions_act_window_message/__init__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 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/>.
#
##############################################################################

43
web_ir_actions_act_window_message/__openerp__.py

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 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/>.
#
##############################################################################
{
"name": "Client side message boxes",
"version": "1.0",
"author": "Therp BV",
"license": "AGPL-3",
"category": "Hidden/Dependency",
"summary": "Show a warning to users",
"depends": [
'web',
],
"data": [
'views/templates.xml',
],
"qweb": [
'static/src/xml/web_ir_actions_act_window_message.xml',
],
"auto_install": False,
"installable": True,
"application": False,
"external_dependencies": {
'python': [],
},
}

BIN
web_ir_actions_act_window_message/static/description/icon.png

After

Width: 80  |  Height: 80  |  Size: 2.0 KiB

50
web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js

@ -0,0 +1,50 @@
//-*- coding: utf-8 -*-
//############################################################################
//
// OpenERP, Open Source Management Solution
// This module copyright (C) 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/>.
//
//############################################################################
openerp.web_ir_actions_act_window_message = function(instance)
{
instance.web.ActionManager.include({
ir_actions_act_window_message: function(action, options)
{
var dialog = new instance.web.Dialog(
this,
{
size: 'medium',
title: action.title,
buttons: [
{
text: instance.web._t('Close'),
click: function() { dialog.close() },
oe_link_class: 'oe_highlight',
},
],
},
jQuery(instance.web.qweb.render(
'web_ir_actions_act_window_message',
{
'this': this,
'action': action,
}))
)
return dialog.open();
},
});
}

5
web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml

@ -0,0 +1,5 @@
<templates>
<div t-name="web_ir_actions_act_window_message">
<div><t t-esc="action.message" /></div>
</div>
</templates>

10
web_ir_actions_act_window_message/views/templates.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="assets_backend" name="web_ir_actions_act_window_message assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save