Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

13.0 #339

Open
wants to merge 10 commits into
base: 13.0
Choose a base branch
from
Open

13.0 #339

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ coverage.xml

# Translations
*.mo
*.pot
!*.pot

# Django stuff:
*.log
Expand Down
21 changes: 21 additions & 0 deletions database_block/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 8 additions & 4 deletions database_block/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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, **<h1>Your database is blocked</h1>**.

* ``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?
==========
Expand Down
28 changes: 28 additions & 0 deletions database_block/i18n/database_block.pot
Original file line number Diff line number Diff line change
@@ -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 ""
30 changes: 30 additions & 0 deletions database_block/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * database_block
# Leonardo J. Caballero G. <[email protected]>, 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. <[email protected]>\n"
"Language-Team: ES <[email protected]>\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"
3 changes: 2 additions & 1 deletion database_block/models/ir_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)

Expand Down
4 changes: 2 additions & 2 deletions database_block/static/src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* Copyright 2020 Eugene Molotov <https://it-projects.info/team/em230418>
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) {
Expand Down
3 changes: 1 addition & 2 deletions database_block/static/src/xml/apps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
style="display: none"
/>
<div style="display: none">
<div
class="block_ui database_block_message alert alert-danger"
<div class="block_ui database_block_message alert alert-danger"
onclick="$('a.full').trigger('click');"
>Your database is blocked</div>
</div>
Expand Down
21 changes: 21 additions & 0 deletions database_expiration/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
28 changes: 20 additions & 8 deletions database_expiration/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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?
==========
Expand All @@ -40,4 +52,4 @@ Odoo Apps Store: https://apps.odoo.com/apps/modules/13.0/database_expiration/

Notifications on updates: `via Atom <https://github.com/it-projects-llc/access-addons/commits/13.0/database_expiration.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/access-addons/commits/13.0/database_expiration.atom>`_

Tested on `Odoo 12.0 <https://github.com/odoo/odoo/commit/6a57ad66b8374966ba7011e34cec20f6344f4f6d>`_
Tested on `Odoo 13.0 <https://github.com/odoo/odoo/commit/6a57ad66b8374966ba7011e34cec20f6344f4f6d>`_
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit in the link must belong to the specified Odoo version

1 change: 1 addition & 0 deletions database_expiration/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2020 Eugene Molotov <https://it-projects.info/team/em230418>
# Copyright 2021 Denis Mudarisov <https://github.com/trojikman>
# License MIT (https://opensource.org/licenses/MIT).

{
Expand Down
7 changes: 6 additions & 1 deletion database_expiration/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
`1.1.1`
-------

- **Fix:** in cases when the database expires today or tomorrow no reminder was shown
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why you change this file?


`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`
Expand Down
4 changes: 2 additions & 2 deletions database_expiration/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Configuration

* `Log in as admin
* `Activate Developer Mode <https://odoo-development.readthedocs.io/en/latest/odoo/usage/debug-mode.html>`__
* 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
69 changes: 69 additions & 0 deletions database_expiration/i18n/database_expiration.pot
Original file line number Diff line number Diff line change
@@ -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 ""
75 changes: 75 additions & 0 deletions database_expiration/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * database_expiration
#
# Translators:
# Leonardo J. Caballero G. <[email protected]>, 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. <[email protected]>\n"
"Language-Team: ES <[email protected]>\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!"
Loading