Browse Source

Merge pull request #611 from acsone/9.0-mig-web_ir_actions_act_window_message_zak

[9.0][MIG]web_ir_actions_act_window_message: Migration to V9
pull/554/merge
Stéphane Bidoul (ACSONE) 7 years ago
committed by GitHub
parent
commit
387d05c426
  1. 1
      setup/web_ir_actions_act_window_message/odoo_addons/__init__.py
  2. 1
      setup/web_ir_actions_act_window_message/odoo_addons/web_ir_actions_act_window_message
  3. 6
      setup/web_ir_actions_act_window_message/setup.py
  4. 34
      web_ir_actions_act_window_message/README.rst
  5. 20
      web_ir_actions_act_window_message/__init__.py
  6. 30
      web_ir_actions_act_window_message/__openerp__.py
  7. 25
      web_ir_actions_act_window_message/i18n/ar.po
  8. 26
      web_ir_actions_act_window_message/i18n/de.po
  9. 26
      web_ir_actions_act_window_message/i18n/es.po
  10. 25
      web_ir_actions_act_window_message/i18n/eu.po
  11. 25
      web_ir_actions_act_window_message/i18n/fi.po
  12. 25
      web_ir_actions_act_window_message/i18n/fr.po
  13. 25
      web_ir_actions_act_window_message/i18n/hr.po
  14. 25
      web_ir_actions_act_window_message/i18n/it.po
  15. 25
      web_ir_actions_act_window_message/i18n/nl.po
  16. 25
      web_ir_actions_act_window_message/i18n/pt_BR.po
  17. 25
      web_ir_actions_act_window_message/i18n/sl.po
  18. 25
      web_ir_actions_act_window_message/i18n/tr.po
  19. 128
      web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js
  20. 23
      web_ir_actions_act_window_message/views/templates.xml

1
setup/web_ir_actions_act_window_message/odoo_addons/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/web_ir_actions_act_window_message/odoo_addons/web_ir_actions_act_window_message

@ -0,0 +1 @@
../../../web_ir_actions_act_window_message

6
setup/web_ir_actions_act_window_message/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

34
web_ir_actions_act_window_message/README.rst

@ -14,6 +14,37 @@ Depend on this module and return
'type': 'ir.actions.act_window.message',
'title': _('My title'),
'message': _('My message'),
# optional title of the close button, if not set, will be _('Close')
# if set False, no close button will be shown
# 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',
# this is an optional list of buttons to show
'buttons': [
# a button can be any action (also ir.actions.report.xml et al)
{
'type': 'ir.actions.act_window',
'name': 'All customers',
'res_model': 'res.partner',
'view_mode': 'form',
'views': [[False, 'list'], [False, 'form']],
'domain': [('customer', '=', True)],
},
# or if type == method, you need to pass a model, a method name and
# parameters
{
'type': 'method',
'name': _('Yes, do it'),
'model': self._name,
'method': 'myfunction',
# list of arguments to pass positionally
'args': [self.ids],
# dictionary of keyword arguments
'kwargs': {'force': True},
# button style
'classes': 'btn-primary',
}
]
}
You are responsible for translating the messages.
@ -23,8 +54,6 @@ 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
Bug Tracker
@ -43,6 +72,7 @@ Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
* Zakaria Makrelouf (ACSONE SA/NV) <z.makrelouf@gmail.com>
Maintainer
----------

20
web_ir_actions_act_window_message/__init__.py

@ -1,20 +0,0 @@
# -*- 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/>.
#
##############################################################################

30
web_ir_actions_act_window_message/__openerp__.py

@ -1,27 +1,11 @@
# -*- 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/>.
#
##############################################################################
# Copyright 2017 Therp BV, ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Client side message boxes",
"version": "8.0.1.0.0",
"version": "9.0.1.0.0",
"author": "Therp BV, "
"ACSONE SA/NV, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Hidden/Dependency",
@ -35,10 +19,4 @@
"qweb": [
'static/src/xml/web_ir_actions_act_window_message.xml',
],
"auto_install": False,
'installable': False,
"application": False,
"external_dependencies": {
'python': [],
},
}

25
web_ir_actions_act_window_message/i18n/ar.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-16 07:41+0000\n"
"PO-Revision-Date: 2015-11-07 11:20+0000\n"
"Last-Translator: <>\n"
"Language-Team: Arabic (http://www.transifex.com/oca/OCA-web-8-0/language/ar/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ar\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "إغلاق"

26
web_ir_actions_act_window_message/i18n/de.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
"PO-Revision-Date: 2016-01-18 20:15+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-web-8-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Schließen"

26
web_ir_actions_act_window_message/i18n/es.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
# Antonio Trueba, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
"PO-Revision-Date: 2016-02-10 16:40+0000\n"
"Last-Translator: Antonio Trueba\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-web-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Cerrar"

25
web_ir_actions_act_window_message/i18n/eu.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-18 09:01+0000\n"
"PO-Revision-Date: 2015-11-07 11:20+0000\n"
"Last-Translator: <>\n"
"Language-Team: Basque (http://www.transifex.com/oca/OCA-web-8-0/language/eu/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: eu\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Itxi"

25
web_ir_actions_act_window_message/i18n/fi.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
"PO-Revision-Date: 2015-11-07 11:20+0000\n"
"Last-Translator: <>\n"
"Language-Team: Finnish (http://www.transifex.com/oca/OCA-web-8-0/language/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Sulje"

25
web_ir_actions_act_window_message/i18n/fr.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
"PO-Revision-Date: 2015-11-07 11:20+0000\n"
"Last-Translator: <>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-web-8-0/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Fermer"

25
web_ir_actions_act_window_message/i18n/hr.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-24 00:46+0000\n"
"PO-Revision-Date: 2015-11-07 11:20+0000\n"
"Last-Translator: <>\n"
"Language-Team: Croatian (http://www.transifex.com/oca/OCA-web-8-0/language/hr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: hr\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Zatvori"

25
web_ir_actions_act_window_message/i18n/it.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-17 07:29+0000\n"
"PO-Revision-Date: 2015-11-07 11:20+0000\n"
"Last-Translator: <>\n"
"Language-Team: Italian (http://www.transifex.com/oca/OCA-web-8-0/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Chiudi"

25
web_ir_actions_act_window_message/i18n/nl.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-21 08:52+0000\n"
"PO-Revision-Date: 2015-11-07 11:20+0000\n"
"Last-Translator: <>\n"
"Language-Team: Dutch (http://www.transifex.com/oca/OCA-web-8-0/language/nl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Sluiten"

25
web_ir_actions_act_window_message/i18n/pt_BR.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-11 02:17+0000\n"
"PO-Revision-Date: 2016-03-05 16:20+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-web-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Fechar"

25
web_ir_actions_act_window_message/i18n/sl.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
"PO-Revision-Date: 2015-11-08 05:45+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-web-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Zaključi"

25
web_ir_actions_act_window_message/i18n/tr.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-08 21:34+0000\n"
"PO-Revision-Date: 2015-12-30 22:16+0000\n"
"Last-Translator: Ahmet Altınışık <aaltinisik@altinkaya.com.tr>\n"
"Language-Team: Turkish (http://www.transifex.com/oca/OCA-web-8-0/language/tr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: tr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:34
#, python-format
msgid "Close"
msgstr "Kapat"

128
web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js

@ -1,50 +1,98 @@
//-*- 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/>.
//
//############################################################################
/* Copyright 2017 Therp BV, ACSONE SA/NV
* * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
openerp.web_ir_actions_act_window_message = function(instance)
odoo.define('web.web_ir_actions_act_window_message', function(require)
{
instance.web.ActionManager.include({
"use strict";
var ActionManager = require('web.ActionManager'),
core = require('web.core'),
_ = require('_'),
Model = require('web.Model'),
Dialog = require('web.Dialog');
var _t = core._t;
ActionManager.include({
ir_actions_act_window_message: function(action, options)
{
var dialog = new instance.web.Dialog(
var self = this,
buttons = [];
if(action.close_button_title !== false)
{
buttons.push({
text: action.close_button_title || _t('Close'),
click: function() {
// refresh the view before closing the dialog
self.inner_widget.active_view
.controller.recursive_reload();
dialog.close()
},
classes: 'btn-default',
})
}
var dialog = new 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',
_.extend(
{
'this': this,
'action': action,
}))
size: 'medium',
title: action.title,
$content: $('<div>',
{
text: action.message,
css: {
'white-space': 'pre-line',
}
}
),
buttons: buttons.concat(
this.ir_actions_act_window_message_get_buttons(
action, function() { dialog.close() })
),
},
options)
)
return dialog.open();
},
ir_actions_act_window_message_get_buttons: function(action, close_func)
{
// return an array of button definitions from action
var self = this;
return _.map(action.buttons || [], function(button_definition)
{
return {
text: button_definition.name || 'No name set',
classes: button_definition.classes || 'btn-default',
click: function() {
if(button_definition.type == 'method')
{
(new Model(button_definition.model))
.call(
button_definition.method,
button_definition.args,
button_definition.kwargs
).then(function(result)
{
if(_.isObject(result))
{
self.do_action(result);
}
// always refresh the view after the action
// ex: action updates a status
self.inner_widget.active_view
.controller.recursive_reload();
});
}
else
{
self.do_action(button_definition);
}
close_func();
},
}
});
},
});
}
});

23
web_ir_actions_act_window_message/views/templates.xml

@ -1,10 +1,13 @@
<?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>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Therp BV, ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<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>
</odoo>
Loading…
Cancel
Save