Browse Source

[IMP] Added button to print emials to mail message view

pull/69/head
Mathias Francke 8 years ago
parent
commit
54c2fc1500
  1. 1
      mail_print/README.rst
  2. 5
      mail_print/__openerp__.py
  3. 4
      mail_print/static/src/css/mail.css
  4. 17
      mail_print/static/src/js/mail.js
  5. 8
      mail_print/static/src/xml/mail.xml
  6. 12
      mail_print/views/templates.xml

1
mail_print/README.rst

@ -28,6 +28,7 @@ Contributors
------------ ------------
* Rami Alwafaie <rami.alwafaie@initos.com> * Rami Alwafaie <rami.alwafaie@initos.com>
* Mathias Francke <mathias.francke@initos.com>
Maintainer Maintainer
---------- ----------

5
mail_print/__openerp__.py

@ -14,9 +14,14 @@
'depends': [ 'depends': [
'report', 'report',
'mail', 'mail',
'web',
], ],
'data': [ 'data': [
'report.xml', 'report.xml',
'views/mail_message_report.xml', 'views/mail_message_report.xml',
'views/templates.xml',
],
'qweb': [
'static/src/xml/mail.xml',
], ],
} }

4
mail_print/static/src/css/mail.css

@ -0,0 +1,4 @@
.openerp .oe_mail .oe_msg .oe_msg_icons .oe_mail_print:hover a{
color: #1FFF10;
text-shadow: 0px 1px #149E0B,0px -1px #149E0B, -1px 0px #149E0B, 1px 0px #149E0B, 0px 3px 3px rgba(0,0,0,0.1);
}

17
mail_print/static/src/js/mail.js

@ -0,0 +1,17 @@
openerp.mail_print = function(instance) {
instance.mail.ThreadMessage.include({
bind_events: function () {
this._super();
this.$('.oe_mail_print').on('click', this.on_mail_print);
},
on_mail_print: function (event) {
event.preventDefault();
this.session.get_file({
'url': '/report/download',
'data': {'data': '["/report/pdf/mail_print.mail_message/' + this.id + '","qweb-pdf"]'}
});
}
});
};

8
mail_print/static/src/xml/mail.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="mail.thread.message">
<t t-jquery="div[class=oe_msg_center] div[class=oe_msg_icons]" t-operation="append">
<span class='oe_mail_print'><a title="Print Email" class="oe_e">&lt;</a></span>
</t>
</t>
</templates>

12
mail_print/views/templates.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="mail_print assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/mail_print/static/src/js/mail.js"></script>
<link rel="stylesheet" href="/mail_print/static/src/css/mail.css"/>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save