Browse Source

Merge pull request #69 from initOS/8.0-mail_print

mail_print module
pull/86/head
Rafael Blasco 8 years ago
committed by GitHub
parent
commit
55810f6285
  1. 47
      mail_print/README.rst
  2. 3
      mail_print/__init__.py
  3. 27
      mail_print/__openerp__.py
  4. 47
      mail_print/i18n/de.po
  5. 15
      mail_print/report.xml
  6. 4
      mail_print/static/src/css/mail.css
  7. 17
      mail_print/static/src/js/mail.js
  8. 8
      mail_print/static/src/xml/mail.xml
  9. 56
      mail_print/views/mail_message_report.xml
  10. 12
      mail_print/views/templates.xml

47
mail_print/README.rst

@ -0,0 +1,47 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
==========
Mail Print
==========
This module makes pdf reports from the Emails, so the user will be able to print them.
Usage
=====
* go to Technical -> Email -> Messages -> select the Email -> Print
* Emails can be also downloaded directly from The Messaging dashboard
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/social/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.
Credits
=======
Contributors
------------
* Rami Alwafaie <rami.alwafaie@initos.com>
* Mathias Francke <mathias.francke@initos.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.
To contribute to this module, please visit https://odoo-community.org.

3
mail_print/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
# © initOS GmbH 2016
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

27
mail_print/__openerp__.py

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# © initOS GmbH 2016
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Print Emails",
'summary': """
PDF Reports to print the emails
""",
'author': "initOS GmbH, Odoo Community Association (OCA)",
'website': "http://www.initos.com",
'version': '8.0.1.0.0',
'license': 'AGPL-3',
'depends': [
'report',
'mail',
'web',
],
'data': [
'report.xml',
'views/mail_message_report.xml',
'views/templates.xml',
],
'qweb': [
'static/src/xml/mail.xml',
],
}

47
mail_print/i18n/de.po

@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_print
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-10 13:16+0000\n"
"PO-Revision-Date: 2016-06-10 15:18+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 1.5.4\n"
#. module: mail_print
#: view:website:mail_print.mail_message
msgid "Attachments"
msgstr "Anhänge"
#. module: mail_print
#: view:website:mail_print.mail_message
msgid "Date:"
msgstr "Datum:"
#. module: mail_print
#: model:ir.actions.report.xml,name:mail_print.mail_message_pdf
msgid "Email"
msgstr "Email"
#. module: mail_print
#: view:website:mail_print.mail_message
msgid "From:"
msgstr "Von:"
#. module: mail_print
#: view:website:mail_print.mail_message
msgid "Subject:"
msgstr "Betreff:"
#. module: mail_print
#: view:website:mail_print.mail_message
msgid "To:"
msgstr "An:"

15
mail_print/report.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
id="mail_message_pdf"
model="mail.message"
string="Email"
report_type="qweb-pdf"
name="mail_print.mail_message"
file="mail_print.mail_message"
/>
</data>
</openerp>

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>

56
mail_print/views/mail_message_report.xml

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="mail_message">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page">
<style>
.space {padding-right: 0.3em;}
</style>
<table class="table-condensed">
<tr>
<th>From:</th>
<td><u><span t-field="o.email_from"/></u></td>
</tr>
<tr>
<th>To:</th>
<td t-foreach="o.partner_ids" t-as="p"><span t-field="p.name"/> <t t-if="p.email"> <u><span t-field="p.email"></span></u></t></td>
</tr>
<tr>
<th>Subject:</th>
<td><span t-field="o.subject"/></td>
</tr>
<tr>
<th><span>Date:</span></th>
<td><span t-field="o.date"/></td>
</tr>
</table>
<div style ="height: 1cm"> </div>
<table class="table-condensed">
<tr>
<td><span t-field="o.body"/></td>
</tr>
</table>
<t t-if="o.attachment_ids" >
<div style ="height: 2cm"> </div>
<table class="table table-condensed">
<tr>
<th>Attachments</th>
</tr>
<tr t-foreach="o.attachment_ids" t-as="l">
<td><span t-field="l.name"/></td>
<td><span class="space" t-field="l.file_size"></span><span>Bytes</span></td>
</tr>
</table>
</t>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>

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