From 7d9a9d5099bf954628674297068a93965f8137a9 Mon Sep 17 00:00:00 2001 From: x620 Date: Fri, 6 May 2016 16:17:22 +0500 Subject: [PATCH] [ADD] show reply button for messages which haven't record_name [IMP] in reply form in subject field set message.subject value which haven't message.record_name attribute --- mail_reply/__init__.py | 1 + mail_reply/__openerp__.py | 11 +++++++++-- mail_reply/static/src/js/mail_reply.js | 22 ++++++++++++++++++++++ mail_reply/static/src/xml/reply_button.xml | 10 ++++++++++ mail_reply/templates.xml | 12 ++++++++++++ 5 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 mail_reply/__init__.py create mode 100644 mail_reply/static/src/js/mail_reply.js create mode 100644 mail_reply/static/src/xml/reply_button.xml create mode 100644 mail_reply/templates.xml diff --git a/mail_reply/__init__.py b/mail_reply/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/mail_reply/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/mail_reply/__openerp__.py b/mail_reply/__openerp__.py index 6348747..8841edf 100644 --- a/mail_reply/__openerp__.py +++ b/mail_reply/__openerp__.py @@ -12,9 +12,16 @@ #"price": 9.00, #"currency": "EUR", - "depends": [], + "depends": [ + "mail_base", + ], "external_dependencies": {"python": [], "bin": []}, - "data": [], + "data": [ + 'templates.xml' + ], + "qweb": [ + "static/src/xml/reply_button.xml", + ], "demo": [], "installable": True, "auto_install": False, diff --git a/mail_reply/static/src/js/mail_reply.js b/mail_reply/static/src/js/mail_reply.js new file mode 100644 index 0000000..8957248 --- /dev/null +++ b/mail_reply/static/src/js/mail_reply.js @@ -0,0 +1,22 @@ +odoo.define('mail_reply.reply', function (require) { +"use strict"; + +var core = require('web.core'); +var base_obj = require('mail_base.base'); + +var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); +ChatAction.include({ + select_message: function(message_id) { + this._super.apply(this, arguments); + var message = base_obj.chat_manager.get_message(message_id); + var subject = ''; + if (message.record_name){ + subject = "Re: " + message.record_name; + } else if (message.subject){ + subject = "Re: " + message.subject; + } + this.extended_composer.set_subject(subject); + } +}); + +}); diff --git a/mail_reply/static/src/xml/reply_button.xml b/mail_reply/static/src/xml/reply_button.xml new file mode 100644 index 0000000..8b7cb2d --- /dev/null +++ b/mail_reply/static/src/xml/reply_button.xml @@ -0,0 +1,10 @@ + + diff --git a/mail_reply/templates.xml b/mail_reply/templates.xml new file mode 100644 index 0000000..f75bd81 --- /dev/null +++ b/mail_reply/templates.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file