From a2f22489c06d2ee6a2542fd0226fa46ef0ceb8f0 Mon Sep 17 00:00:00 2001 From: hkapatel Date: Tue, 15 Jun 2021 17:07:19 +0530 Subject: [PATCH] [MIG] sql_export_mail: Migration to 14.0 --- sql_export_mail/README.rst | 11 +-- sql_export_mail/__manifest__.py | 7 +- sql_export_mail/i18n/fr.po | 68 +++++++++++++---- sql_export_mail/i18n/sql_export_mail.pot | 74 ++++++++++++++++--- sql_export_mail/models/sql_export.py | 10 +-- sql_export_mail/readme/CONTRIBUTORS.rst | 1 + sql_export_mail/static/description/index.html | 7 +- sql_export_mail/views/sql_export_view.xml | 2 +- 8 files changed, 132 insertions(+), 48 deletions(-) diff --git a/sql_export_mail/README.rst b/sql_export_mail/README.rst index d00fbc453..89058c698 100644 --- a/sql_export_mail/README.rst +++ b/sql_export_mail/README.rst @@ -14,13 +14,13 @@ SQL Export Mail :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github - :target: https://github.com/OCA/server-tools/tree/12.0/sql_export_mail + :target: https://github.com/OCA/server-tools/tree/14.0/sql_export_mail :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-12-0/server-tools-12-0-sql_export_mail + :target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-sql_export_mail :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/12.0 + :target: https://runbot.odoo-community.org/runbot/149/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -49,7 +49,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -65,6 +65,7 @@ Contributors ~~~~~~~~~~~~ * Florian da Costa +* Helly kapatel Maintainers ~~~~~~~~~~~ @@ -79,6 +80,6 @@ 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. -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/sql_export_mail/__manifest__.py b/sql_export_mail/__manifest__.py index 3edc802aa..278d42817 100644 --- a/sql_export_mail/__manifest__.py +++ b/sql_export_mail/__manifest__.py @@ -1,15 +1,12 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "SQL Export Mail", - "version": "12.0.1.0.0", + "version": "14.0.1.0.0", "category": "Generic Modules", "summary": "Send csv file generated by sql query by mail.", "author": "Akretion, Odoo Community Association (OCA)", "website": "https://github.com/OCA/server-tools", - "depends": [ - "sql_export", - "mail", - ], + "depends": ["sql_export", "mail"], "license": "AGPL-3", "data": [ "views/sql_export_view.xml", diff --git a/sql_export_mail/i18n/fr.po b/sql_export_mail/i18n/fr.po index b308c401e..c616a5c03 100644 --- a/sql_export_mail/i18n/fr.po +++ b/sql_export_mail/i18n/fr.po @@ -19,17 +19,6 @@ msgstr "" #. module: sql_export_mail #: model:mail.template,body_html:sql_export_mail.sql_export_mailer #, fuzzy -#| msgid "" -#| "\n" -#| "
\n" -#| "\n" -#| "

You will find the report ${object.name or ''} as an attachment of the " -#| "mail.

\n" -#| "\n" -#| "
\n" -#| " " msgid "" "\n" "
\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -15,7 +15,8 @@ msgstr "" #. module: sql_export_mail #: model:mail.template,body_html:sql_export_mail.sql_export_mailer -msgid "\n" +msgid "" +"\n" "
\n" "\n" "

You will find the report ${object.name or ''} as an attachment of the mail.

\n" @@ -31,7 +32,34 @@ msgstr "" #. module: sql_export_mail #: model:ir.model.fields,help:sql_export_mail.field_sql_export__mail_user_ids -msgid "Add the users who want to receive the report by e-mail. You need to link the sql query with a cron to send mail automatically" +msgid "" +"Add the users who want to receive the report by e-mail. You need to link the" +" sql query with a cron to send mail automatically" +msgstr "" + +#. module: sql_export_mail +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__assigned_attachment_ids +msgid "Assigned Attachments" +msgstr "" + +#. module: sql_export_mail +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__changeset_change_ids +msgid "Changeset Changes" +msgstr "" + +#. module: sql_export_mail +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__changeset_ids +msgid "Changesets" +msgstr "" + +#. module: sql_export_mail +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__count_pending_changeset_changes +msgid "Count Pending Changeset Changes" +msgstr "" + +#. module: sql_export_mail +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__count_pending_changesets +msgid "Count Pending Changesets" msgstr "" #. module: sql_export_mail @@ -46,14 +74,31 @@ msgid "Crons" msgstr "" #. module: sql_export_mail -#: selection:sql.export,mail_condition:0 +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__display_name +msgid "Display Name" +msgstr "" + +#. module: sql_export_mail +#: model:ir.model.fields.selection,name:sql_export_mail.selection__sql_export__mail_condition__not_empty msgid "File Not Empty" msgstr "" #. module: sql_export_mail -#: code:addons/sql_export_mail/models/sql_export.py:124 +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__id +msgid "ID" +msgstr "" + +#. module: sql_export_mail +#: code:addons/sql_export_mail/models/sql_export.py:0 #, python-format -msgid "It is not possible to execute and send a query automatically by mail if there are parameters to fill" +msgid "" +"It is not possible to execute and send a query automatically by mail if " +"there are parameters to fill" +msgstr "" + +#. module: sql_export_mail +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export____last_update +msgid "Last Modified on" msgstr "" #. module: sql_export_mail @@ -67,11 +112,21 @@ msgid "SQL export" msgstr "" #. module: sql_export_mail -#: code:addons/sql_export_mail/models/sql_export.py:134 +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__smart_search +msgid "Smart Search" +msgstr "" + +#. module: sql_export_mail +#: code:addons/sql_export_mail/models/sql_export.py:0 #, python-format msgid "The user does not have any e-mail address." msgstr "" +#. module: sql_export_mail +#: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__user_can_see_changeset +msgid "User Can See Changeset" +msgstr "" + #. module: sql_export_mail #: model:ir.model.fields,field_description:sql_export_mail.field_sql_export__mail_user_ids msgid "User to notify" @@ -81,4 +136,3 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:sql_export_mail.sql_export_mail_view_form msgid "Users Notified by e-mail" msgstr "" - diff --git a/sql_export_mail/models/sql_export.py b/sql_export_mail/models/sql_export.py index f2a4aae9a..d3529c638 100644 --- a/sql_export_mail/models/sql_export.py +++ b/sql_export_mail/models/sql_export.py @@ -5,7 +5,6 @@ from datetime import datetime, timedelta from odoo import SUPERUSER_ID, _, api, fields, models from odoo.exceptions import UserError -from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT class SqlExport(models.Model): @@ -28,7 +27,6 @@ class SqlExport(models.Model): [("not_empty", "File Not Empty")], default="not_empty" ) - @api.multi def create_cron(self): self.ensure_one() nextcall = datetime.now() + timedelta(hours=2) @@ -51,11 +49,9 @@ class SqlExport(models.Model): cron.write(write_vals) self.write({"cron_ids": [(4, cron.id)]}) - @api.multi def send_mail(self, params=None): self.ensure_one() mail_template = self.env.ref("sql_export_mail.sql_export_mailer") - now_time = datetime.strftime(datetime.now(), DEFAULT_SERVER_DATETIME_FORMAT) attach_obj = self.env["ir.attachment"] if self.mail_condition == "not_empty": res = self._execute_sql_request(params=params, mode="fetchone") @@ -78,8 +74,7 @@ class SqlExport(models.Model): msg_id = mail_template.send_mail(self.id, force_send=False) mail = self.env["mail.mail"].browse(msg_id) attach_vals = { - "name": now_time + " - " + self.name, - "datas_fname": filename, + "name": filename, "datas": binary, "res_model": "mail.mail", "res_id": mail.id, @@ -115,7 +110,6 @@ class SqlExport(models.Model): else: export.send_mail() - @api.multi @api.constrains("field_ids", "mail_user_ids") def check_no_parameter_if_sent_by_mail(self): for export in self: @@ -127,7 +121,6 @@ class SqlExport(models.Model): ) ) - @api.multi @api.constrains("mail_user_ids") def check_mail_user(self): for export in self: @@ -135,7 +128,6 @@ class SqlExport(models.Model): if not user.email: raise UserError(_("The user does not have any e-mail address.")) - @api.multi def get_email_address_for_template(self): """ Called from mail template diff --git a/sql_export_mail/readme/CONTRIBUTORS.rst b/sql_export_mail/readme/CONTRIBUTORS.rst index 0bddb053a..c2183a83d 100644 --- a/sql_export_mail/readme/CONTRIBUTORS.rst +++ b/sql_export_mail/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Florian da Costa +* Helly kapatel diff --git a/sql_export_mail/static/description/index.html b/sql_export_mail/static/description/index.html index b88d51d8e..680790e0e 100644 --- a/sql_export_mail/static/description/index.html +++ b/sql_export_mail/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

Allow to send the result of a query (made with the module sql_export) by mail.

Table of contents

@@ -398,7 +398,7 @@ use it again for other queries

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 smashing it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -413,6 +413,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

Contributors

@@ -422,7 +423,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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.

-

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/sql_export_mail/views/sql_export_view.xml b/sql_export_mail/views/sql_export_view.xml index 19b5402cf..7645c5c44 100644 --- a/sql_export_mail/views/sql_export_view.xml +++ b/sql_export_mail/views/sql_export_view.xml @@ -30,7 +30,7 @@