diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..b6a254e --- /dev/null +++ b/.flake8 @@ -0,0 +1,12 @@ +[flake8] +max-line-length = 88 +max-complexity = 16 +# B = bugbear +# B9 = bugbear opinionated (incl line length) +select = C,E,F,W,B,B9 +# E203: whitespace before ':' (black behaviour) +# E501: flake8 line length (covered by bugbear B950) +# W503: line break before binary operator (black behaviour) +ignore = E203,E501,W503,F821 +per-file-ignores= + __init__.py:F401 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..47590c7 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,36 @@ +name: pre-commit + +on: + pull_request: + branches: + - "14.0*" + push: + branches: + - "14.0" + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v2 + with: + python-version: "3.11" + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v1 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure --color=always + - name: Check that all files generated by pre-commit are in git + run: | + newfiles="$(git ls-files --others --exclude-from=.gitignore)" + if [ "$newfiles" != "" ] ; then + echo "Please check-in the following files:" + echo "$newfiles" + exit 1 + fi diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..28b1b49 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +exclude: | + (?x) + # NOT INSTALLABLE ADDONS + # END NOT INSTALLABLE ADDONS + # Files and folders generated by bots, to avoid loops + ^setup/|/static/description/index\.html$| + # We don't want to mess with tool-generated files + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| + # Maybe reactivate this when all README files include prettier ignore tags? + ^README\.md$| + # Library files can have extraneous formatting (even minimized) + /static/(src/)?lib/| + # Repos using Sphinx to generate docs don't need prettying + ^docs/_templates/.*\.html$| + # Don't bother non-technical authors with formatting issues in docs + readme/.*\.(rst|md)$| + # Ignore build and dist directories in addons + /build/|/dist/| + # You don't usually want a bot to modify your legal texts + (LICENSE.*|COPYING.*) +default_language_version: + python: python3 + node: "14.13.0" +repos: + - repo: https://github.com/PyCQA/flake8 + rev: 3.8.3 + hooks: + - id: flake8 + name: flake8 + additional_dependencies: ["flake8-bugbear==20.1.4"] diff --git a/.unported_addons/mail_recipient_unchecked/README.rst b/.unported_addons/mail_recipient_unchecked/README.rst deleted file mode 100644 index abae2a5..0000000 --- a/.unported_addons/mail_recipient_unchecked/README.rst +++ /dev/null @@ -1,7 +0,0 @@ -Mail Recipient Unchecked -======================== -This module unchecks the recipients of the chatter. - -Contributors ------------- -* Numigi (tm) and all its contributors (https://bit.ly/numigiens) diff --git a/.unported_addons/mail_recipient_unchecked/__init__.py b/.unported_addons/mail_recipient_unchecked/__init__.py deleted file mode 100644 index b1432af..0000000 --- a/.unported_addons/mail_recipient_unchecked/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2018 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). diff --git a/.unported_addons/mail_recipient_unchecked/__manifest__.py b/.unported_addons/mail_recipient_unchecked/__manifest__.py deleted file mode 100644 index c815c03..0000000 --- a/.unported_addons/mail_recipient_unchecked/__manifest__.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2018 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -{ - 'name': 'Mail Recipient Unchecked', - 'version': '1.0.0', - 'author': 'Numigi', - 'maintainer': 'Numigi', - 'license': 'LGPL-3', - 'category': 'Other', - 'summary': 'Uncheck the recipients of chatter message by default.', - 'depends': [ - 'mail', - ], - 'qweb': ['templates/chatter.xml'], - 'installable': True, -} diff --git a/.unported_addons/mail_recipient_unchecked/static/description/icon.png b/.unported_addons/mail_recipient_unchecked/static/description/icon.png deleted file mode 100644 index 92a86b1..0000000 Binary files a/.unported_addons/mail_recipient_unchecked/static/description/icon.png and /dev/null differ diff --git a/.unported_addons/mail_recipient_unchecked/templates/chatter.xml b/.unported_addons/mail_recipient_unchecked/templates/chatter.xml deleted file mode 100644 index 64a4bd3..0000000 --- a/.unported_addons/mail_recipient_unchecked/templates/chatter.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - undefined - - - diff --git a/.unported_addons/mail_subscription_notification_mgmt/README.rst b/.unported_addons/mail_subscription_notification_mgmt/README.rst deleted file mode 100644 index cb42c09..0000000 --- a/.unported_addons/mail_subscription_notification_mgmt/README.rst +++ /dev/null @@ -1,32 +0,0 @@ -Mail Subscription Notification Management -========================================= - -.. contents:: Table of Contents - -Overview --------- - -The module allows to disable subscription notification for a model. - -Settings --------- -As a user belonging to the `Administration / Configuration group`, -activate the developer mode and go to the form view of a model `(Settings > Technical > Database Structure > Models)`. - -A new `Disable Subscription Notifications` checkbox is present. - -The default value of the box is unchecked. - -.. image:: static/description/disable_subscription_notification_box_unchecked.png - -Usage ------ - -If you want to disable the subscription notification for a model, go to the form view of this model, check the box **Disable Subscription Notifications** and save. - - .. image:: static/description/disable_subscription_notification_box_checked.png - - -Contributors ------------- -* Numigi (tm) and all its contributors (https://bit.ly/numigiens) diff --git a/.unported_addons/mail_subscription_notification_mgmt/__init__.py b/.unported_addons/mail_subscription_notification_mgmt/__init__.py deleted file mode 100644 index a6d2238..0000000 --- a/.unported_addons/mail_subscription_notification_mgmt/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from . import models diff --git a/.unported_addons/mail_subscription_notification_mgmt/__manifest__.py b/.unported_addons/mail_subscription_notification_mgmt/__manifest__.py deleted file mode 100644 index c310e73..0000000 --- a/.unported_addons/mail_subscription_notification_mgmt/__manifest__.py +++ /dev/null @@ -1,16 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -{ - 'name': 'Disable Subscription Notification', - 'version': '1.0.0', - 'author': 'Numigi', - 'maintainer': 'Numigi', - 'website': "https://bit.ly/numigi-com", - 'license': 'LGPL-3', - 'category': 'Other', - 'summary': 'Disable subscription notification of a model.', - 'depends': ['mail'], - 'data': ['views/ir_model_views.xml'], - 'installable': True, -} diff --git a/.unported_addons/mail_subscription_notification_mgmt/i18n/fr.po b/.unported_addons/mail_subscription_notification_mgmt/i18n/fr.po deleted file mode 100644 index d115d7a..0000000 --- a/.unported_addons/mail_subscription_notification_mgmt/i18n/fr.po +++ /dev/null @@ -1,32 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * mail_subscription_notification_mgmt -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-29 11:00+0000\n" -"PO-Revision-Date: 2022-06-29 11:00+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: mail_subscription_notification_mgmt -#: model:ir.model.fields,field_description:mail_subscription_notification_mgmt.field_ir_model__disable_subscription_notification -msgid "Disable Subscription Notifications" -msgstr "Désactiver notifications d’assignation" - -#. module: mail_subscription_notification_mgmt -#: model:ir.model,name:mail_subscription_notification_mgmt.model_mail_thread -msgid "Email Thread" -msgstr "" - -#. module: mail_subscription_notification_mgmt -#: model:ir.model,name:mail_subscription_notification_mgmt.model_ir_model -msgid "Models" -msgstr "" - diff --git a/.unported_addons/mail_subscription_notification_mgmt/models/__init__.py b/.unported_addons/mail_subscription_notification_mgmt/models/__init__.py deleted file mode 100644 index a8999b6..0000000 --- a/.unported_addons/mail_subscription_notification_mgmt/models/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from . import ir_model -from . import mail_thread diff --git a/.unported_addons/mail_subscription_notification_mgmt/models/ir_model.py b/.unported_addons/mail_subscription_notification_mgmt/models/ir_model.py deleted file mode 100644 index 9409a10..0000000 --- a/.unported_addons/mail_subscription_notification_mgmt/models/ir_model.py +++ /dev/null @@ -1,10 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo import models, fields, api - - -class IrModel(models.Model): - _inherit = 'ir.model' - - disable_subscription_notification = fields.Boolean("Disable Subscription Notifications") diff --git a/.unported_addons/mail_subscription_notification_mgmt/models/mail_thread.py b/.unported_addons/mail_subscription_notification_mgmt/models/mail_thread.py deleted file mode 100644 index 98ef185..0000000 --- a/.unported_addons/mail_subscription_notification_mgmt/models/mail_thread.py +++ /dev/null @@ -1,15 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo import api, models - - -class MailThread(models.AbstractModel): - _inherit = 'mail.thread' - - @api.multi - def _message_auto_subscribe_notify(self, partner_ids, template): - if self and self.env['ir.model']._get(self[0]._name).disable_subscription_notification: - return - return super(MailThread, self)._message_auto_subscribe_notify( - partner_ids, template) diff --git a/.unported_addons/mail_subscription_notification_mgmt/static/description/disable_subscription_notification_box_checked.png b/.unported_addons/mail_subscription_notification_mgmt/static/description/disable_subscription_notification_box_checked.png deleted file mode 100644 index 27099ce..0000000 Binary files a/.unported_addons/mail_subscription_notification_mgmt/static/description/disable_subscription_notification_box_checked.png and /dev/null differ diff --git a/.unported_addons/mail_subscription_notification_mgmt/static/description/disable_subscription_notification_box_unchecked.png b/.unported_addons/mail_subscription_notification_mgmt/static/description/disable_subscription_notification_box_unchecked.png deleted file mode 100644 index 4a35b00..0000000 Binary files a/.unported_addons/mail_subscription_notification_mgmt/static/description/disable_subscription_notification_box_unchecked.png and /dev/null differ diff --git a/.unported_addons/mail_subscription_notification_mgmt/static/description/icon.png b/.unported_addons/mail_subscription_notification_mgmt/static/description/icon.png deleted file mode 100644 index 92a86b1..0000000 Binary files a/.unported_addons/mail_subscription_notification_mgmt/static/description/icon.png and /dev/null differ diff --git a/.unported_addons/mail_subscription_notification_mgmt/views/ir_model_views.xml b/.unported_addons/mail_subscription_notification_mgmt/views/ir_model_views.xml deleted file mode 100644 index ce500c7..0000000 --- a/.unported_addons/mail_subscription_notification_mgmt/views/ir_model_views.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - ir.model - - - - - - - - - \ No newline at end of file diff --git a/fetchmail_outlook_by_company/models/microsoft_outlook_mixin.py b/fetchmail_outlook_by_company/models/microsoft_outlook_mixin.py index 8ebfb15..3a7523d 100644 --- a/fetchmail_outlook_by_company/models/microsoft_outlook_mixin.py +++ b/fetchmail_outlook_by_company/models/microsoft_outlook_mixin.py @@ -52,19 +52,29 @@ def _compute_outlook_uri_by_company(self): record.microsoft_outlook_uri = False continue - record.microsoft_outlook_uri = url_join(self._get_microsoft_endpoint(), 'authorize?%s' % url_encode({ - 'client_id': microsoft_outlook_client_id, - 'response_type': 'code', - 'redirect_uri': url_join(base_url, '/microsoft_outlook/confirm'), - 'response_mode': 'query', - # offline_access is needed to have the refresh_token - 'scope': 'offline_access %s' % self._OUTLOOK_SCOPE, - 'state': json.dumps({ - 'model': record._name, - 'id': record.id, - 'csrf_token': record._get_outlook_csrf_token(), - }) - })) + record.microsoft_outlook_uri = url_join( + self._get_microsoft_endpoint(), + "authorize?%s" + % url_encode( + { + "client_id": microsoft_outlook_client_id, + "response_type": "code", + "redirect_uri": url_join( + base_url, "/microsoft_outlook/confirm" + ), + "response_mode": "query", + # offline_access is needed to have the refresh_token + "scope": "offline_access %s" % self._OUTLOOK_SCOPE, + "state": json.dumps( + { + "model": record._name, + "id": record.id, + "csrf_token": record._get_outlook_csrf_token(), + } + ), + } + ), + ) @api.depends('use_microsoft_outlook_service', 'company_id') def _compute_outlook_uri(self):