diff --git a/.gitignore b/.gitignore
index 956ad554..016c9d99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,7 +49,7 @@ coverage.xml
# Translations
*.mo
-*.pot
+!*.pot
# Django stuff:
*.log
diff --git a/database_block/LICENSE b/database_block/LICENSE
new file mode 100755
index 00000000..42873c41
--- /dev/null
+++ b/database_block/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2020 IT-Projects LLC, Eugene Molotov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/database_block/README.rst b/database_block/README.rst
index 4119602a..54c4fcab 100644
--- a/database_block/README.rst
+++ b/database_block/README.rst
@@ -12,11 +12,15 @@
This technical module allows blocking backend access and display the message
-In order to do that, dependent module need to override ``ir.http`` 's session_info method and return
-dictionary with following keys:
+In order to do that, dependent module need to override ``ir.http`` 's ``session_info``
+method and return dictionary with following keys:
-* ``database_block_message`` - the displayed message itself. Can be HTML
-* ``database_block_is_warning`` - if true, backend is not blocked, but displayed message is shown as warning (``web_responsive`` must be installed in order for warning to be displayed)
+* ``database_block_message`` - this parameter record a text value, the displayed
+ message itself. Can be HTML, for example, **
Your database is blocked
**.
+
+* ``database_block_is_warning`` - this parameter record the boolean value, if ``True``,
+ the Odoo backend is not blocked, but displayed message is shown as warning
+ (``web_responsive`` add-on must be installed in order for warning to be displayed).
Questions?
==========
diff --git a/database_block/i18n/database_block.pot b/database_block/i18n/database_block.pot
new file mode 100755
index 00000000..cd1eb3e6
--- /dev/null
+++ b/database_block/i18n/database_block.pot
@@ -0,0 +1,28 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * database_block
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-11-25 20:08+0000\n"
+"PO-Revision-Date: 2021-11-25 20: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: database_block
+#: model:ir.model,name:database_block.model_ir_http
+msgid "HTTP Routing"
+msgstr ""
+
+#. module: database_block
+#. openerp-web
+#: code:addons/database_block/static/src/xml/apps.xml:0
+#, python-format
+msgid "Your database is blocked"
+msgstr ""
diff --git a/database_block/i18n/es.po b/database_block/i18n/es.po
new file mode 100755
index 00000000..d7835d49
--- /dev/null
+++ b/database_block/i18n/es.po
@@ -0,0 +1,30 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * database_block
+# Leonardo J. Caballero G. , 2021, 2022.
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-11-25 20:08+0000\n"
+"PO-Revision-Date: 2022-06-18 18:50-0400\n"
+"Last-Translator: Leonardo J. Caballero G. \n"
+"Language-Team: ES \n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 2.2.1\n"
+
+#. module: database_block
+#: model:ir.model,name:database_block.model_ir_http
+msgid "HTTP Routing"
+msgstr "Ruta HTTP"
+
+#. module: database_block
+#. openerp-web
+#: code:addons/database_block/static/src/xml/apps.xml:0
+#, python-format
+msgid "Your database is blocked"
+msgstr "Tu base de datos está bloqueada"
diff --git a/database_block/models/ir_http.py b/database_block/models/ir_http.py
index 794816c3..5e4b5a99 100644
--- a/database_block/models/ir_http.py
+++ b/database_block/models/ir_http.py
@@ -15,7 +15,8 @@ def session_info(self):
self.env["ir.module.module"]
.with_user(SUPERUSER_ID)
.search(
- [("name", "=", "web_responsive"), ("state", "=", "installed")], limit=1,
+ [("name", "=", "web_responsive"), ("state", "=", "installed")],
+ limit=1,
)
)
diff --git a/database_block/static/src/js/main.js b/database_block/static/src/js/main.js
index 3cdf2182..c9d6dd1d 100644
--- a/database_block/static/src/js/main.js
+++ b/database_block/static/src/js/main.js
@@ -1,12 +1,12 @@
/* Copyright 2020 Eugene Molotov
License MIT (https://opensource.org/licenses/MIT). */
-odoo.define("database_block.main", function(require) {
+odoo.define("database_block.main", function (require) {
"use strict";
var AppsMenu = require("web.AppsMenu");
AppsMenu.include({
- start: function() {
+ start: function () {
this._super.apply(this, arguments);
if (odoo.session_info.database_block_message) {
diff --git a/database_block/static/src/xml/apps.xml b/database_block/static/src/xml/apps.xml
index 6f618f6b..04d6f417 100644
--- a/database_block/static/src/xml/apps.xml
+++ b/database_block/static/src/xml/apps.xml
@@ -9,8 +9,7 @@
style="display: none"
/>
-
Your database is blocked
diff --git a/database_expiration/LICENSE b/database_expiration/LICENSE
new file mode 100755
index 00000000..529a2e74
--- /dev/null
+++ b/database_expiration/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2020-2021 IT-Projects LLC, Eugene Molotov, Denis Mudarisov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/database_expiration/README.rst b/database_expiration/README.rst
index 96fe4348..1ba0e80f 100644
--- a/database_expiration/README.rst
+++ b/database_expiration/README.rst
@@ -12,15 +12,27 @@
With this module you can make database to expire.
-After reaching expiration date "Your database is expired" will be shown.
-Expiration date is defined in "System Parameters" as `database_expiration_date`.
+After reaching expiration date a 'Your database is expired!' message will be shown.
-Also if ``web_responsive`` is installed, 7 days before expiration date
-module will start to show warning in main menu.
-To configure how many days to show warning in advance, you can set ``database_expiration_warning_delay`` in "System Parameters"
+In order to do that, dependent module need to override ``ir.http`` 's ``session_info``
+method and return dictionary with following keys:
+
+* ``database_expiration_date`` - this parameter record the date time value like **YYYY-MM-DD HH:MM:SS**,
+ for example, '2021-12-01 13:45:00'.
+
+* ``database_expiration_warning_delay`` - this parameter record a integer value for how many days
+ to show warning in advance, for example, **5**, it use by as default value: *7*.
+
+* ``database_expiration_details_link`` - this parameter record a text value for add hyperlink below
+ warning/expiration message, for example, **https://support.mystore.com/**.
-You can also add hyperlink below warning/expiration message. To define url, set ``database_expiration_details_link`` in "System Parameters".
-By default hyperlink's label is "Details". To define the other one, set ``database_expiraation_details_link_label`` in "System Paramters".
+* ``database_expiration_details_link_label`` - this parameter record a text value for the hyperlink's
+ label for the link, for example, **More details**, it use by as default value: *Details*.
+
+For setup this add-on is defined in "Settings > Technical > Parameters > System Parameters".
+
+Also if ``web_responsive`` add-on is installed, by default 7 days before expiration date
+module will start to show warning in main menu.
Questions?
==========
@@ -40,4 +52,4 @@ Odoo Apps Store: https://apps.odoo.com/apps/modules/13.0/database_expiration/
Notifications on updates: `via Atom `_, `by Email `_
-Tested on `Odoo 12.0 `_
+Tested on `Odoo 13.0 `_
diff --git a/database_expiration/__manifest__.py b/database_expiration/__manifest__.py
index 668cf509..596188fe 100644
--- a/database_expiration/__manifest__.py
+++ b/database_expiration/__manifest__.py
@@ -1,4 +1,5 @@
# Copyright 2020 Eugene Molotov
+# Copyright 2021 Denis Mudarisov
# License MIT (https://opensource.org/licenses/MIT).
{
diff --git a/database_expiration/doc/changelog.rst b/database_expiration/doc/changelog.rst
index e9816bd9..aecadc90 100644
--- a/database_expiration/doc/changelog.rst
+++ b/database_expiration/doc/changelog.rst
@@ -1,7 +1,12 @@
+`1.1.1`
+-------
+
+- **Fix:** in cases when the database expires today or tomorrow no reminder was shown
+
`1.1.0`
-------
-- **New**: ```database_expiration_warning_delay`` option
+- **New**: ``database_expiration_warning_delay`` option
- **New**: Ability to add hyperlink in warning/expiration message
`1.0.0`
diff --git a/database_expiration/doc/index.rst b/database_expiration/doc/index.rst
index 6d7ec130..8dfb294b 100644
--- a/database_expiration/doc/index.rst
+++ b/database_expiration/doc/index.rst
@@ -11,8 +11,8 @@ Configuration
* `Log in as admin
* `Activate Developer Mode `__
-* Open menu ``[[ Settings ]] >> Technical >> System Parameter``
+* Open menu ``[[ Settings ]] >> Technical >> System Parameters``
* Edit existing record by key `database_expiration_date` or create new one
* Set date with format YYYY-MM-DD HH:MM:SS, click "Save" and reload web page
-* If you set past date, "Your database is expired" will appear and will disable navigating
+* If you set past date, "Your database is expired!" will appear and will disable navigating
* If you set future date in range of 7 days and you have installed `web_responsive` module installed, you will see warning message in main menu page
diff --git a/database_expiration/i18n/database_expiration.pot b/database_expiration/i18n/database_expiration.pot
new file mode 100755
index 00000000..d58e5512
--- /dev/null
+++ b/database_expiration/i18n/database_expiration.pot
@@ -0,0 +1,69 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * database_expiration
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-11-26 04:34+0000\n"
+"PO-Revision-Date: 2021-11-26 04:34+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: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Click here!"
+msgstr ""
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Could not get expiration warning delay: %s. Using default: 7 days"
+msgstr ""
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Details"
+msgstr ""
+
+#. module: database_expiration
+#: model:ir.model,name:database_expiration.model_ir_http
+msgid "HTTP Routing"
+msgstr ""
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Value must be greater than 1!"
+msgstr ""
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Your database is expired!"
+msgstr ""
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Your database will expire in {} days!"
+msgstr ""
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Your database will expire today!"
+msgstr ""
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Your database will expire tomorrow!"
+msgstr ""
diff --git a/database_expiration/i18n/es.po b/database_expiration/i18n/es.po
new file mode 100755
index 00000000..9ce04a73
--- /dev/null
+++ b/database_expiration/i18n/es.po
@@ -0,0 +1,75 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * database_expiration
+#
+# Translators:
+# Leonardo J. Caballero G. , 2021.
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-11-26 04:34+0000\n"
+"PO-Revision-Date: 2022-06-18 18:53-0400\n"
+"Last-Translator: Leonardo J. Caballero G. \n"
+"Language-Team: ES \n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 2.2.1\n"
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Click here!"
+msgstr "¡Haga clic aquí!"
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Could not get expiration warning delay: %s. Using default: 7 days"
+msgstr ""
+"No se pudo obtener el retraso de advertencia de caducidad: %s. Usando por "
+"defecto: 7 días"
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Details"
+msgstr "Detalles"
+
+#. module: database_expiration
+#: model:ir.model,name:database_expiration.model_ir_http
+msgid "HTTP Routing"
+msgstr "Ruta HTTP"
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Value must be greater than 1!"
+msgstr "¡Valor debe ser mayor que 1!"
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Your database is expired!"
+msgstr "¡Su base de datos ha caducado!"
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Your database will expire in {} days!"
+msgstr "¡Su base de datos caducará en {} días!"
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Your database will expire today!"
+msgstr "¡Su base de datos caducará hoy!"
+
+#. module: database_expiration
+#: code:addons/database_expiration/models/ir_http.py:0
+#, python-format
+msgid "Your database will expire tomorrow!"
+msgstr "¡Su base de datos caducará mañana!"
diff --git a/database_expiration/models/ir_http.py b/database_expiration/models/ir_http.py
index ce5d7418..2809701b 100644
--- a/database_expiration/models/ir_http.py
+++ b/database_expiration/models/ir_http.py
@@ -1,4 +1,5 @@
# Copyright 2020 Eugene Molotov
+# Copyright 2021 Denis Mudarisov
# License MIT (https://opensource.org/licenses/MIT).
import logging
@@ -7,11 +8,12 @@
from mako.template import Template
from odoo import models
+from odoo.tools.translate import _
from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
_logger = logging.getLogger(__name__)
DATABASE_BLOCK_MESSAGE_HTML_TEMPLATE = Template(
- "${database_block_message}
${database_expiration_link_label}"
+ "${database_block_message}
${database_expiration_link_label}"
)
@@ -41,30 +43,30 @@ def session_info(self):
Config.get_param("database_expiration_warning_delay", 7)
)
if not database_expiration_warning_delay > 1:
- raise ValueError("Value must be greater than 1")
+ raise ValueError(_("Value must be greater than 1!"))
except ValueError as e:
_logger.warning(
- "Could not get expiration warning delay: %s. Using default: 7 days"
+ _("Could not get expiration warning delay: %s. Using default: 7 days")
% str(e)
)
database_expiration_warning_delay = 7
if now > database_expiration_date:
- res["database_block_message"] = "Your database is expired"
+ res["database_block_message"] = _("Your database is expired!")
elif delta.days > database_expiration_warning_delay:
pass
elif delta.days > 1:
res[
"database_block_message"
- ] = "Your database will expire in {} days".format(delta.days,)
+ ] = _("Your database will expire in {} days!").format(
+ delta.days,
+ )
res["database_block_is_warning"] = True
elif delta.days == 1:
- res[
- "database_expiration_message"
- ] = "Your database will expire tomorrow"
+ res["database_block_message"] = _("Your database will expire tomorrow!")
res["database_block_is_warning"] = True
elif delta.days == 0:
- res["database_expiration_message"] = "Your database will expire today"
+ res["database_block_message"] = _("Your database will expire today!")
res["database_block_is_warning"] = True
if res.get("database_block_message"):
@@ -74,13 +76,14 @@ def session_info(self):
if database_expiration_link:
database_expiration_link_label = Config.get_param(
- "database_expiration_details_link_label", "Details"
+ "database_expiration_details_link_label", _("Details")
)
res[
"database_block_message"
] = DATABASE_BLOCK_MESSAGE_HTML_TEMPLATE.render(
database_block_message=res["database_block_message"],
database_expiration_link=database_expiration_link,
+ database_expiration_link_title=_('Click here!'),
database_expiration_link_label=database_expiration_link_label,
)