Browse Source

[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
pull/21/head
x620 9 years ago
parent
commit
7d9a9d5099
  1. 1
      mail_reply/__init__.py
  2. 11
      mail_reply/__openerp__.py
  3. 22
      mail_reply/static/src/js/mail_reply.js
  4. 10
      mail_reply/static/src/xml/reply_button.xml
  5. 12
      mail_reply/templates.xml

1
mail_reply/__init__.py

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

11
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,

22
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);
}
});
});

10
mail_reply/static/src/xml/reply_button.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<t t-extend="mail.ChatThread.Message">
<t t-jquery='i[class="fa fa-reply o_thread_message_reply"]' t-operation="replace">
<i t-if="message.model != 'mail.channel' &amp;&amp; options.display_reply_icon"
class="fa fa-reply o_thread_message_reply"
t-att-data-message-id="message.id" title="Reply"/>
</t>
</t>
</template>

12
mail_reply/templates.xml

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<openerp>
<data>
<template id="mail_reply_assets_backend"
name="mail_reply_assets_backend"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script src="/mail_reply/static/src/js/mail_reply.js" type="text/javascript"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save