Browse Source

Merge pull request #349 from initOS/8.0-ADD-web_offline_warning

[ADD] add module web_offline_warning
pull/376/head
Sylvain LE GAL 9 years ago
committed by GitHub
parent
commit
e40fab3991
  1. 39
      web_offline_warning/README.rst
  2. 3
      web_offline_warning/__init__.py
  3. 19
      web_offline_warning/__openerp__.py
  4. 38
      web_offline_warning/i18n/de.po
  5. 38
      web_offline_warning/i18n/web_offline_warning.pot
  6. 28
      web_offline_warning/static/src/js/web_offline_warning.js
  7. 13
      web_offline_warning/views/assets.xml

39
web_offline_warning/README.rst

@ -0,0 +1,39 @@
Offline warning message
=======================
This module replaces the default error message when the server cannot be reached by a more user-friendly warning message.
Usage
=====
When an RPC call from the browser fails with a generic error message, a warning message is shown to inform the user that the server cannot be reached.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/web/issues/new?body=module:%20web_offline_warning%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Thomas Rehn <thomas.rehn@initos.com>
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.

3
web_offline_warning/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Thomas Rehn (initOS GmbH)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

19
web_offline_warning/__openerp__.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# © 2016 Thomas Rehn (initOS GmbH)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'User-friendly Offline Warning',
'version': '8.0.1.0.0',
'author': 'initOS GmbH, Odoo Community Association (OCA)',
'depends': [
'web',
],
'data': [
'views/assets.xml',
],
'description': "",
'test': [],
'installable': True,
'auto_install': False,
'license': 'AGPL-3',
}

38
web_offline_warning/i18n/de.po

@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_offline_warning
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-17 15:08+0000\n"
"PO-Revision-Date: 2016-03-17 15:08+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_offline_warning
#. openerp-web
#: code:addons/web_offline_warning/static/src/js/web_offline_warning.js:20
#, python-format
msgid "Ok"
msgstr "Ok"
#. module: web_offline_warning
#. openerp-web
#: code:addons/web_offline_warning/static/src/js/web_offline_warning.js:23
#, python-format
msgid "The server cannot be reached. You are probably offline."
msgstr "Der Server kann momentan nicht erreicht werden. Sie sind wahrscheinlich offline."
#. module: web_offline_warning
#. openerp-web
#: code:addons/web_offline_warning/static/src/js/web_offline_warning.js:18
#, python-format
msgid "Warning"
msgstr "Warnung"

38
web_offline_warning/i18n/web_offline_warning.pot

@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_offline_warning
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-17 15:08+0000\n"
"PO-Revision-Date: 2016-03-17 15:08+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_offline_warning
#. openerp-web
#: code:addons/web_offline_warning/static/src/js/web_offline_warning.js:20
#, python-format
msgid "Ok"
msgstr ""
#. module: web_offline_warning
#. openerp-web
#: code:addons/web_offline_warning/static/src/js/web_offline_warning.js:23
#, python-format
msgid "The server cannot be reached. You are probably offline."
msgstr ""
#. module: web_offline_warning
#. openerp-web
#: code:addons/web_offline_warning/static/src/js/web_offline_warning.js:18
#, python-format
msgid "Warning"
msgstr ""

28
web_offline_warning/static/src/js/web_offline_warning.js

@ -0,0 +1,28 @@
openerp.web_offline_warning = function(openerp) {
var _t = openerp.web._t;
var QWeb = openerp.web.qweb;
/**
* Handle general XmlHttpRequestErrors, which occur when the server cannot be reached.
*/
openerp.web.GenericXmlHttpRequestErrorHandler = openerp.web.Dialog.extend(openerp.web.ExceptionHandler, {
init: function(parent, error) {
this._super(parent);
this.error = error;
},
display: function() {
var self = this;
new openerp.web.Dialog(this, {
size: 'medium',
title: "Odoo " + _t("Warning"),
buttons: [
{text: _t("Ok"), click: function() { self.$el.parents('.modal').modal('hide'); self.destroy();}}
],
}, QWeb.render('CrashManager.warning',
{message: _t("The server cannot be reached. You are probably offline.")})
).open();
}
});
openerp.web.crash_manager_registry.add(void(0), 'openerp.web.GenericXmlHttpRequestErrorHandler');
}

13
web_offline_warning/views/assets.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- © 2016 Thomas Rehn (initOS GmbH)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp>
<data>
<template id="assets_backend" name="web_offline_warning assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_offline_warning/static/src/js/web_offline_warning.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save