From 8651a4a4b956cfdd502b31429941365d11ae75da Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Wed, 8 Jan 2025 19:00:35 +0200 Subject: [PATCH] [IMP] autovacuum_message_attachment: pre-commit auto fixes --- autovacuum_message_attachment/README.rst | 55 +++++++++++-------- .../models/autovacuum_mixin.py | 8 +-- autovacuum_message_attachment/pyproject.toml | 3 + .../readme/CONFIGURE.md | 11 ++++ .../readme/CONFIGURE.rst | 6 -- .../readme/CONTRIBUTORS.md | 4 ++ .../readme/CONTRIBUTORS.rst | 4 -- .../readme/DESCRIPTION.md | 5 ++ .../readme/DESCRIPTION.rst | 4 -- .../readme/ROADMAP.md | 5 ++ .../readme/ROADMAP.rst | 2 - .../static/description/index.html | 48 ++++++++++------ 12 files changed, 92 insertions(+), 63 deletions(-) create mode 100644 autovacuum_message_attachment/pyproject.toml create mode 100644 autovacuum_message_attachment/readme/CONFIGURE.md delete mode 100644 autovacuum_message_attachment/readme/CONFIGURE.rst create mode 100644 autovacuum_message_attachment/readme/CONTRIBUTORS.md delete mode 100644 autovacuum_message_attachment/readme/CONTRIBUTORS.rst create mode 100644 autovacuum_message_attachment/readme/DESCRIPTION.md delete mode 100644 autovacuum_message_attachment/readme/DESCRIPTION.rst create mode 100644 autovacuum_message_attachment/readme/ROADMAP.md delete mode 100644 autovacuum_message_attachment/readme/ROADMAP.rst diff --git a/autovacuum_message_attachment/README.rst b/autovacuum_message_attachment/README.rst index 61e77bbedb9..53d80f49256 100644 --- a/autovacuum_message_attachment/README.rst +++ b/autovacuum_message_attachment/README.rst @@ -17,21 +17,22 @@ AutoVacuum Mail Message and Attachment :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github - :target: https://github.com/OCA/server-tools/tree/16.0/autovacuum_message_attachment + :target: https://github.com/OCA/server-tools/tree/18.0/autovacuum_message_attachment :alt: OCA/server-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-autovacuum_message_attachment + :target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-autovacuum_message_attachment :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -Odoo create a lot of message and/or mails. With time it can slow the system or take a lot of disk space. -The goal of this module is to clean these message once they are obsolete. -The same may happen with attachment that we store. -You can choose various criterias manage which messages you want to delete automatically. +Odoo create a lot of message and/or mails. With time it can slow the +system or take a lot of disk space. The goal of this module is to clean +these message once they are obsolete. The same may happen with +attachment that we store. You can choose various criterias manage which +messages you want to delete automatically. **Table of contents** @@ -41,18 +42,26 @@ You can choose various criterias manage which messages you want to delete automa Configuration ============= -* Go to the menu configuration => Technical => Email => Message And Attachment Vacuum Rules -* Add the adequates rules for your company. On each rule, you can indicate the models, type and subtypes for which you want to delete the messages, along with a retention time (in days). Or for attachment, you can specify a substring of the name. -* Activate the cron AutoVacuum Mails and Messages and/or AutoVacuum Attachments +- Go to the menu configuration => Technical => Email => Message And + Attachment Vacuum Rules +- Add the adequates rules for your company. On each rule, you can + indicate the models, type and subtypes for which you want to delete + the messages, along with a retention time (in days). Or for + attachment, you can specify a substring of the name. +- Activate the cron AutoVacuum Mails and Messages and/or AutoVacuum + Attachments -It is recommanded to run it frequently and when the system is not very loaded. -(For instance : once a day, during the night.) +It is recommanded to run it frequently and when the system is not very +loaded. (For instance : once a day, during the night.) Known issues / Roadmap ====================== -You have to be careful with rules regarding attachment deletion because Odoo find the attachment to delete with their name. -Odoo will find all attachments containing the substring configured on the rule, so you have to be specific enough on the other criterias (concerned models...) to avoid unwanted attachment deletion. +You have to be careful with rules regarding attachment deletion because +Odoo find the attachment to delete with their name. Odoo will find all +attachments containing the substring configured on the rule, so you have +to be specific enough on the other criterias (concerned models...) to +avoid unwanted attachment deletion. Bug Tracker =========== @@ -60,7 +69,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -68,20 +77,20 @@ Credits ======= Authors -~~~~~~~ +------- * Akretion Contributors -~~~~~~~~~~~~ +------------ -* Florian da Costa -* Enric Tobella -* Helly kapatel -* Akim Juillerat +- Florian da Costa +- Enric Tobella +- Helly kapatel +- Akim Juillerat Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -101,6 +110,6 @@ Current `maintainer `__: |maintainer-florian-dacosta| -This module is part of the `OCA/server-tools `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/autovacuum_message_attachment/models/autovacuum_mixin.py b/autovacuum_message_attachment/models/autovacuum_mixin.py index 9fd7a800e44..38c0c0bbe39 100644 --- a/autovacuum_message_attachment/models/autovacuum_mixin.py +++ b/autovacuum_message_attachment/models/autovacuum_mixin.py @@ -29,9 +29,7 @@ def batch_unlink(self): batch_delete.with_env(new_env).unlink() new_env.cr.commit() except Exception as e: - _logger.exception( - "Failed to delete Ms : {} - {}".format(self._name, str(e)) - ) + _logger.exception(f"Failed to delete Ms : {self._name} - {str(e)}") # Call by cron @api.model @@ -60,8 +58,6 @@ def _get_autovacuum_records_model(self, rule): record_domain.append(leaf) continue field, operator, value = leaf - record_domain.append( - ("{}.{}".format(autovacuum_relation, field), operator, value) - ) + record_domain.append((f"{autovacuum_relation}.{field}", operator, value)) records = self.env[rule.model_id.model].search(record_domain) return self.search(domain + [("res_id", "in", records.ids)]) diff --git a/autovacuum_message_attachment/pyproject.toml b/autovacuum_message_attachment/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/autovacuum_message_attachment/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/autovacuum_message_attachment/readme/CONFIGURE.md b/autovacuum_message_attachment/readme/CONFIGURE.md new file mode 100644 index 00000000000..05c941a3573 --- /dev/null +++ b/autovacuum_message_attachment/readme/CONFIGURE.md @@ -0,0 +1,11 @@ +- Go to the menu configuration =\> Technical =\> Email =\> Message And + Attachment Vacuum Rules +- Add the adequates rules for your company. On each rule, you can + indicate the models, type and subtypes for which you want to delete + the messages, along with a retention time (in days). Or for + attachment, you can specify a substring of the name. +- Activate the cron AutoVacuum Mails and Messages and/or AutoVacuum + Attachments + +It is recommanded to run it frequently and when the system is not very +loaded. (For instance : once a day, during the night.) diff --git a/autovacuum_message_attachment/readme/CONFIGURE.rst b/autovacuum_message_attachment/readme/CONFIGURE.rst deleted file mode 100644 index a422d44b828..00000000000 --- a/autovacuum_message_attachment/readme/CONFIGURE.rst +++ /dev/null @@ -1,6 +0,0 @@ -* Go to the menu configuration => Technical => Email => Message And Attachment Vacuum Rules -* Add the adequates rules for your company. On each rule, you can indicate the models, type and subtypes for which you want to delete the messages, along with a retention time (in days). Or for attachment, you can specify a substring of the name. -* Activate the cron AutoVacuum Mails and Messages and/or AutoVacuum Attachments - -It is recommanded to run it frequently and when the system is not very loaded. -(For instance : once a day, during the night.) diff --git a/autovacuum_message_attachment/readme/CONTRIBUTORS.md b/autovacuum_message_attachment/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..09e56761193 --- /dev/null +++ b/autovacuum_message_attachment/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- Florian da Costa \<\> +- Enric Tobella \<\> +- Helly kapatel \<\> +- Akim Juillerat \<\> diff --git a/autovacuum_message_attachment/readme/CONTRIBUTORS.rst b/autovacuum_message_attachment/readme/CONTRIBUTORS.rst deleted file mode 100644 index 06399e3d156..00000000000 --- a/autovacuum_message_attachment/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,4 +0,0 @@ -* Florian da Costa -* Enric Tobella -* Helly kapatel -* Akim Juillerat diff --git a/autovacuum_message_attachment/readme/DESCRIPTION.md b/autovacuum_message_attachment/readme/DESCRIPTION.md new file mode 100644 index 00000000000..a317af285c4 --- /dev/null +++ b/autovacuum_message_attachment/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +Odoo create a lot of message and/or mails. With time it can slow the +system or take a lot of disk space. The goal of this module is to clean +these message once they are obsolete. The same may happen with +attachment that we store. You can choose various criterias manage which +messages you want to delete automatically. diff --git a/autovacuum_message_attachment/readme/DESCRIPTION.rst b/autovacuum_message_attachment/readme/DESCRIPTION.rst deleted file mode 100644 index b7e6fcec4fb..00000000000 --- a/autovacuum_message_attachment/readme/DESCRIPTION.rst +++ /dev/null @@ -1,4 +0,0 @@ -Odoo create a lot of message and/or mails. With time it can slow the system or take a lot of disk space. -The goal of this module is to clean these message once they are obsolete. -The same may happen with attachment that we store. -You can choose various criterias manage which messages you want to delete automatically. diff --git a/autovacuum_message_attachment/readme/ROADMAP.md b/autovacuum_message_attachment/readme/ROADMAP.md new file mode 100644 index 00000000000..3f120ad90c1 --- /dev/null +++ b/autovacuum_message_attachment/readme/ROADMAP.md @@ -0,0 +1,5 @@ +You have to be careful with rules regarding attachment deletion because +Odoo find the attachment to delete with their name. Odoo will find all +attachments containing the substring configured on the rule, so you have +to be specific enough on the other criterias (concerned models...) to +avoid unwanted attachment deletion. diff --git a/autovacuum_message_attachment/readme/ROADMAP.rst b/autovacuum_message_attachment/readme/ROADMAP.rst deleted file mode 100644 index 8c221582b78..00000000000 --- a/autovacuum_message_attachment/readme/ROADMAP.rst +++ /dev/null @@ -1,2 +0,0 @@ -You have to be careful with rules regarding attachment deletion because Odoo find the attachment to delete with their name. -Odoo will find all attachments containing the substring configured on the rule, so you have to be specific enough on the other criterias (concerned models...) to avoid unwanted attachment deletion. diff --git a/autovacuum_message_attachment/static/description/index.html b/autovacuum_message_attachment/static/description/index.html index 8c89ecf1dba..d53339b8e42 100644 --- a/autovacuum_message_attachment/static/description/index.html +++ b/autovacuum_message_attachment/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -368,11 +369,12 @@

AutoVacuum Mail Message and Attachment

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:491db966d4262d620005377d57d6255ffa65095cbcc96229a46efad5d6dec593 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/server-tools Translate me on Weblate Try me on Runboat

-

Odoo create a lot of message and/or mails. With time it can slow the system or take a lot of disk space. -The goal of this module is to clean these message once they are obsolete. -The same may happen with attachment that we store. -You can choose various criterias manage which messages you want to delete automatically.

+

Beta License: LGPL-3 OCA/server-tools Translate me on Weblate Try me on Runboat

+

Odoo create a lot of message and/or mails. With time it can slow the +system or take a lot of disk space. The goal of this module is to clean +these message once they are obsolete. The same may happen with +attachment that we store. You can choose various criterias manage which +messages you want to delete automatically.

Table of contents

    @@ -390,24 +392,32 @@

    AutoVacuum Mail Message and Attachment

    Configuration

      -
    • Go to the menu configuration => Technical => Email => Message And Attachment Vacuum Rules
    • -
    • Add the adequates rules for your company. On each rule, you can indicate the models, type and subtypes for which you want to delete the messages, along with a retention time (in days). Or for attachment, you can specify a substring of the name.
    • -
    • Activate the cron AutoVacuum Mails and Messages and/or AutoVacuum Attachments
    • +
    • Go to the menu configuration => Technical => Email => Message And +Attachment Vacuum Rules
    • +
    • Add the adequates rules for your company. On each rule, you can +indicate the models, type and subtypes for which you want to delete +the messages, along with a retention time (in days). Or for +attachment, you can specify a substring of the name.
    • +
    • Activate the cron AutoVacuum Mails and Messages and/or AutoVacuum +Attachments
    -

    It is recommanded to run it frequently and when the system is not very loaded. -(For instance : once a day, during the night.)

    +

    It is recommanded to run it frequently and when the system is not very +loaded. (For instance : once a day, during the night.)

    Known issues / Roadmap

    -

    You have to be careful with rules regarding attachment deletion because Odoo find the attachment to delete with their name. -Odoo will find all attachments containing the substring configured on the rule, so you have to be specific enough on the other criterias (concerned models…) to avoid unwanted attachment deletion.

    +

    You have to be careful with rules regarding attachment deletion because +Odoo find the attachment to delete with their name. Odoo will find all +attachments containing the substring configured on the rule, so you have +to be specific enough on the other criterias (concerned models…) to +avoid unwanted attachment deletion.

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -430,13 +440,15 @@

    Contributors

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

    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.

    Current maintainer:

    florian-dacosta

    -

    This module is part of the OCA/server-tools project on GitHub.

    +

    This module is part of the OCA/server-tools project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.