From 1919902772367d01b4fca35a633fd02f042ecf3a Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Fri, 3 Jun 2022 20:10:54 +0200 Subject: [PATCH] [IMP] black, isort, prettier --- mail_quoted_reply/__manifest__.py | 25 +++----- mail_quoted_reply/data/reply_template.xml | 8 ++- mail_quoted_reply/models/mail_message.py | 16 ++---- .../static/src/js/mail_message_reply.js | 57 +++++++++++-------- .../static/src/xml/mail_message_reply.xml | 13 +++-- mail_quoted_reply/templates/assets.xml | 18 +++--- mail_quoted_reply/tests/test_reply.py | 32 +++++------ 7 files changed, 83 insertions(+), 86 deletions(-) diff --git a/mail_quoted_reply/__manifest__.py b/mail_quoted_reply/__manifest__.py index c7ae279..a7ad4b3 100644 --- a/mail_quoted_reply/__manifest__.py +++ b/mail_quoted_reply/__manifest__.py @@ -2,21 +2,14 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Mail Message Reply', - 'summary': """ + "name": "Mail Message Reply", + "summary": """ Make a reply using a message""", - 'version': '12.0.1.0.0', - 'license': 'AGPL-3', - 'author': 'Creu Blanca,Odoo Community Association (OCA)', - 'website': 'https://github.com/OCA/social', - 'depends': [ - 'mail' - ], - 'qweb': [ - 'static/src/xml/mail_message_reply.xml', - ], - 'data': [ - "templates/assets.xml", - "data/reply_template.xml", - ], + "version": "12.0.1.0.0", + "license": "AGPL-3", + "author": "Creu Blanca,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/social", + "depends": ["mail"], + "qweb": ["static/src/xml/mail_message_reply.xml",], + "data": ["templates/assets.xml", "data/reply_template.xml",], } diff --git a/mail_quoted_reply/data/reply_template.xml b/mail_quoted_reply/data/reply_template.xml index a8668d5..b015098 100644 --- a/mail_quoted_reply/data/reply_template.xml +++ b/mail_quoted_reply/data/reply_template.xml @@ -3,9 +3,11 @@ Reply Re: ${object.subject} - - - + +
diff --git a/mail_quoted_reply/models/mail_message.py b/mail_quoted_reply/models/mail_message.py index b5a1047..f1380e4 100644 --- a/mail_quoted_reply/models/mail_message.py +++ b/mail_quoted_reply/models/mail_message.py @@ -6,26 +6,20 @@ from odoo import models class MailMessage(models.Model): - _inherit = 'mail.message' + _inherit = "mail.message" def reply_message(self): - action = self.env.ref( - "mail.action_email_compose_message_wizard" - ).read()[0] - action['context'] = { + action = self.env.ref("mail.action_email_compose_message_wizard").read()[0] + action["context"] = { "default_model": self._name, "default_res_id": self.id, - "default_template_id": self.env.ref( - "mail_quoted_reply.reply_template" - ).id, + "default_template_id": self.env.ref("mail_quoted_reply.reply_template").id, "default_composition_mode": "comment", "default_is_log": False, "is_log": False, "default_notify": True, "force_email": True, "reassign_to_parent": True, - "default_partner_ids": [ - (6, 0, self.partner_ids.ids) - ] + "default_partner_ids": [(6, 0, self.partner_ids.ids)], } return action diff --git a/mail_quoted_reply/static/src/js/mail_message_reply.js b/mail_quoted_reply/static/src/js/mail_message_reply.js index 6e7c0f6..8f9fc13 100644 --- a/mail_quoted_reply/static/src/js/mail_message_reply.js +++ b/mail_quoted_reply/static/src/js/mail_message_reply.js @@ -1,53 +1,60 @@ /* Copyright 2021 Creu Blanca * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ - odoo.define('mail_quote_reply.reply', function (require) { +odoo.define("mail_quote_reply.reply", function(require) { "use strict"; - var ThreadWidget = require('mail.widget.Thread'); - var ThreadField = require('mail.ThreadField'); - var DocumentThread = require('mail.model.DocumentThread'); + var ThreadWidget = require("mail.widget.Thread"); + var ThreadField = require("mail.ThreadField"); + var DocumentThread = require("mail.model.DocumentThread"); DocumentThread.include({ _fetchMessages: function(options) { if (options && options.forceReloadMessages) { this._mustFetchMessageIDs = true; } - return this._super.apply(this, arguments) - } + return this._super.apply(this, arguments); + }, }); ThreadField.include({ - start: function () { + start: function() { var self = this; - return this._super.apply(this, arguments).then(function () { - self._threadWidget.on('reload_thread_messages', self, self._onReloadThreadMessages); - }) + return this._super.apply(this, arguments).then(function() { + self._threadWidget.on( + "reload_thread_messages", + self, + self._onReloadThreadMessages + ); + }); }, - _onReloadThreadMessages: function () { - this._fetchAndRenderThread({forceReloadMessages: true }); + _onReloadThreadMessages: function() { + this._fetchAndRenderThread({forceReloadMessages: true}); }, }); ThreadWidget.include({ - events: _.defaults({ - "click .o_thread_mail_message_reply": "_onClickMailMessageReply", - }, ThreadWidget.prototype.events), + events: _.defaults( + { + "click .o_thread_mail_message_reply": "_onClickMailMessageReply", + }, + ThreadWidget.prototype.events + ), _onClickMailMessageReply: function(event) { var self = this, - msg_id = $(event.currentTarget).data('message-id'); + msg_id = $(event.currentTarget).data("message-id"); this._rpc({ - model: "mail.message", - method: "reply_message", - args: [msg_id], - }).then(function (result) { - self.do_action(result, { - on_close: function () { - self.trigger('reload_thread_messages'); - }, - }); + model: "mail.message", + method: "reply_message", + args: [msg_id], + }).then(function(result) { + self.do_action(result, { + on_close: function() { + self.trigger("reload_thread_messages"); + }, }); + }); }, }); }); diff --git a/mail_quoted_reply/static/src/xml/mail_message_reply.xml b/mail_quoted_reply/static/src/xml/mail_message_reply.xml index fe3de0d..fc4b135 100644 --- a/mail_quoted_reply/static/src/xml/mail_message_reply.xml +++ b/mail_quoted_reply/static/src/xml/mail_message_reply.xml @@ -1,12 +1,17 @@ - + diff --git a/mail_quoted_reply/templates/assets.xml b/mail_quoted_reply/templates/assets.xml index 261ca0b..b53fdf6 100644 --- a/mail_quoted_reply/templates/assets.xml +++ b/mail_quoted_reply/templates/assets.xml @@ -1,17 +1,19 @@ - - + - -