From d4720335651fd59793ee0810a07aa6decbdc437b Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 17 Mar 2015 13:16:07 +0100 Subject: [PATCH 1/2] [ADD] web_ir_actions_act_window_message --- web_ir_actions_act_window_message/README.rst | 50 ++++++++++++++++++ web_ir_actions_act_window_message/__init__.py | 20 +++++++ .../__openerp__.py | 43 +++++++++++++++ .../static/description/icon.png | Bin 0 -> 2034 bytes .../js/web_ir_actions_act_window_message.js | 50 ++++++++++++++++++ .../xml/web_ir_actions_act_window_message.xml | 5 ++ .../views/templates.xml | 10 ++++ 7 files changed, 178 insertions(+) create mode 100644 web_ir_actions_act_window_message/README.rst create mode 100644 web_ir_actions_act_window_message/__init__.py create mode 100644 web_ir_actions_act_window_message/__openerp__.py create mode 100644 web_ir_actions_act_window_message/static/description/icon.png create mode 100644 web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js create mode 100644 web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml create mode 100644 web_ir_actions_act_window_message/views/templates.xml diff --git a/web_ir_actions_act_window_message/README.rst b/web_ir_actions_act_window_message/README.rst new file mode 100644 index 00000000..58cf35af --- /dev/null +++ b/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 + +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. diff --git a/web_ir_actions_act_window_message/__init__.py b/web_ir_actions_act_window_message/__init__.py new file mode 100644 index 00000000..faef9dac --- /dev/null +++ b/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 . +# +# 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 . +# +############################################################################## diff --git a/web_ir_actions_act_window_message/__openerp__.py b/web_ir_actions_act_window_message/__openerp__.py new file mode 100644 index 00000000..98f67900 --- /dev/null +++ b/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 . +# +# 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 . +# +############################################################################## +{ + "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': [], + }, +} diff --git a/web_ir_actions_act_window_message/static/description/icon.png b/web_ir_actions_act_window_message/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..98965872769fff2e0a8aee1203260fcb8820eee6 GIT binary patch literal 2034 zcmVe zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00&x0L_t(|+U=WNOjB7Nz<;;B zEtI0TfK)(b(L`vKEGk6|8kI!N#P~7~#+eLHhKGI7#E;C&JZ!R08;QO-iI0LWeniDY zvl_q=i7^A3!9|n`5eOeCTd*y(x3~9e9}pPlL)3AVspps6^!D`RHu>e8^Z%d!X+azxH7w zk>KRXlLUi7%FD~CtE*$hiWS)Hb{ZQSaXOtWUAmNph6eij`Y0?cXd85tSj&Ye5-^zty@{PY}uj`7z%~(csw{94nm<2>FMd%?e_N*D9bXX zrKJ=U6p)vfM@dNuH*b=enaT9@G`+pO?A*DN^z?MPySv%8Z5w{SpUKHd z^78VCMx#iQL}OzkE|-hy>S~6EhtYMN#kPH1zI-{7Bw<+=d3kvYjzkGyXlUr~d3kx? z|K5E65Oj2O@bu|ZDk>`Q`Fwx+U=xi-i9{kBO9s$1jd(ncrfI^=TcRimx~|U%bT}Mu-1iB7jbRw5sw&n%5k!PQAy5bu2!V@J zU_2h@+O=yaih^ZXoH=s_VD6m2vaGp#(=@RxYp(70?q|7v{rX({Z#@Sf7z{EnFz{OY z?CaRr7=wd@pIo54P_`Y7MhS<*JbCg2kHTN|C7o$TJdn-?!$5DW&XtE;2FzMiV8 zDhdk=xqbUKUayx(B!bK3VtRTS!!Q^g9_HAwV*pG{OmOw;Rf>v=n4FwsU|@jS+FCAO zzD#LpDHRnJOifME)z!tzmoI5;ZDsrR?MzNiVwxr{my1v+#LAT`-&isJq$AL>EQ*VZ zX=`gEnM{(ClY^?N)YR0VC<;EGZ?2-eWy=;aGc%c(n4qGfV(wg_qN0L$JkF|Bt605y z_1v@Vb~}6b?xnZ4mv!sb;dDB2I-RJhipS#tAT2G8%F0ScMn>4NV+U@x8;{3BAP}Im zw3N-8H-A!j3ksBFnWCa1{C+=s_Uxgcpny%AHZeFjNLg7Ki9~{>OP9{cb~>GG*sy`o z(NWf{SwnGgF@ZpU{QP{}Zue^f%gV}VX=&lWfdh<>k5gV=K6g$Mi^TvaEG%SjaFAWQ zb`cB)$<58hZnslgTZ^J7jE#+b^6lsUwWQzL+RDht2>bT!BRe}grGm#tDe2eL)QB`j zAOs45Lg42hP?YrFF@5=ENk0~gkxV9qnYTny6f{knFX_A8Zp42?-X6=cNG6l>Q}}Iv z&Lx=lWm%R8A|eV4fq!n^xEHoelV@#h^#Ak|*gl-=bf=T*ufD>Sm6h58|0 z0M#%^7zVSa8J4DzwRJ0h*|m%Kvu7YlOx(DEJ~f3T%OFWunug?XfMsFnI=1xm*Ovgp zz(|p_>CI~(kkm9(O`98mW->|E?%njCJ`JWx{?}ilIUKC1uP4&ki5?D<`^6W8Zrvhn z`Er(Q-poLKJ?hvP(yTJ{FsAk4ES3XV+1~U`a+s>I-ydXS3t;(IOG}GwGDY^LAB+C}ep*^uY%;*b zix>YL4u@O!@86%Fk&z+F`wI{Xh2-}3_J18Ya^ye4hCm. +// +// 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 . +// +//############################################################################ + +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(); + }, + }); +} diff --git a/web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml b/web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml new file mode 100644 index 00000000..5f074229 --- /dev/null +++ b/web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml @@ -0,0 +1,5 @@ + +
+
+
+
diff --git a/web_ir_actions_act_window_message/views/templates.xml b/web_ir_actions_act_window_message/views/templates.xml new file mode 100644 index 00000000..9ba42b0b --- /dev/null +++ b/web_ir_actions_act_window_message/views/templates.xml @@ -0,0 +1,10 @@ + + + + + + From 0cdadecac42f3fdc772a4eed9a2b12b6713e0fee Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 18 Mar 2015 10:26:00 +0100 Subject: [PATCH 2/2] [IMP] better readme, manifest --- web_ir_actions_act_window_message/README.rst | 6 ++---- web_ir_actions_act_window_message/__openerp__.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/web_ir_actions_act_window_message/README.rst b/web_ir_actions_act_window_message/README.rst index 58cf35af..c6894712 100644 --- a/web_ir_actions_act_window_message/README.rst +++ b/web_ir_actions_act_window_message/README.rst @@ -12,14 +12,12 @@ Depend on this module and return { 'type': 'ir.actions.act_window.message', - 'title': 'My title', - 'message': 'My message' + 'title': _('My title'), + 'message': _('My message'), } You are responsible for translating the messages. -* https://www.odoo.com/forum/help-1 - Known issues / Roadmap ====================== diff --git a/web_ir_actions_act_window_message/__openerp__.py b/web_ir_actions_act_window_message/__openerp__.py index 98f67900..7cd5baae 100644 --- a/web_ir_actions_act_window_message/__openerp__.py +++ b/web_ir_actions_act_window_message/__openerp__.py @@ -24,7 +24,7 @@ "author": "Therp BV", "license": "AGPL-3", "category": "Hidden/Dependency", - "summary": "Show a warning to users", + "summary": "Show a message box to users", "depends": [ 'web', ],