From d401e01e10ad61ee8b458b729338ddabf947576f Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Wed, 12 Feb 2020 08:55:10 +0000 Subject: [PATCH] :green_heart: pre-commit: auto cleanups --- .DINAR/image/README.md | 6 +- .DINAR/image/src/addons.yaml | 1 - .eslintrc.yml | 2 +- .github/workflows/main.yml | 17 +- .isort.cfg | 2 +- .travis.yml | 19 +- mail_all/__manifest__.py | 24 +- mail_all/static/src/css/mail_all.css | 2 +- mail_all/static/src/js/mail_all.js | 77 +-- mail_all/static/src/js/test_mail_all.js | 32 +- mail_all/static/src/xml/menu.xml | 11 +- mail_all/tests/test_js.py | 17 +- mail_all/views/templates.xml | 22 +- mail_archives/__manifest__.py | 23 +- mail_archives/static/src/css/archives.css | 2 +- mail_archives/static/src/js/archives.js | 159 +++--- mail_archives/static/src/xml/menu.xml | 12 +- mail_archives/tests/__init__.py | 1 - mail_archives/tests/test_js.py | 17 +- mail_archives/views/templates.xml | 20 +- mail_base/__init__.py | 1 - mail_base/__manifest__.py | 18 +- mail_base/controllers/main.py | 4 +- mail_base/models.py | 21 +- mail_base/tests/__init__.py | 1 - mail_base/tests/test_default.py | 7 +- mail_base/views/templates.xml | 12 +- mail_check_immediately/__manifest__.py | 26 +- mail_check_immediately/models.py | 49 +- mail_check_immediately/static/src/js/main.js | 52 +- .../static/src/xml/main.xml | 14 +- mail_check_immediately/views.xml | 11 +- mail_fix_553/__manifest__.py | 4 +- mail_fix_553/data.xml | 2 +- mail_fix_553/mail_fix_553.py | 148 +++-- mail_move_message/__manifest__.py | 33 +- mail_move_message/controllers/main.py | 5 +- .../data/mail_move_message_data.xml | 3 +- mail_move_message/doc/index.rst | 6 +- mail_move_message/mail_move_message_models.py | 524 +++++++++++------- mail_move_message/mail_move_message_views.xml | 135 +++-- .../static/src/css/mail_move_message.css | 5 +- .../static/src/js/mail_move_message.js | 149 ++--- .../static/src/xml/mail_move_message_main.xml | 11 +- mail_move_message/tests/__init__.py | 1 - mail_move_message/tests/test_mail_move.py | 13 +- mail_multi_website/__init__.py | 18 +- mail_multi_website/__manifest__.py | 15 +- mail_multi_website/doc/index.rst | 2 +- mail_multi_website/models/ir_property.py | 12 +- mail_multi_website/models/mail_message.py | 8 +- mail_multi_website/models/mail_template.py | 112 ++-- mail_multi_website/models/mail_thread.py | 29 +- mail_multi_website/models/res_users.py | 18 +- mail_multi_website/models/website.py | 6 +- mail_multi_website/tests/test_fetch.py | 53 +- mail_multi_website/tests/test_mail_model.py | 16 +- mail_multi_website/tests/test_render.py | 147 ++--- mail_multi_website/tests/test_send.py | 49 +- mail_multi_website/views/website_views.xml | 6 +- .../wizard/mail_compose_message.py | 12 +- mail_private/__manifest__.py | 21 +- mail_private/full_composer_wizard.xml | 15 +- mail_private/models.py | 78 ++- mail_private/static/src/js/mail_private.js | 485 ++++++++-------- mail_private/static/src/js/test_private.js | 67 ++- mail_private/static/src/xml/mail_private.xml | 16 +- mail_private/template.xml | 19 +- mail_private/tests/test_js.py | 16 +- mail_recovery/__manifest__.py | 22 +- mail_recovery/data.xml | 13 +- mail_recovery/static/src/js/mail_recovery.js | 14 +- mail_reply/__manifest__.py | 14 +- mail_reply/doc/index.rst | 2 +- mail_reply/static/src/js/mail_reply.js | 76 +-- mail_reply/static/src/xml/reply_button.xml | 14 +- mail_reply/templates.xml | 15 +- mail_reply/tests/__init__.py | 1 - mail_reply/tests/test_default.py | 7 +- mail_sent/__manifest__.py | 23 +- mail_sent/models.py | 38 +- mail_sent/static/src/css/sent.css | 2 +- mail_sent/static/src/js/sent.js | 155 +++--- mail_sent/static/src/xml/menu.xml | 15 +- mail_sent/tests/__init__.py | 1 - mail_sent/tests/test_js.py | 17 +- mail_sent/views/templates.xml | 14 +- mail_to/__manifest__.py | 16 +- mail_to/static/src/xml/recipient.xml | 15 +- mail_to/templates.xml | 12 +- mail_to/tests/test_default.py | 47 +- mailgun/__manifest__.py | 23 +- mailgun/controllers/main.py | 16 +- mailgun/data/ir_cron_data.xml | 6 +- mailgun/models/ir_config_parameter.py | 21 +- mailgun/models/mail_thread.py | 19 +- res_partner_company_messages/__manifest__.py | 22 +- res_partner_company_messages/models.py | 16 +- res_partner_company_messages/views.xml | 2 +- res_partner_mails_count/__manifest__.py | 14 +- res_partner_mails_count/models.py | 15 +- .../src/js/res_partner_mails_count_tour.js | 44 +- res_partner_mails_count/templates.xml | 35 +- res_partner_mails_count/tests/__init__.py | 2 +- res_partner_mails_count/tests/test_mail.py | 65 ++- res_partner_mails_count/tests/test_phantom.py | 17 +- .../views/res_partner_mails_count.xml | 2 +- 107 files changed, 2172 insertions(+), 1621 deletions(-) diff --git a/.DINAR/image/README.md b/.DINAR/image/README.md index 8175f2a..e6e2e05 100644 --- a/.DINAR/image/README.md +++ b/.DINAR/image/README.md @@ -1,2 +1,4 @@ -This folder is attached on image building as `custom/` folder in [doobba](https://github.com/Tecnativa/doodba#image-usage). -Few additional [files](https://github.com/itpp-labs/DINAR/tree/master/embedded-files/.DINAR/image) are attached temporary on image building. +This folder is attached on image building as `custom/` folder in +[doobba](https://github.com/Tecnativa/doodba#image-usage). Few additional +[files](https://github.com/itpp-labs/DINAR/tree/master/embedded-files/.DINAR/image) are +attached temporary on image building. diff --git a/.DINAR/image/src/addons.yaml b/.DINAR/image/src/addons.yaml index 3689f07..9d0e1c7 100644 --- a/.DINAR/image/src/addons.yaml +++ b/.DINAR/image/src/addons.yaml @@ -1,5 +1,4 @@ # see https://github.com/Tecnativa/doodba#optodoocustomsrcaddonsyaml - --- ENV: DEFAULT_REPO_PATTERN: https://github.com/it-projects-llc/{}.git diff --git a/.eslintrc.yml b/.eslintrc.yml index 9657d44..0b81ecd 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -133,7 +133,7 @@ rules: no-unused-labels: error no-unused-vars: - error - - args: none + - args: none no-use-before-define: error no-useless-call: warn no-useless-computed-key: warn diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58f7d5e..0db37d9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,16 +1,19 @@ name: Telegram Notifications -on: +on: issues: types: [opened, reopened, deleted, closed] jobs: notify: - runs-on: ubuntu-latest - + steps: - - name: Send notifications to Telegram - run: curl -s -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage -d chat_id=${{ secrets.TELEGRAM_CHAT_ID }} -d text="${MESSAGE}" >> /dev/null - env: - MESSAGE: "Issue ${{ github.event.action }}: \n${{ github.event.issue.html_url }}" + - name: Send notifications to Telegram + run: + curl -s -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN + }}/sendMessage -d chat_id=${{ secrets.TELEGRAM_CHAT_ID }} -d text="${MESSAGE}" + >> /dev/null + env: + MESSAGE: + "Issue ${{ github.event.action }}: \n${{ github.event.issue.html_url }}" diff --git a/.isort.cfg b/.isort.cfg index 5751c40..f60f5e2 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -9,4 +9,4 @@ line_length=88 known_odoo=odoo known_odoo_addons=odoo.addons sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER -known_third_party= +known_third_party=openerp,requests,simplejson,werkzeug diff --git a/.travis.yml b/.travis.yml index 855b9f9..e400171 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,23 +12,24 @@ addons: postgresql: "9.5" apt: packages: - - expect-dev # provides unbuffer utility - - python-lxml # because pip installation is slow + - expect-dev # provides unbuffer utility + - python-lxml # because pip installation is slow env: global: - - VERSION="13.0" TESTS="0" LINT_CHECK="0" UNIT_TEST="0" - - PYLINT_ODOO_JSLINTRC="/home/travis/maintainer-quality-tools/travis/cfg/.jslintrc" + - VERSION="13.0" TESTS="0" LINT_CHECK="0" UNIT_TEST="0" + - PYLINT_ODOO_JSLINTRC="/home/travis/maintainer-quality-tools/travis/cfg/.jslintrc" matrix: - - LINT_CHECK="1" - - CHECK_TAGS="1" - - TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1" - - TESTS="1" ODOO_REPO="OCA/OCB" + - LINT_CHECK="1" + - CHECK_TAGS="1" + - TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1" + - TESTS="1" ODOO_REPO="OCA/OCB" install: - pip install anybox.testing.openerp - - git clone https://github.com/it-projects-llc/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools + - git clone https://github.com/it-projects-llc/maintainer-quality-tools.git + ${HOME}/maintainer-quality-tools - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - travis_install_nightly diff --git a/mail_all/__manifest__.py b/mail_all/__manifest__.py index 955c037..d85ba04 100644 --- a/mail_all/__manifest__.py +++ b/mail_all/__manifest__.py @@ -7,34 +7,24 @@ "summary": """Checkout all messages where you have access""", "category": "Discuss", # "live_test_url": "", - "images": ['images/1.jpg'], + "images": ["images/1.jpg"], "version": "12.0.1.0.1", "application": False, - "author": "IT-Projects LLC, Pavel Romanchenko", "support": "apps@it-projects.info", "website": "https://it-projects.info", "license": "LGPL-3", - 'price': 40.00, - 'currency': 'EUR', - - "depends": [ - "mail" - ], + "price": 40.00, + "currency": "EUR", + "depends": ["mail"], "external_dependencies": {"python": [], "bin": []}, - "data": [ - "views/templates.xml", - ], - "qweb": [ - "static/src/xml/menu.xml", - ], + "data": ["views/templates.xml",], + "qweb": ["static/src/xml/menu.xml",], "demo": [], - "post_load": None, "pre_init_hook": None, "post_init_hook": None, "uninstall_hook": None, - - 'installable': False, + "installable": False, "auto_install": False, } diff --git a/mail_all/static/src/css/mail_all.css b/mail_all/static/src/css/mail_all.css index 010e720..0b13d18 100644 --- a/mail_all/static/src/css/mail_all.css +++ b/mail_all/static/src/css/mail_all.css @@ -1,3 +1,3 @@ .o_channel_name.mail_all i { margin-right: 4px; -} \ No newline at end of file +} diff --git a/mail_all/static/src/js/mail_all.js b/mail_all/static/src/js/mail_all.js index 8f0f79f..4cfb4ca 100644 --- a/mail_all/static/src/js/mail_all.js +++ b/mail_all/static/src/js/mail_all.js @@ -2,49 +2,50 @@ # Copyright 2017-2018 Artyom Losev # Copyright 2018 Kolushov Alexandr # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */ -odoo.define('mail_all.all', function (require) { -"use strict"; +odoo.define("mail_all.all", function(require) { + "use strict"; -var core = require('web.core'); -var Manager = require('mail.Manager'); -var Mailbox = require('mail.model.Mailbox'); + var core = require("web.core"); + var Manager = require("mail.Manager"); + var Mailbox = require("mail.model.Mailbox"); -var _t = core._t; + var _t = core._t; -Manager.include({ - _updateMailboxesFromServer: function (data) { - var self = this; - this._super(data); - if (!_.find(this.getThreads(), function(th){ - return th.getID() === 'mailbox_channel_all'; - })) { - this._addMailbox({ - id: 'channel_all', - name: _t("All Messages"), - mailboxCounter: 0, - }); - } - }, + Manager.include({ + _updateMailboxesFromServer: function(data) { + var self = this; + this._super(data); + if ( + !_.find(this.getThreads(), function(th) { + return th.getID() === "mailbox_channel_all"; + }) + ) { + this._addMailbox({ + id: "channel_all", + name: _t("All Messages"), + mailboxCounter: 0, + }); + } + }, - _makeMessage: function (data) { - var message = this._super(data); - message._addThread('mailbox_channel_all'); - return message; - }, -}); + _makeMessage: function(data) { + var message = this._super(data); + message._addThread("mailbox_channel_all"); + return message; + }, + }); -Mailbox.include({ - _getThreadDomain: function () { - if (this._id === 'mailbox_channel_all') { - return []; - } - return this._super(); - }, -}); + Mailbox.include({ + _getThreadDomain: function() { + if (this._id === "mailbox_channel_all") { + return []; + } + return this._super(); + }, + }); -return { - 'Manager': Manager, - 'Mailbox': Mailbox, + return { + Manager: Manager, + Mailbox: Mailbox, }; - }); diff --git a/mail_all/static/src/js/test_mail_all.js b/mail_all/static/src/js/test_mail_all.js index 2352e1a..af52b95 100644 --- a/mail_all/static/src/js/test_mail_all.js +++ b/mail_all/static/src/js/test_mail_all.js @@ -1,29 +1,33 @@ /* # Copyright 2018 Kolushov Alexandr # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */ -odoo.define('mail_all.tour', function (require) { +odoo.define("mail_all.tour", function(require) { "use strict"; var tour = require("web_tour.tour"); - var core = require('web.core'); + var core = require("web.core"); var _t = core._t; - - var steps = [{ + var steps = [ + { trigger: 'a.full[href="#"]', content: _t("Click to open app list"), - position: 'bottom', - }, { + position: "bottom", + }, + { trigger: 'a.dropdown-item.o_app:contains("Discuss")', content: _t("Click to enter menu discuss"), - position: 'bottom', - }, { + position: "bottom", + }, + { content: _t("Open All Messages"), - trigger: '.o_channel_name.mail_all', - }, { + trigger: ".o_channel_name.mail_all", + }, + { content: _t("Check that All Messages are opened"), - trigger: '.o_mail_discuss_title_main.o_mail_mailbox_title_all.o_mail_discuss_item.o_active', - }]; - - tour.register('tour_mail_all', { test: true, url: '/web' }, steps); + trigger: + ".o_mail_discuss_title_main.o_mail_mailbox_title_all.o_mail_discuss_item.o_active", + }, + ]; + tour.register("tour_mail_all", {test: true, url: "/web"}, steps); }); diff --git a/mail_all/static/src/xml/menu.xml b/mail_all/static/src/xml/menu.xml index 747ba10..fc6b846 100644 --- a/mail_all/static/src/xml/menu.xml +++ b/mail_all/static/src/xml/menu.xml @@ -1,4 +1,4 @@ - + @@ -6,8 +6,13 @@ -
- All messages +
+ All messages
diff --git a/mail_all/tests/test_js.py b/mail_all/tests/test_js.py index bc41db4..7d9c09f 100644 --- a/mail_all/tests/test_js.py +++ b/mail_all/tests/test_js.py @@ -9,16 +9,19 @@ import odoo.tests @odoo.tests.common.at_install(True) @odoo.tests.common.post_install(True) class TestUi(odoo.tests.HttpCase): - def test_01_mail_all(self): # needed because tests are run before the module is marked as # installed. In js web will only load qweb coming from modules # that are returned by the backend in module_boot. Without # this you end up with js, css but no qweb. - self.env['ir.module.module'].search([('name', '=', 'mail_all')], limit=1).state = 'installed' + self.env["ir.module.module"].search( + [("name", "=", "mail_all")], limit=1 + ).state = "installed" - link = '/web#action=%s' % self.ref('mail.action_discuss') - self.phantom_js(link, - "odoo.__DEBUG__.services['web_tour.tour'].run('tour_mail_all', 1000)", - "odoo.__DEBUG__.services['web_tour.tour'].tours.tour_mail_all.ready", - login="admin") + link = "/web#action=%s" % self.ref("mail.action_discuss") + self.phantom_js( + link, + "odoo.__DEBUG__.services['web_tour.tour'].run('tour_mail_all', 1000)", + "odoo.__DEBUG__.services['web_tour.tour'].tours.tour_mail_all.ready", + login="admin", + ) diff --git a/mail_all/views/templates.xml b/mail_all/views/templates.xml index cd1749d..5fbf449 100644 --- a/mail_all/views/templates.xml +++ b/mail_all/views/templates.xml @@ -1,16 +1,24 @@ - + -