kiplangatdan
7 years ago
committed by
Giovanni Francesco Capalbo
15 changed files with 421 additions and 0 deletions
-
77mail_edit/README.rst
-
5mail_edit/__init__.py
-
28mail_edit/__openerp__.py
-
77mail_edit/i18n/nl.po
-
6mail_edit/models/__init__.py
-
41mail_edit/models/compose_message.py
-
15mail_edit/models/res_request_link.py
-
20mail_edit/security/mail_edit_security.xml
-
BINmail_edit/static/description/icon.png
-
9mail_edit/static/src/css/mail_edit.css
-
44mail_edit/static/src/js/mail_edit.js
-
11mail_edit/static/src/xml/mail_edit.xml
-
17mail_edit/views/assets.xml
-
42mail_edit/views/compose_message.xml
-
29mail_edit/views/res_request_link.xml
@ -0,0 +1,77 @@ |
|||||
|
.. 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 Edit |
||||
|
============ |
||||
|
|
||||
|
This module extends the functionality of mail. You can edit message/messages |
||||
|
and move them to any model. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
|
||||
|
To configure this module: |
||||
|
|
||||
|
* Activate the 'Move mail message' or 'Edit mail message' permissions for a |
||||
|
user (the admin user has these rights by default) |
||||
|
* Objects that users are allowed to move messages to, can be |
||||
|
configured in Settings - Technical - Database structure - |
||||
|
Referenceable objects. |
||||
|
|
||||
|
Usage |
||||
|
===== |
||||
|
|
||||
|
To use this module, you need to: |
||||
|
|
||||
|
* Go to *Message* *Chatter* in any model, click the Edit (pen) Icon to open up |
||||
|
the 'Edit or Move' wizard. |
||||
|
* To edit, edit the Mail as necessary and click Save. |
||||
|
* To move, select the destination object and click Save. |
||||
|
|
||||
|
Known issues / Roadmap |
||||
|
====================== |
||||
|
* Does not reload after edit on messaging views. For this we needed to call |
||||
|
controller.reload(), a way to this would be to inherit the ActionManager and |
||||
|
call it from there. |
||||
|
|
||||
|
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:%20 mail_edit%0Aversion:%20 |
||||
|
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`__. |
||||
|
|
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
|
||||
|
Images |
||||
|
------ |
||||
|
|
||||
|
* PICOL Icon Generator `here <http://picol.org/picol_icon_generator>`__. |
||||
|
|
||||
|
Contributors |
||||
|
------------ |
||||
|
|
||||
|
* Dan Kiplangat <dan@sunflowerweb.nl> |
||||
|
* Tom Blauwendraat <tom@sunflowerweb.nl> |
||||
|
|
||||
|
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 -*- |
||||
|
# © 2016 Sunflower IT (http://sunflowerweb.nl) |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
from . import models |
@ -0,0 +1,28 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Sunflower IT (http://sunflowerweb.nl) |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
{ |
||||
|
"name": "Message Edit", |
||||
|
"summary": "Adds an option to edit mail to different partners", |
||||
|
"version": "8.0.1.0.0", |
||||
|
"category": "Social Network", |
||||
|
"website": "https://sunflowerweb.nl", |
||||
|
"author": "Sunflower IT, Odoo Community Association (OCA)", |
||||
|
"license": "AGPL-3", |
||||
|
"application": False, |
||||
|
"installable": True, |
||||
|
"depends": [ |
||||
|
"mail", |
||||
|
"web", |
||||
|
], |
||||
|
"data": [ |
||||
|
"security/mail_edit_security.xml", |
||||
|
"views/assets.xml", |
||||
|
"views/compose_message.xml", |
||||
|
"views/res_request_link.xml", |
||||
|
], |
||||
|
"qweb": [ |
||||
|
"static/src/xml/mail_edit.xml", |
||||
|
], |
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
# Translation of Mail edit module. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * mail_edit |
||||
|
# |
||||
|
# Translators: |
||||
|
# Tom Blauwendraat <tom@sunflowerweb.nl>, 2018 |
||||
|
msgid "" |
||||
|
msgstr "" |
||||
|
"Project-Id-Version: Odoo 8.0\n" |
||||
|
"Report-Msgid-Bugs-To: \n" |
||||
|
"POT-Creation-Date: 2018-01-19 14:40+0000\n" |
||||
|
"PO-Revision-Date: 2017-08-18 16:51+0000\n" |
||||
|
"Last-Translator: Erwin van der Ploeg <erwin@odooexperts.nl>\n" |
||||
|
"Language-Team: Dutch (http://www.transifex.com/odoo/odoo-8/language/nl/)\n" |
||||
|
"Language: nl\n" |
||||
|
"MIME-Version: 1.0\n" |
||||
|
"Content-Type: text/plain; charset=UTF-8\n" |
||||
|
"Content-Transfer-Encoding: \n" |
||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: help:res.request.link,mail_edit:0 |
||||
|
msgid "Allow to move mails to this model." |
||||
|
msgstr "Sta toe om berichten naar dit model te verplaatsen." |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: field:mail.message,destination_object_id:0 |
||||
|
msgid "Destination object" |
||||
|
msgstr "Doelobject" |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#. openerp-web |
||||
|
#: code:addons/mail_edit/static/src/xml/mail_edit.xml:7 |
||||
|
#, python-format |
||||
|
msgid "Edit Mail" |
||||
|
msgstr "Bericht wijzigen" |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: model:res.groups,name:mail_edit.group_mail_edit_editor |
||||
|
msgid "Edit mail messages" |
||||
|
msgstr "Berichten wijzigen" |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: model:ir.actions.act_window,name:mail_edit.mail_edit_action |
||||
|
msgid "Edit or Move Message" |
||||
|
msgstr "Wijzigen of verplaatsen van bericht" |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: field:res.request.link,mail_edit:0 |
||||
|
msgid "Mail edit" |
||||
|
msgstr "Bericht wijzigen" |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: model:res.groups,comment:mail_edit.group_mail_edit_editor |
||||
|
msgid "Members of this group are able to edit mail messages." |
||||
|
msgstr "Leden van deze groep mogen de inhoud van berichten wijzigen." |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: model:res.groups,comment:mail_edit.group_mail_edit_mover |
||||
|
msgid "Members of this group are able to move mails." |
||||
|
msgstr "Leden van deze groep mogen berichten verplaatsen." |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: model:ir.model,name:mail_edit.model_mail_message |
||||
|
#: view:mail.message:mail_edit.mail_edit_form |
||||
|
msgid "Message" |
||||
|
msgstr "Bericht" |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: model:res.groups,name:mail_edit.group_mail_edit_mover |
||||
|
msgid "Move mail messages" |
||||
|
msgstr "Berichten verplaatsen" |
||||
|
|
||||
|
#. module: mail_edit |
||||
|
#: help:mail.message,destination_object_id:0 |
||||
|
msgid "Object where the message will be moved to" |
||||
|
msgstr "Object waar het bericht naartoe verplaatst zal worden" |
@ -0,0 +1,6 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Sunflower IT (http://sunflowerweb.nl) |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
from . import compose_message |
||||
|
from . import res_request_link |
@ -0,0 +1,41 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Sunflower IT (http://sunflowerweb.nl) |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
from openerp import api, fields, models |
||||
|
|
||||
|
|
||||
|
class MailMessage(models.Model): |
||||
|
_inherit = "mail.message" |
||||
|
|
||||
|
@api.model |
||||
|
def _get_model_selection(self): |
||||
|
"""Get allowed models and their names.""" |
||||
|
model_objs = self.env["res.request.link"].search( |
||||
|
[("mail_edit", "=", True)], |
||||
|
order="name") |
||||
|
return [(m.object, 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.""" |
||||
|
# pylint: disable=api-one-deprecated |
||||
|
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 |
||||
|
display_name = self.destination_object_id.display_name |
||||
|
if model_name: |
||||
|
display_name = "%s %s" % (model_name, display_name) |
||||
|
|
||||
|
self.record_name = display_name |
||||
|
else: |
||||
|
self.model = self.res_id = self.record_name = False |
||||
|
|
||||
|
destination_object_id = fields.Reference( |
||||
|
_get_model_selection, |
||||
|
"Destination object", |
||||
|
help="Object where the message will be moved to") |
@ -0,0 +1,15 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Sunflower IT (http://sunflowerweb.nl) |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
from openerp import fields, models |
||||
|
|
||||
|
|
||||
|
class ResRequestLink(models.Model): |
||||
|
_inherit = "res.request.link" |
||||
|
|
||||
|
mail_edit = fields.Boolean( |
||||
|
string="Mail move", |
||||
|
default=True, |
||||
|
index=True, |
||||
|
help="Allow to move mails to this model.") |
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<openerp> |
||||
|
<data noupdate="1"> |
||||
|
|
||||
|
<record model="res.groups" id="group_mail_edit_editor" > |
||||
|
<field name="name">Edit mail messages</field> |
||||
|
<field name="comment">Members of this group are able to edit mail messages.</field> |
||||
|
<field name="category_id" ref="base.module_category_hidden"/> |
||||
|
<field name="users" eval="[(4, ref('base.user_root'))]"/> |
||||
|
</record> |
||||
|
|
||||
|
<record model="res.groups" id="group_mail_edit_mover"> |
||||
|
<field name="name">Move mail messages</field> |
||||
|
<field name="comment">Members of this group are able to move mails.</field> |
||||
|
<field name="category_id" ref="base.module_category_hidden"/> |
||||
|
<field name="users" eval="[(4, ref('base.user_root'))]"/> |
||||
|
</record> |
||||
|
|
||||
|
</data> |
||||
|
</openerp> |
After Width: 128 | Height: 128 | Size: 2.4 KiB |
@ -0,0 +1,9 @@ |
|||||
|
|
||||
|
.openerp .oe_mail .oe_msg .oe_msg_icons .oe_edit: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,44 @@ |
|||||
|
/* © 2014-2017 Sunflower IT <www.sunflowerweb.nl>*/ |
||||
|
|
||||
|
"use strict"; |
||||
|
openerp.mail_edit = function (instance) { |
||||
|
var _t = instance.web._t; |
||||
|
instance.mail.ThreadMessage.include({ |
||||
|
bind_events: function () { |
||||
|
this._super.apply(this, arguments); |
||||
|
this.$('.oe_edit').on('click', this.on_message_edit); |
||||
|
}, |
||||
|
|
||||
|
on_message_edit: function () { |
||||
|
var context = {}; |
||||
|
|
||||
|
// save the widget object in a var.
|
||||
|
var self = this; |
||||
|
|
||||
|
// Get the action data
|
||||
|
var do_action = this.do_action; |
||||
|
|
||||
|
this.rpc("/web/action/load", { |
||||
|
"action_id": "mail_edit.mail_edit_action", |
||||
|
}) |
||||
|
.done(function(action) { |
||||
|
action.res_id = self.id; |
||||
|
action.flags = { |
||||
|
action_buttons: true, |
||||
|
}; |
||||
|
action.context = context; |
||||
|
do_action(action, { |
||||
|
on_close: function () { |
||||
|
// reload view
|
||||
|
//debugger;
|
||||
|
var parent = self.getParent().getParent().getParent().getParent() |
||||
|
console.log(parent.model) |
||||
|
if (typeof parent.model !== "undefined"){ |
||||
|
parent.reload(); |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}; |
@ -0,0 +1,11 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
|
||||
|
<template> |
||||
|
<t t-extend="mail.thread.message"> |
||||
|
<t t-jquery=".oe_msg_icons .oe_reply" t-operation="before"> |
||||
|
<span class="oe_edit"> |
||||
|
<a title="Edit Mail" class="oe_e">&</a> |
||||
|
</span> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
@ -0,0 +1,17 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
|
||||
|
<openerp> |
||||
|
<data> |
||||
|
|
||||
|
<template id="assets_backend" name="Mail edit assets" |
||||
|
inherit_id="web.assets_backend"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<link rel="stylesheet" |
||||
|
href="/mail_edit/static/src/css/mail_edit.css"/> |
||||
|
<script type="text/javascript" |
||||
|
src="/mail_edit/static/src/js/mail_edit.js"/> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
|
||||
|
</data> |
||||
|
</openerp> |
@ -0,0 +1,42 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<openerp> |
||||
|
<data> |
||||
|
|
||||
|
<record id="mail_edit_form" model="ir.ui.view"> |
||||
|
<field name="name">Edit Email Form</field> |
||||
|
<field name="model">mail.message</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Message" create="false"> |
||||
|
<sheet> |
||||
|
<group> |
||||
|
<group> |
||||
|
<field name="subject" groups="mail_edit.group_mail_edit_editor"/> |
||||
|
<field name="date" readonly="1"/> |
||||
|
<field name="type" readonly="1"/> |
||||
|
<field name="subtype_id" readonly="1"/> |
||||
|
</group> |
||||
|
<group> |
||||
|
<field name="destination_object_id" required="1" groups="mail_edit.group_mail_edit_mover"/> |
||||
|
<field name="model" invisible="1"/> |
||||
|
<field name="res_id" invisible="1"/> |
||||
|
<field name="parent_id" readonly="1" /> |
||||
|
</group> |
||||
|
</group> |
||||
|
<field name="body" groups="mail_edit.group_mail_edit_editor"/> |
||||
|
</sheet> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="mail_edit_action" model="ir.actions.act_window"> |
||||
|
<field name="name">Edit or Move Message</field> |
||||
|
<field name="res_model">mail.message</field> |
||||
|
<field name="type">ir.actions.act_window</field> |
||||
|
<field name="view_id" ref="mail_edit_form"/> |
||||
|
<field name="view_type">form</field> |
||||
|
<field name="view_mode">form</field> |
||||
|
<field name="target">new</field> |
||||
|
</record> |
||||
|
|
||||
|
</data> |
||||
|
</openerp> |
@ -0,0 +1,29 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
|
||||
|
<openerp> |
||||
|
<data> |
||||
|
|
||||
|
<record id="res_request_link_view_form" model="ir.ui.view"> |
||||
|
<field name="name">Add option to edit mails</field> |
||||
|
<field name="model">res.request.link</field> |
||||
|
<field name="inherit_id" ref="base.res_request_link-view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='priority']" position="after"> |
||||
|
<field name="mail_edit"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="res_request_link_view_tree" model="ir.ui.view"> |
||||
|
<field name="name">Add option to edit mails</field> |
||||
|
<field name="model">res.request.link</field> |
||||
|
<field name="inherit_id" ref="base.res_request_link_tree-view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='object']" position="after"> |
||||
|
<field name="mail_edit"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
</data> |
||||
|
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue