mirror of https://github.com/OCA/social.git
Get referenceable modules from res.request.link.
This follows better the Odoo standard and makes it easier to configure by the administrator.pull/12/head
parent
89e356d2fc
commit
ec78bb9d12
|
@ -9,31 +9,30 @@ Message forward
|
||||||
This module was written to extend the functionality of mails to support
|
This module was written to extend the functionality of mails to support
|
||||||
forwarding them to another contact or database object.
|
forwarding them to another contact or database object.
|
||||||
|
|
||||||
* **To another object of the database:**
|
* **To another object of the database:** All its followers are notified
|
||||||
* All its followers are notified according to their settings.
|
according to their settings.
|
||||||
* **To other contacts:**
|
|
||||||
* They recieve the forwarded message according to the usual notification
|
|
||||||
rules of Odoo.
|
|
||||||
|
|
||||||
Installation
|
* **To other contacts:** They recieve the forwarded message according to the
|
||||||
============
|
usual notification rules of Odoo.
|
||||||
|
|
||||||
When installed, this module allows forwarding to the following database
|
Configuration
|
||||||
objects:
|
=============
|
||||||
|
|
||||||
* ``crm.lead``
|
When installed, this module allows forwarding to a limited selection of
|
||||||
* ``crm.meeting``
|
database models, that will get automatically updated when you install other
|
||||||
* ``crm.phonecall``
|
modules.
|
||||||
* ``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
|
This list can be customized by a user that has *Technical Features* permission.
|
||||||
hidden until you install the module that adds them.
|
To do it:
|
||||||
|
|
||||||
|
* Go to *Settings > Technical > Database Structure > Referenceable Models*.
|
||||||
|
|
||||||
|
* Any model there with *Mail forward target* enabled will appear in the list of
|
||||||
|
models that can get forwarded messages.
|
||||||
|
|
||||||
|
* If you want to *remove* a model from the list, it's usually better to just
|
||||||
|
*disable* its check box instead of deleting it, because that record might
|
||||||
|
be used by other modules.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
@ -75,7 +74,7 @@ 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
|
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
|
you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
feedback `here
|
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**>`_.
|
<https://github.com/OCA/social/issues/new?body=module:%20mail_forward%0Aversion:%208.0.7.0.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
# © 2014-2015 Grupo ESOC <www.grupoesoc.es>
|
# © 2014-2015 Grupo ESOC <www.grupoesoc.es>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from .wizard import mail_forward
|
from . import models, wizard
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
{
|
{
|
||||||
"name": "Message Forward",
|
"name": "Message Forward",
|
||||||
"summary": "Add option to forward messages",
|
"summary": "Add option to forward messages",
|
||||||
"version": "8.0.6.0.0",
|
"version": "8.0.7.0.0",
|
||||||
"category": "Social Network",
|
"category": "Social Network",
|
||||||
"website": "http://www.grupoesoc.es, https://odoo-community.org/",
|
"website": "https://odoo-community.org/",
|
||||||
"author": "Grupo ESOC, Odoo Community Association (OCA)",
|
"author": "Grupo ESOC, Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"application": False,
|
"application": False,
|
||||||
|
@ -17,8 +17,9 @@
|
||||||
"web",
|
"web",
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
"wizard/mail_forward.xml",
|
|
||||||
"views/assets.xml",
|
"views/assets.xml",
|
||||||
|
"views/res_request_link.xml",
|
||||||
|
"wizard/mail_forward.xml",
|
||||||
],
|
],
|
||||||
"qweb": [
|
"qweb": [
|
||||||
"static/src/xml/mail_forward.xml",
|
"static/src/xml/mail_forward.xml",
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
# -*- 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 fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class IrModel(models.Model):
|
||||||
|
_inherit = "res.request.link"
|
||||||
|
|
||||||
|
mail_forward_target = fields.Boolean(
|
||||||
|
default=True,
|
||||||
|
index=True,
|
||||||
|
help="Allow to forward mails to this model.")
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?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="res_request_link_view_form" model="ir.ui.view">
|
||||||
|
<field name="name">Add option to forward 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_forward_target"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="res_request_link_view_tree" model="ir.ui.view">
|
||||||
|
<field name="name">Add option to forward 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_forward_target"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
|
@ -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 . import mail_forward
|
|
@ -11,23 +11,9 @@ class MailForwardComposeMessage(models.TransientModel):
|
||||||
It duplicates the message and optionally attaches it to another object
|
It duplicates the message and optionally attaches it to another object
|
||||||
of the database and sends it to another recipients than the original one.
|
of the database and sends it to another recipients than the original one.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_name = "mail_forward.compose.message"
|
_name = "mail_forward.compose.message"
|
||||||
_inherits = {"mail.compose.message": "original_wizard_id"}
|
_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
|
@api.model
|
||||||
def default_get(self, fields):
|
def default_get(self, fields):
|
||||||
"""Fix default values.
|
"""Fix default values.
|
||||||
|
@ -39,7 +25,6 @@ class MailForwardComposeMessage(models.TransientModel):
|
||||||
|
|
||||||
This method fixes that by getting it from the context if available.
|
This method fixes that by getting it from the context if available.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
result = self.original_wizard_id.default_get(fields)
|
result = self.original_wizard_id.default_get(fields)
|
||||||
|
|
||||||
if "subject" in result and "default_subject" in self.env.context:
|
if "subject" in result and "default_subject" in self.env.context:
|
||||||
|
@ -49,23 +34,16 @@ class MailForwardComposeMessage(models.TransientModel):
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def models(self):
|
def models(self):
|
||||||
"""Get allowed models and their names.
|
"""Get allowed models and their names."""
|
||||||
|
model_objs = self.env["res.request.link"].search(
|
||||||
It searches for the models on the database, so if modules are not
|
[("mail_forward_target", "=", True)],
|
||||||
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")
|
order="name")
|
||||||
return [(m.model, m.name) for m in model_objs]
|
return [(m.object, m.name) for m in model_objs]
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
@api.onchange("destination_object_id")
|
@api.onchange("destination_object_id")
|
||||||
def change_destination_object(self):
|
def change_destination_object(self):
|
||||||
"""Update some fields for the new message."""
|
"""Update some fields for the new message."""
|
||||||
|
|
||||||
if self.destination_object_id:
|
if self.destination_object_id:
|
||||||
self.model = self.destination_object_id._name
|
self.model = self.destination_object_id._name
|
||||||
self.res_id = self.destination_object_id.id
|
self.res_id = self.destination_object_id.id
|
||||||
|
@ -84,7 +62,6 @@ class MailForwardComposeMessage(models.TransientModel):
|
||||||
@api.one
|
@api.one
|
||||||
def send_mail(self):
|
def send_mail(self):
|
||||||
"""Send mail and execute the attachment relocation if needed."""
|
"""Send mail and execute the attachment relocation if needed."""
|
||||||
|
|
||||||
# Let the original wizard do de hard work
|
# Let the original wizard do de hard work
|
||||||
result = self.original_wizard_id.send_mail()
|
result = self.original_wizard_id.send_mail()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue