Browse Source
Move mail_forward module from [odoo-grupoesoc-addons][1]
Move mail_forward module from [odoo-grupoesoc-addons][1]
[1]: https://github.com/grupoesoc/odoo-grupoesoc-addonspull/12/head
Jairo Llopis
9 years ago
12 changed files with 823 additions and 0 deletions
-
102mail_forward/README.rst
-
5mail_forward/__init__.py
-
26mail_forward/__openerp__.py
-
394mail_forward/i18n/es.po
-
BINmail_forward/static/description/icon.png
-
12mail_forward/static/src/css/mail_forward.css
-
65mail_forward/static/src/js/mail_forward.js
-
14mail_forward/static/src/xml/mail_forward.xml
-
21mail_forward/views/assets.xml
-
0mail_forward/wizard/__init__.py
-
120mail_forward/wizard/mail_forward.py
-
64mail_forward/wizard/mail_forward.xml
@ -0,0 +1,102 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
=============== |
|||
Message forward |
|||
=============== |
|||
|
|||
This module was written to extend the functionality of mails to support |
|||
forwarding them to another contact or database object. |
|||
|
|||
* **To another object of the database:** |
|||
* All its followers are notified according to their settings. |
|||
* **To other contacts:** |
|||
* They recieve the forwarded message according to the usual notification |
|||
rules of Odoo. |
|||
|
|||
Installation |
|||
============ |
|||
|
|||
When installed, this module allows forwarding to the following database |
|||
objects: |
|||
|
|||
* ``crm.lead`` |
|||
* ``crm.meeting`` |
|||
* ``crm.phonecall`` |
|||
* ``mail.group`` |
|||
* ``note.note`` |
|||
* ``product.product`` |
|||
* ``project.project`` |
|||
* ``project.task`` |
|||
* ``res.partner`` |
|||
* ``sale.order`` |
|||
|
|||
Of course, if some of those are not available in your database, they will be |
|||
hidden until you install the module that adds them. |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
To use this module, you need to: |
|||
|
|||
* Go to any view that has a message thread. |
|||
* Press *Forward* (the button with a curved arrow pointing to the right). |
|||
* Modify the subject if you wish. |
|||
* If you want to forward the message to an *object*, choose it from the |
|||
selector. |
|||
* If you want to forward the message to some partner(s), add them in the |
|||
selector. |
|||
* Modify the message if you want. |
|||
* Add attachments if you want. |
|||
* If the message contains attachments, you can turn on the *Move attachments* |
|||
option, and those will get attached to the new object. |
|||
|
|||
You will need to install the *document* module and have at least *User* |
|||
permissions for *Knowledge* to see the effect. |
|||
|
|||
.. info:: |
|||
Technical note: Internally, forwarded messages are modified copies of |
|||
original ones, but attachments are references to the exact originals to |
|||
avoid duplicating disk space. Keep that in mind when managing permissions. |
|||
|
|||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/205/8.0 |
|||
|
|||
For further information, please visit: |
|||
|
|||
* https://www.odoo.com/forum/help-1 |
|||
|
|||
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 `here |
|||
<https://github.com/OCA/social/issues/new?body=module:%20mail_forward%0Aversion:%208.0.6.0.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Jairo Llopis <j.llopis@grupoesoc.es> |
|||
|
|||
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 http://odoo-community.org. |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from .wizard import mail_forward |
@ -0,0 +1,26 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
{ |
|||
"name": "Message Forward", |
|||
"summary": "Add option to forward messages", |
|||
"version": "8.0.6.0.0", |
|||
"category": "Social Network", |
|||
"website": "http://www.grupoesoc.es, https://odoo-community.org/", |
|||
"author": "Grupo ESOC, Odoo Community Association (OCA)", |
|||
"license": "AGPL-3", |
|||
"application": False, |
|||
"installable": True, |
|||
"depends": [ |
|||
"mail", |
|||
"web", |
|||
], |
|||
"data": [ |
|||
"wizard/mail_forward.xml", |
|||
"views/assets.xml", |
|||
], |
|||
"qweb": [ |
|||
"static/src/xml/mail_forward.xml", |
|||
], |
|||
} |
@ -0,0 +1,394 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * mail_forward |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-12-11 10:00+0000\n" |
|||
"PO-Revision-Date: 2014-12-11 11:07+0100\n" |
|||
"Last-Translator: Jairo Llopis <j.llopis@grupoesoc.es>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"X-Generator: Poedit 1.5.4\n" |
|||
"Language: es_ES\n" |
|||
|
|||
#. module: mail_forward |
|||
#. openerp-web |
|||
#: code:addons/mail_forward/static/src/js/mail_forward.js:37 |
|||
#, python-format |
|||
msgid "(No subject)" |
|||
msgstr "(Sin asunto)" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,active_domain:0 |
|||
msgid "Active domain" |
|||
msgstr "Dominio activo" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,partner_ids:0 |
|||
msgid "Additional contacts" |
|||
msgstr "Contactos adicionales" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,no_auto_thread:0 |
|||
msgid "" |
|||
"Answers do not go in the original document' discussion thread. This has an " |
|||
"impact on the generated message-id." |
|||
msgstr "" |
|||
"Las respuestas no van en el hilo de discusión original del documento. Esto " |
|||
"tiene un impacto en el ID generado para el mensaje." |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,attachment_ids:0 |
|||
msgid "Attachments" |
|||
msgstr "Adjuntos" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,move_attachments:0 |
|||
msgid "" |
|||
"Attachments will be assigned to the chosen destination object and you will " |
|||
"be able to pick them from its 'Attachments' button, but they will not be " |
|||
"there for the current object if any. In any case you can always open it from " |
|||
"the message itself." |
|||
msgstr "" |
|||
"Los adjuntos se asignarán al objeto de destino escogido, y podrás " |
|||
"seleccionarlos desde el botón \"Adjuntos\", pero se quitarán del objeto en " |
|||
"el que estén adjuntados actualmente, si lo hay. En cualquier caso, siempre " |
|||
"puedes abrirlos desde el propio mensaje." |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,author_id:0 |
|||
msgid "Author" |
|||
msgstr "Autor" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,author_id:0 |
|||
msgid "" |
|||
"Author of the message. If not set, email_from may hold an email address that " |
|||
"did not match any partner." |
|||
msgstr "" |
|||
"Autor del mensaje. Si no está establecido, puede que encuentres una " |
|||
"dirección que no coincide con ninguna empresa en \"email_from\"." |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,author_avatar:0 |
|||
msgid "Author's Avatar" |
|||
msgstr "Avatar del autor" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,body:0 |
|||
msgid "Automatically sanitized HTML contents" |
|||
msgstr "Contenidos HTML automáticamente desinfectados" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,child_ids:0 |
|||
msgid "Child Messages" |
|||
msgstr "Mensajes hijos" |
|||
|
|||
#. module: mail_forward |
|||
#: selection:mail.compose.forward,type:0 |
|||
msgid "Comment" |
|||
msgstr "Comentario" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,composition_mode:0 |
|||
msgid "Composition mode" |
|||
msgstr "Modo de composición" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,body:0 |
|||
msgid "Contents" |
|||
msgstr "Contenidos" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,create_uid:0 |
|||
msgid "Created by" |
|||
msgstr "Creado por" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,create_date:0 |
|||
msgid "Created on" |
|||
msgstr "Creado el" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,starred:0 |
|||
msgid "Current user has a starred notification linked to this message" |
|||
msgstr "" |
|||
"El usuario actual tiene una notificación por realizar vinculada a este " |
|||
"mensaje" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,to_read:0 |
|||
msgid "Current user has an unread notification linked to this message" |
|||
msgstr "" |
|||
"El usuario actual tiene una notificación sin leer vinculada a este mensaje" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,date:0 |
|||
msgid "Date" |
|||
msgstr "Fecha" |
|||
|
|||
#. module: mail_forward |
|||
#. openerp-web |
|||
#: code:addons/mail_forward/static/src/js/mail_forward.js:55 |
|||
#, python-format |
|||
msgid "Date:" |
|||
msgstr "Fecha:" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,destination_object_id:0 |
|||
msgid "Destination object" |
|||
msgstr "Objeto de destino" |
|||
|
|||
#. module: mail_forward |
|||
#: selection:mail.compose.forward,type:0 |
|||
msgid "Email" |
|||
msgstr "Correo electrónico" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,email_from:0 |
|||
msgid "" |
|||
"Email address of the sender. This field is set when no matching partner is " |
|||
"found for incoming emails." |
|||
msgstr "" |
|||
"Dirección de correo electrónico del autor. Este campo se establece cuando no " |
|||
"se puede encontrar una empresa correspondiente para los correos entrantes." |
|||
|
|||
#. module: mail_forward |
|||
#: model:ir.model,name:mail_forward.model_mail_compose_forward |
|||
msgid "Email composition wizard" |
|||
msgstr "Asistente de redacción de correo electrónico." |
|||
|
|||
#. module: mail_forward |
|||
#. openerp-web |
|||
#: code:addons/mail_forward/static/src/xml/mail_forward.xml:25 |
|||
#, python-format |
|||
msgid "Forward" |
|||
msgstr "Reenviar" |
|||
|
|||
#. module: mail_forward |
|||
#: model:ir.actions.act_window,name:mail_forward.compose_action |
|||
msgid "Forward Email" |
|||
msgstr "Reenviar correo electrónico" |
|||
|
|||
#. module: mail_forward |
|||
#. openerp-web |
|||
#: code:addons/mail_forward/static/src/js/mail_forward.js:51 |
|||
#, python-format |
|||
msgid "Forwarded message" |
|||
msgstr "Mensaje reenviado" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,email_from:0 |
|||
msgid "From" |
|||
msgstr "De" |
|||
|
|||
#. module: mail_forward |
|||
#. openerp-web |
|||
#: code:addons/mail_forward/static/src/js/mail_forward.js:53 |
|||
#, python-format |
|||
msgid "From:" |
|||
msgstr "De:" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,id:0 |
|||
msgid "ID" |
|||
msgstr "ID" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,parent_id:0 |
|||
msgid "Initial thread message." |
|||
msgstr "Mensaje inicial del hilo." |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,write_uid:0 |
|||
msgid "Last Updated by" |
|||
msgstr "Última actualización por" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,write_date:0 |
|||
msgid "Last Updated on" |
|||
msgstr "Última actualización el" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,is_log:0 |
|||
msgid "Log an Internal Note" |
|||
msgstr "Registrar una nota interna" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,record_name:0 |
|||
msgid "Message Record Name" |
|||
msgstr "Nombre del registro del mensaje" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,type:0 |
|||
msgid "" |
|||
"Message type: email for email message, notification for system message, " |
|||
"comment for other messages such as user replies" |
|||
msgstr "" |
|||
"Tipo de mensaje: \"email\" para mensaje de correo electrónico, \"notification" |
|||
"\" para mensaje del sistema, \"comment\" para otros mensajes, como " |
|||
"respuestas de usuarios" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,message_id:0 |
|||
msgid "Message unique identifier" |
|||
msgstr "Identificador único del mensaje" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,message_id:0 |
|||
msgid "Message-Id" |
|||
msgstr "ID del mensaje" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,move_attachments:0 |
|||
msgid "Move attachments" |
|||
msgstr "Mover adjuntos" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,record_name:0 |
|||
msgid "Name get of the related document." |
|||
msgstr "Obtener nombre del documento relacionado." |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,no_auto_thread:0 |
|||
msgid "No threading for answers" |
|||
msgstr "Sin hilos para las respuestas" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,notification_ids:0 |
|||
msgid "Notifications" |
|||
msgstr "Notificaciones" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,notified_partner_ids:0 |
|||
msgid "Notified partners" |
|||
msgstr "Empresas notificadas" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,notify:0 |
|||
msgid "Notify followers" |
|||
msgstr "Notificar a los seguidores" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,notify:0 |
|||
msgid "Notify followers of the document (mass post only)" |
|||
msgstr "Notificar a los seguidores de este documento (solo envío masivo)" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,destination_object_id:0 |
|||
msgid "Object where the forwarded message will be attached" |
|||
msgstr "Objeto al que se enganchará el mensaje reenviado" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,mail_server_id:0 |
|||
msgid "Outgoing mail server" |
|||
msgstr "Servidor de correo saliente" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,parent_id:0 |
|||
msgid "Parent Message" |
|||
msgstr "Mensaje padre" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,notified_partner_ids:0 |
|||
msgid "" |
|||
"Partners that have a notification pushing this message in their mailboxes" |
|||
msgstr "" |
|||
"Empresas que son notificados de este mensaje en sus bandejas de entrada" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,res_id:0 |
|||
msgid "Related Document ID" |
|||
msgstr "ID del documento relacionado" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,model:0 |
|||
msgid "Related Document Model" |
|||
msgstr "Modelo del documento relacionado" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,reply_to:0 |
|||
msgid "" |
|||
"Reply email address. Setting the reply_to bypasses the automatic thread " |
|||
"creation." |
|||
msgstr "" |
|||
"Email de respuesta. Al establecer esto, se omite la creación automática de " |
|||
"hilos." |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,reply_to:0 |
|||
msgid "Reply-To" |
|||
msgstr "Responder a" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,starred:0 |
|||
msgid "Starred" |
|||
msgstr "Por realizar" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,subject:0 |
|||
msgid "Subject" |
|||
msgstr "Asunto" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,subtype_id:0 |
|||
msgid "Subtype" |
|||
msgstr "Subtipo" |
|||
|
|||
#. module: mail_forward |
|||
#: selection:mail.compose.forward,type:0 |
|||
msgid "System notification" |
|||
msgstr "Notificación del sistema" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,notification_ids:0 |
|||
msgid "" |
|||
"Technical field holding the message notifications. Use notified_partner_ids " |
|||
"to access notified partners." |
|||
msgstr "" |
|||
"Campo técnico que contiene las notificaciones del mensaje. Use " |
|||
"\"notified_partner_ids\" para acceder a las empresas notificadas." |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,to_read:0 |
|||
msgid "To read" |
|||
msgstr "Sin leer" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,type:0 |
|||
msgid "Type" |
|||
msgstr "Tipo" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,use_active_domain:0 |
|||
msgid "Use active domain" |
|||
msgstr "Usar dominio activo" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,template_id:0 |
|||
msgid "Use template" |
|||
msgstr "Usar plantilla" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,vote_user_ids:0 |
|||
msgid "Users that voted for this message" |
|||
msgstr "Usuarios que han votado por este mensaje" |
|||
|
|||
#. module: mail_forward |
|||
#: field:mail.compose.forward,vote_user_ids:0 |
|||
msgid "Votes" |
|||
msgstr "Votos" |
|||
|
|||
#. module: mail_forward |
|||
#: help:mail.compose.forward,is_log:0 |
|||
msgid "Whether the message is an internal note (comment mode only)" |
|||
msgstr "" |
|||
"Indica si el mensaje es una nota interna (solo para el modo comentarios)" |
|||
|
|||
#~ msgid "Filters" |
|||
#~ msgstr "Filtros" |
After Width: 100 | Height: 100 | Size: 1.8 KiB |
@ -0,0 +1,12 @@ |
|||
/* © 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
*/ |
|||
|
|||
.openerp .oe_mail .oe_msg .oe_msg_icons .oe_forward:hover a { |
|||
color: #1FC0FF; |
|||
text-shadow: 0px 1px #184FC5, |
|||
0px -1px #184FC5, |
|||
-1px 0px #184FC5, |
|||
1px 0px #184FC5, |
|||
0px 3px 3px rgba(0, 0, 0, 0.1); |
|||
} |
@ -0,0 +1,65 @@ |
|||
/* © 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|||
*/ |
|||
|
|||
openerp.mail_forward = function (instance) { |
|||
var _t = instance.web._t; |
|||
instance.mail.ThreadMessage.include({ |
|||
bind_events: function () { |
|||
this._super.apply(this, arguments); |
|||
this.$('.oe_forward').on('click', this.on_message_forward); |
|||
}, |
|||
|
|||
on_message_forward: function () { |
|||
// Generate email subject as possible from record_name and subject
|
|||
var subject = ["FWD"]; |
|||
if (this.record_name && (this.show_record_name || |
|||
this.parent_id)) |
|||
{ |
|||
subject.push(this.record_name); |
|||
} |
|||
if (this.subject) { |
|||
subject.push(this.subject); |
|||
} else if (subject.length < 2) { |
|||
subject.push(_t("(No subject)")); |
|||
} |
|||
|
|||
// Get only ID from the attachments
|
|||
var attachment_ids = []; |
|||
for (n in this.attachment_ids) { |
|||
attachment_ids.push(this.attachment_ids[n].id); |
|||
} |
|||
|
|||
// Get necessary fields from the forwarded message
|
|||
var context = { |
|||
default_attachment_ids: attachment_ids, |
|||
default_body: |
|||
"<p><i>----------" + |
|||
_t("Forwarded message") + |
|||
"----------<br/>" + |
|||
_t("From:") + " " + |
|||
_.str.escapeHTML(this.author_id[1]) + "<br/>" + |
|||
_t("Date:") + " " + this.date + "</i></p><br/>" + |
|||
this.body, |
|||
default_model: this.model, |
|||
default_res_id: this.res_id, |
|||
default_subject: subject.join(": "), |
|||
}; |
|||
|
|||
if (this.model && this.res_id) { |
|||
context.default_destination_object_id = |
|||
[this.model, this.res_id].join(); |
|||
} |
|||
|
|||
// Get the action data and execute it to open the composer wizard
|
|||
var do_action = this.do_action; |
|||
this.rpc("/web/action/load", { |
|||
"action_id": "mail_forward.compose_action", |
|||
}) |
|||
.done(function(action) { |
|||
action.context = context; |
|||
do_action(action); |
|||
}); |
|||
} |
|||
}); |
|||
}; |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- © 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> |
|||
|
|||
<template> |
|||
<t t-extend="mail.thread.message"> |
|||
<t t-jquery=".oe_msg_icons .oe_reply" t-operation="before"> |
|||
<span class="oe_forward"> |
|||
<a title="Forward" class="oe_e">*</a> |
|||
</span> |
|||
</t> |
|||
</t> |
|||
</template> |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<!-- © 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<template id="assets_backend" |
|||
name="Mail forward assets" |
|||
inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" |
|||
href="/mail_forward/static/src/css/mail_forward.css"/> |
|||
<script type="text/javascript" |
|||
src="/mail_forward/static/src/js/mail_forward.js"/> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,120 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from openerp import api, fields, models |
|||
|
|||
|
|||
class MailForwardComposeMessage(models.TransientModel): |
|||
"""Allow forwarding a message. |
|||
|
|||
It duplicates the message and optionally attaches it to another object |
|||
of the database and sends it to another recipients than the original one. |
|||
""" |
|||
|
|||
_name = "mail_forward.compose.message" |
|||
_inherits = {"mail.compose.message": "original_wizard_id"} |
|||
|
|||
_models = [ |
|||
"crm.lead", |
|||
"crm.meeting", |
|||
"crm.phonecall", |
|||
"mail.group", |
|||
"note.note", |
|||
"product.product", |
|||
"project.project", |
|||
"project.task", |
|||
"res.partner", |
|||
"sale.order", |
|||
] |
|||
|
|||
@api.model |
|||
def default_get(self, fields): |
|||
"""Fix default values. |
|||
|
|||
Sometimes :meth:`openerp.addons.mail.mail_compose_message |
|||
.mail_compose_message.default_get` overwrites the default value |
|||
for the ``subject`` field, even when it gets the right default value |
|||
from the context. |
|||
|
|||
This method fixes that by getting it from the context if available. |
|||
""" |
|||
|
|||
result = self.original_wizard_id.default_get(fields) |
|||
|
|||
if "subject" in result and "default_subject" in self.env.context: |
|||
result["subject"] = self.env.context["default_subject"] |
|||
|
|||
return result |
|||
|
|||
@api.model |
|||
def models(self): |
|||
"""Get allowed models and their names. |
|||
|
|||
It searches for the models on the database, so if modules are not |
|||
installed, models will not be shown. |
|||
""" |
|||
|
|||
model_objs = self.env["ir.model"].search( |
|||
[("model", "in", self.env.context.get("model_list", |
|||
self._models))], |
|||
order="name") |
|||
return [(m.model, m.name) for m in model_objs] |
|||
|
|||
@api.one |
|||
@api.onchange("destination_object_id") |
|||
def change_destination_object(self): |
|||
"""Update some fields for the new message.""" |
|||
|
|||
if self.destination_object_id: |
|||
self.model = self.destination_object_id._name |
|||
self.res_id = self.destination_object_id.id |
|||
|
|||
model_name = (self.env["ir.model"] |
|||
.search([("model", "=", self.model)]) |
|||
.name) |
|||
record_name = self.destination_object_id.name_get()[0][1] |
|||
if model_name: |
|||
record_name = "%s %s" % (model_name, record_name) |
|||
|
|||
self.record_name = record_name |
|||
else: |
|||
self.model = self.res_id = self.record_name = False |
|||
|
|||
@api.one |
|||
def send_mail(self): |
|||
"""Send mail and execute the attachment relocation if needed.""" |
|||
|
|||
# Let the original wizard do de hard work |
|||
result = self.original_wizard_id.send_mail() |
|||
|
|||
# Relocate attachments if needed |
|||
if (self.move_attachments and |
|||
self.model and |
|||
self.res_id and |
|||
self.attachment_ids): |
|||
for attachment in self.attachment_ids: |
|||
attachment.res_model = self.model |
|||
attachment.res_id = self.res_id |
|||
|
|||
return result |
|||
|
|||
destination_object_id = fields.Reference( |
|||
models, |
|||
"Destination object", |
|||
help="Object where the forwarded message will be attached") |
|||
|
|||
move_attachments = fields.Boolean( |
|||
"Move attachments", |
|||
help="Attachments will be assigned to the chosen destination " |
|||
"object and you will be able to pick them from its " |
|||
"'Attachments' button, but they will not be there for " |
|||
"the current object if any. In any case you can always " |
|||
"open it from the message itself.") |
|||
|
|||
original_wizard_id = fields.Many2one( |
|||
"mail.compose.message", |
|||
"Original message compose wizard", |
|||
delegate=True, |
|||
ondelete="cascade", |
|||
required=True) |
@ -0,0 +1,64 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<!-- © 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="compose_form" model="ir.ui.view"> |
|||
<field name="name">Forward Email Form</field> |
|||
<field name="model">mail_forward.compose.message</field> |
|||
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/> |
|||
<field name="arch" type="xml"> |
|||
<data> |
|||
<!-- It's required to fill either `partner_ids` or |
|||
`destination_object_id` --> |
|||
<xpath expr="//field[@name='partner_ids']" position="attributes"> |
|||
<attribute name="attrs">{ |
|||
'required': [('destination_object_id', '=', False)] |
|||
}</attribute> |
|||
</xpath> |
|||
|
|||
<xpath expr="//label[@for='partner_ids']" position="before"> |
|||
<!-- Object where the message will be attached --> |
|||
<field |
|||
attrs="{ |
|||
'required': [('partner_ids', '=', [[6, False, []]])]}" |
|||
name="destination_object_id"/> |
|||
|
|||
<!-- If the message has attachments, should we move them to the |
|||
new object? --> |
|||
<field |
|||
name="move_attachments" |
|||
attrs="{ |
|||
'invisible': [ |
|||
'|', |
|||
('destination_object_id', '=', False), |
|||
('attachment_ids', '=', [[6, False, []]])]}"/> |
|||
</xpath> |
|||
|
|||
<!-- If there's no document to follow, hide the message --> |
|||
<xpath expr="//span[text()='Followers of the document and']" |
|||
position="attributes"> |
|||
<attribute name="attrs">{ |
|||
'invisible': [('destination_object_id', '=', False)] |
|||
}</attribute> |
|||
</xpath> |
|||
</data> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="compose_action" model="ir.actions.act_window"> |
|||
<field name="name">Forward Email</field> |
|||
<field name="res_model">mail_forward.compose.message</field> |
|||
<field name="src_model">mail.message</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="view_id" ref="compose_form"/> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue