Browse Source

Jun 18: [ADD] Initial Commit 'odoo_advanced_chatter'

pull/331/head
RisvanaCybro 1 year ago
parent
commit
0f90df6193
  1. 1
      odoo_advanced_chatter/__init__.py
  2. 11
      odoo_advanced_chatter/__manifest__.py
  3. 5
      odoo_advanced_chatter/doc/RELEASE_NOTES.md
  4. 1
      odoo_advanced_chatter/models/__init__.py
  5. 200
      odoo_advanced_chatter/models/mail_thread.py
  6. 4
      odoo_advanced_chatter/models/schedule_log.py
  7. 1
      odoo_advanced_chatter/security/ir.model.access.csv
  8. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/10.png
  9. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/11.png
  10. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/12.png
  11. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/13.png
  12. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/14.png
  13. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/15.png
  14. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/16.png
  15. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/17.png
  16. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/18.png
  17. BIN
      odoo_advanced_chatter/static/description/assets/screenshots/hero-v17.gif
  18. 133
      odoo_advanced_chatter/static/description/index.html
  19. 27
      odoo_advanced_chatter/static/src/js/chatter.js
  20. 3
      odoo_advanced_chatter/static/src/js/recipient_list.js
  21. 3
      odoo_advanced_chatter/static/src/js/schedule_mail.js
  22. 15
      odoo_advanced_chatter/static/src/xml/chatter.xml
  23. 2
      odoo_advanced_chatter/static/src/xml/followers_check.xml
  24. 22
      odoo_advanced_chatter/wizard/__init__.py
  25. 41
      odoo_advanced_chatter/wizard/mail_wizard_recipient.py
  26. 25
      odoo_advanced_chatter/wizard/mail_wizard_recipients_views.xml

1
odoo_advanced_chatter/__init__.py

@ -20,3 +20,4 @@
#
#############################################################################
from . import models
from . import wizard

11
odoo_advanced_chatter/__manifest__.py

@ -21,13 +21,13 @@
#############################################################################
{
'name': 'Odoo Advanced Chatter',
'version': '17.0.1.0.0',
'version': '17.0.2.0.0',
'category': 'Discuss',
'summary': 'Schedule Log note and Send Message in Chatter',
'description': """We have the capability to schedule log notes and send
messages within Chatter.Additionally, followers can be
managed both from the followers list
and directly within the Schedule form.""",
messages within Chatter.Additionally, followers can be managed both from
the followers list and directly within the Schedule form. We can manage the
users in the reply-to options.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
@ -37,6 +37,7 @@
'security/ir.model.access.csv',
'data/ir_cron_data.xml',
'views/schedule_log_views.xml',
'wizard/mail_wizard_recipients_views.xml'
],
"assets": {
"web.assets_backend":
@ -45,6 +46,8 @@
'odoo_advanced_chatter/static/src/js/schedule_mail.js',
'odoo_advanced_chatter/static/src/xml/followers_check.xml',
'odoo_advanced_chatter/static/src/js/recipient_list.js',
'odoo_advanced_chatter/static/src/xml/chatter.xml',
'odoo_advanced_chatter/static/src/js/chatter.js'
]
},
'images': ['static/description/banner.jpg'],

5
odoo_advanced_chatter/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 17.0.1.0.0
#### ADD
- Initial Commit Odoo Advanced Chatter
#### 19.06.2024
#### Version 17.0.2.0.0
#### UPDATE
- UPDATE

1
odoo_advanced_chatter/models/__init__.py

@ -19,4 +19,5 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import mail_thread
from . import schedule_log

200
odoo_advanced_chatter/models/mail_thread.py

@ -0,0 +1,200 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, models, _, tools
from markupsafe import Markup, escape
import logging
_logger = logging.getLogger(__name__)
class Message(models.AbstractModel):
_inherit = "mail.thread"
@api.returns('mail.message', lambda value: value.id)
def message_post(self, *,
body='', subject=None, message_type='notification',
email_from=None, author_id=None, parent_id=False,
subtype_xmlid=None, subtype_id=False, partner_ids=None,
attachments=None, attachment_ids=None, body_is_html=False,
**kwargs):
""" Post a new message in an existing thread, returning the new mail.message.
:param str|Markup body: body of the message, str content will be escaped, Markup
for html body
:param str subject: subject of the message
:param str message_type: see mail_message.message_type field. Can be anything but
user_notification, reserved for message_notify
:param str email_from: from address of the author. See ``_message_compute_author``
that uses it to make email_from / author_id coherent;
:param int author_id: optional ID of partner record being the author. See
``_message_compute_author`` that uses it to make email_from / author_id coherent;
:param int parent_id: handle thread formation
:param str subtype_xmlid: optional xml id of a mail.message.subtype to
fetch, will force value of subtype_id;
:param int subtype_id: subtype_id of the message, used mainly for followers
notification mechanism;
:param list(int) partner_ids: partner_ids to notify in addition to partners
computed based on subtype / followers matching;
:param list(tuple(str,str), tuple(str,str, dict)) attachments : list of attachment
tuples in the form ``(name,content)`` or ``(name,content, info)`` where content
is NOT base64 encoded;
:param list attachment_ids: list of existing attachments to link to this message
Should not be a list of commands. Attachment records attached to mail
composer will be attached to the related document.
:param bool body_is_html: indicates body should be threated as HTML even if str
to be used only for RPC calls
Extra keyword arguments will be used either
* as default column values for the new mail.message record if they match
mail.message fields;
* propagated to notification methods if not;
:return record: newly create mail.message
"""
self.ensure_one()
self._raise_for_invalid_parameters(
set(kwargs.keys()),
forbidden_names={'model', 'res_id', 'subtype'}
)
if self._name == 'mail.thread' or not self.id:
raise ValueError(
_("Posting a message should be done on a business document. Use message_notify to send a notification to an user."))
if message_type == 'user_notification':
raise ValueError(
_("Use message_notify to send a notification to an user."))
if attachments:
# attachments should be a list (or tuples) of 3-elements list (or tuple)
format_error = not tools.is_list_of(attachments,
list) and not tools.is_list_of(
attachments, tuple)
if not format_error:
format_error = not all(
len(attachment) in {2, 3} for attachment in attachments)
if format_error:
raise ValueError(
_('Posting a message should receive attachments as a list of list or tuples (received %(aids)s)',
aids=repr(attachment_ids),
)
)
if attachment_ids and not tools.is_list_of(attachment_ids, int):
raise ValueError(
_('Posting a message should receive attachments records as a list of IDs (received %(aids)s)',
aids=repr(attachment_ids),
)
)
attachment_ids = list(attachment_ids or [])
if partner_ids and not tools.is_list_of(partner_ids, int):
raise ValueError(
_('Posting a message should receive partners as a list of IDs (received %(pids)s)',
pids=repr(partner_ids),
)
)
partner_ids = list(partner_ids or [])
msg_kwargs = {key: val for key, val in kwargs.items()
if key in self.env['mail.message']._fields}
notif_kwargs = {key: val for key, val in kwargs.items()
if key not in msg_kwargs}
self = self._fallback_lang()
guest = self.env['mail.guest']._get_guest_from_context()
if self.env.user._is_public() and guest:
author_guest_id = guest.id
author_id, email_from = False, False
else:
author_guest_id = False
author_id, email_from = self._message_compute_author(author_id,
email_from,
raise_on_email=True)
if subtype_xmlid:
subtype_id = self.env['ir.model.data']._xmlid_to_res_id(
subtype_xmlid)
if not subtype_id:
subtype_id = self.env['ir.model.data']._xmlid_to_res_id(
'mail.mt_note')
if self._context.get('mail_post_autofollow') and partner_ids:
self.message_subscribe(partner_ids=list(partner_ids))
msg_values = dict(msg_kwargs)
if 'email_add_signature' not in msg_values:
msg_values['email_add_signature'] = True
if not msg_values.get('record_name'):
# use sudo as record access is not always granted (notably when replying
# a notification) -> final check is done at message creation level
msg_values['record_name'] = self.sudo().display_name
if body_is_html and self.user_has_groups("base.group_user"):
_logger.warning(
"Posting HTML message using body_is_html=True, use a Markup object instead (user: %s)",
self.env.user.id)
body = Markup(body)
msg_values.update({
# author
'author_id': author_id,
'author_guest_id': author_guest_id,
'email_from': email_from,
# document
'model': self._name,
'res_id': self.id,
# content
'body': escape(body), # escape if text, keep if markup
'message_type': message_type,
'parent_id': self._message_compute_parent_id(parent_id),
'subject': subject or False,
'subtype_id': subtype_id,
# recipients
'partner_ids': partner_ids,
})
reply_to_id = self.env['ir.config_parameter'].get_param('reply_to')
author1 = self.env['res.users'].browse(int(reply_to_id))
email_from1 = author1.email_formatted
if 'record_alias_domain_id' not in msg_values:
msg_values['record_alias_domain_id'] = \
self.sudo()._mail_get_alias_domains(
default_company=self.env.company)[self.id].id
if 'record_company_id' not in msg_values:
msg_values['record_company_id'] = \
self._mail_get_companies(default=self.env.company)[self.id].id
if 'reply_to' not in msg_values:
if author1 == self.env.user.id:
msg_values['reply_to'] = \
self._notify_get_reply_to(default=email_from)[self.id]
else:
msg_values['reply_to'] = \
self._notify_get_reply_to(default=email_from1)[self.id]
msg_values.update(
self._process_attachments_for_post(attachments, attachment_ids,
msg_values)
)
new_message = self._message_create([msg_values])
author_subscribe = (not self._context.get('mail_create_nosubscribe') and
msg_values['message_type'] != 'notification')
if author_subscribe:
real_author_id = False
if self.env.user.active:
real_author_id = self.env.user.partner_id.id
elif msg_values['author_id']:
author = self.env['res.partner'].browse(msg_values['author_id'])
if author.active:
real_author_id = author.id
if real_author_id:
self._message_subscribe(partner_ids=[real_author_id])
self._message_post_after_hook(new_message, msg_values)
self._notify_thread(new_message, msg_values, **notif_kwargs)
return new_message

4
odoo_advanced_chatter/models/schedule_log.py

@ -19,6 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from email.utils import formataddr
from odoo import models, fields
import datetime
@ -74,7 +75,7 @@ class ScheduleLog(models.Model):
body=self.body,
attachment_ids=self.attachment_ids.ids,
message_type='comment',
subtype_xmlid='mail.mt_comment'
subtype_xmlid='mail.mt_comment',
)
for mail in message.mail_ids:
mail.send()
@ -91,6 +92,7 @@ class ScheduleLog(models.Model):
body=self.body,
partner_ids=partner_ids,
attachment_ids=self.attachment_ids.ids,
reply_to=formataddr((self.create_uid.partner_id.name, 'email.from.1@test.example.com'))
)
message.notification_ids = [fields.Command.clear()]

1
odoo_advanced_chatter/security/ir.model.access.csv

@ -1,2 +1,3 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_schedule_log,access_schedule_log,model_schedule_log,base.group_user,1,1,1,1
access_mail_wizard_recipient,access_mail_wizard_recipient,model_mail_wizard_recipient,base.group_user,1,1,1,1

1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink
2 access_schedule_log access_schedule_log model_schedule_log base.group_user 1 1 1 1
3 access_mail_wizard_recipient access_mail_wizard_recipient model_mail_wizard_recipient base.group_user 1 1 1 1

BIN
odoo_advanced_chatter/static/description/assets/screenshots/10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/12.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/13.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/14.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/15.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/17.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/18.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
odoo_advanced_chatter/static/description/assets/screenshots/hero-v17.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 KiB

After

Width:  |  Height:  |  Size: 546 KiB

133
odoo_advanced_chatter/static/description/index.html

@ -110,30 +110,28 @@
</div>
</div>
</div>
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
</div>
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
background: #FFF;
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); ">
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
display: flex; justify-content: center; align-items: center;
margin-right: 10px; flex-shrink: 0;">
<i class="fa-solid fa-star "
style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
<i class="fa-solid fa-star "
style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">
Manage Followers.</p>
<p class="m-0" style="color:#718096">Recipients
can be managed seamlessly from the Followers
list
when sending messages using this module.
</p>
</div>
Manage Followers.</p>
<p class="m-0" style="color:#718096">Recipients
can be managed seamlessly from the Followers list
when sending messages using this module.
</p>
</div>
</div>
</div>
</div>
<div class="container rounded">
<ul class="nav nav-tabs d-flex"
@ -292,6 +290,109 @@
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/10.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
To manage the reply-to options, create an
icon inside Chatter.</h4>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/11.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/12.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
A wizard is opened where we can choose the
user to whom the reply is to be sent.</h4>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/14.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
We can send the message</h4>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/15.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Go to Settings -> Technical -> Messages.
Here, you can view the messages you have
sent. In the reply-to options, you will see
the user we specified.</h4>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/16.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/17.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/18.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
We can the same corresponding changes in the Mail details also.</h4>
</div>
</div>
</div>
</div>
<div id="tab2" class="tab-pane fade">

27
odoo_advanced_chatter/static/src/js/chatter.js

@ -0,0 +1,27 @@
/** @odoo-module **/
import { Chatter } from "@mail/core/web/chatter";
import { patch } from "@web/core/utils/patch";
import { _t } from "@web/core/l10n/translation";
//patch the class ChatterContainer to added the click function
patch(Chatter.prototype ,{
setup() {
super.setup();
},
replyTo(){
//-----On clicking thr reply to icon a wizard is opened to select the recipient
const action = {
type: "ir.actions.act_window",
res_model: "mail.wizard.recipient",
view_mode: "form",
views: [[false, "form"]],
name: _t("Reply To"),
target: "new",
context: {
default_model: this.props.threadModel,
default_model_reference: this.props.threadId,
default_partner_id:this.env.model.user.userId,
},
}
this.action.doAction(action, {})
}
});

3
odoo_advanced_chatter/static/src/js/recipient_list.js

@ -11,6 +11,7 @@ patch(FollowerList.prototype, {
});
},
async check(ev, follower){
//-----To include the newly selected followers into recipients list
var index = this.state.id.indexOf(follower.partner.id)
if (this.state.id.includes(follower.partner.id)){
this.state.id.splice(index, 1)
@ -20,4 +21,4 @@ patch(FollowerList.prototype, {
}
this.threadService.check = this.state.id
}
})
})

3
odoo_advanced_chatter/static/src/js/schedule_mail.js

@ -86,5 +86,4 @@ setup() {
this.clear()
}
}
})
})

15
odoo_advanced_chatter/static/src/xml/chatter.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!-- Extending the chatter to add the camera icon-->
<t name="chatter_recipients" t-inherit="mail.Chatter"
t-inherit-mode="extension" owl="1">
<xpath expr="//button[hasclass('o-mail-Chatter-recipientListButton')]"
position="after">
<button title="Reply To" type="button"
class="btn btn-primary btn-sm am-control-btn-left oe_button_control_new"
t-on-click="replyTo">
<i class="fa fa-reply"/>
</button>
</xpath>
</t>
</templates>

2
odoo_advanced_chatter/static/src/xml/followers_check.xml

@ -7,4 +7,4 @@
t-ref="check" value="1" t-on-click="(ev)=> this.check(ev,follower)"/>
</xpath>
</t>
</templates>
</templates>

22
odoo_advanced_chatter/wizard/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import mail_wizard_recipient

41
odoo_advanced_chatter/wizard/mail_wizard_recipient.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields
class AddRecipient(models.TransientModel):
"""To add more recipients in the chatter"""
_name = 'mail.wizard.recipient'
_description = 'Add more Recipients'
partner_id = fields.Many2one('res.users', string='Recipients',
help="Choose the user to whom we have to "
"sent the reply mail")
model = fields.Char(string='Related Model', help="Related Model")
model_reference = fields.Integer(string="Related Document Id",
help="Related Document Id")
def add_recipients(self):
"""On selecting the user to whom the mail is sent, the user is then
added to config parameters"""
self.env['ir.config_parameter'].set_param('reply_to',
self.partner_id.id)

25
odoo_advanced_chatter/wizard/mail_wizard_recipients_views.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- wizard view -->
<record model="ir.ui.view" id="mail_wizard_recipient_form">
<field name="name">Add Recipients</field>
<field name="model">mail.wizard.recipient</field>
<field name="arch" type="xml">
<form string="Add Followers">
<group>
<field name="partner_id"
placeholder="Add contacts to notify..."
options="{'no_quick_create': True}"
context="{'show_email': True, 'form_view_ref': 'base.view_partner_simple_form'}"/>
</group>
<footer>
<button string="Add Recipients"
name="add_recipients" type="object" class="btn-primary" data-hotkey="q"/>
<button string="Cancel" class="btn-secondary" special="cancel" data-hotkey="x"/>
</footer>
</form>
</field>
</record>
</data>
</odoo>
Loading…
Cancel
Save