Browse Source

Jun 21: [FIX] Bug Fixed 'odoo_advanced_chatter'

pull/320/head
RisvanaCybro 10 months ago
parent
commit
386a054125
  1. 2
      odoo_advanced_chatter/README.rst
  2. 1
      odoo_advanced_chatter/__init__.py
  3. 54
      odoo_advanced_chatter/__manifest__.py
  4. 5
      odoo_advanced_chatter/doc/RELEASE_NOTES.md
  5. 1
      odoo_advanced_chatter/models/__init__.py
  6. 50
      odoo_advanced_chatter/models/mail_message.py
  7. 111
      odoo_advanced_chatter/models/schedule_log.py
  8. 3
      odoo_advanced_chatter/security/ir.model.access.csv
  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/v16-hero.gif
  17. 37
      odoo_advanced_chatter/static/description/index.html
  18. 34
      odoo_advanced_chatter/static/src/js/composer.js
  19. 18
      odoo_advanced_chatter/static/src/js/follower_list.js
  20. 100
      odoo_advanced_chatter/static/src/js/schedule_mail.js
  21. 15
      odoo_advanced_chatter/static/src/xml/chatter.xml
  22. 2
      odoo_advanced_chatter/static/src/xml/follower_list.xml
  23. 2
      odoo_advanced_chatter/static/src/xml/schedule_log.xml
  24. 2
      odoo_advanced_chatter/views/schedule_log_view.xml
  25. 22
      odoo_advanced_chatter/wizard/__init__.py
  26. 46
      odoo_advanced_chatter/wizard/mail_wizard_recipient.py
  27. 25
      odoo_advanced_chatter/wizard/mail_wizard_recipients_views.xml

2
odoo_advanced_chatter/README.rst

@ -47,5 +47,3 @@ For support and more information, please visit `Our Website <https://cybrosys.co
Further information
===================
HTML Description: `<static/description/index.html>`__

1
odoo_advanced_chatter/__init__.py

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

54
odoo_advanced_chatter/__manifest__.py

@ -20,34 +20,38 @@
#
#############################################################################
{
"name": "Odoo Advanced Chatter",
"version": "16.0.1.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.""",
"author": "Cybrosys Techno Solutions",
"company": "Cybrosys Techno Solutions",
"maintainer": "Cybrosys Techno Solutions",
"website": "https://www.cybrosys.com",
"depends": ["web", "mail"],
"data": [
"security/ir.model.access.csv",
"data/ir_cron.xml",
"views/schedule_log_views.xml",
'name': 'Odoo Advanced Chatter',
'version': '16.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.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'depends': ['web', 'mail'],
'data': [
'security/ir.model.access.csv',
'data/ir_cron.xml',
'views/schedule_log_view.xml',
'wizard/mail_wizard_recipients_views.xml',
],
"assets": {
"web.assets_backend": [
"odoo_advanced_chatter/static/src/xml/schedule_log.xml",
"odoo_advanced_chatter/static/src/js/schedule_mail.js",
"odoo_advanced_chatter/static/src/xml/follower_list.xml",
"odoo_advanced_chatter/static/src/js/follower_list.js",
'odoo_advanced_chatter/static/src/xml/schedule_log.xml',
'odoo_advanced_chatter/static/src/js/schedule_mail.js',
'odoo_advanced_chatter/static/src/xml/follower_list.xml',
'odoo_advanced_chatter/static/src/js/follower_list.js',
'odoo_advanced_chatter/static/src/xml/chatter.xml',
'odoo_advanced_chatter/static/src/js/composer.js',
]
},
"images": ["static/description/banner.png"],
"license": "LGPL-3",
"installable": True,
"auto_install": False,
"application": False,
'images': ['static/description/banner.png'],
'installable': True,
'license': 'LGPL-3',
'auto_install': False,
'application': False,
}

5
odoo_advanced_chatter/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 16.0.1.0.0
#### ADD
- Initial Commit for Odoo Advanced Chatter
#### 21.06.2024
#### Version 16.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_message
from . import schedule_log

50
odoo_advanced_chatter/models/mail_message.py

@ -0,0 +1,50 @@
# -*- 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
class MailMessage(models.Model):
"""To manage recipients in the reply mail"""
_inherit = "mail.message"
@api.model
def _get_reply_to(self, values):
""" Return a specific reply_to for the document """
model = values.get('model', self._context.get('default_model'))
res_id = values.get('res_id',
self._context.get('default_res_id')) or False
email_from = values.get('email_from')
reply_to_id = self.env['ir.config_parameter'].get_param('reply_to')
author1 = self.env['res.users'].browse(int(reply_to_id))
self.env['ir.config_parameter'].set_param('reply_to', self.env.user.id)
email_from1 = author1.email_formatted
message_type = values.get('message_type')
records = None
if self.is_thread_message({'model': model, 'res_id': res_id,
'message_type': message_type}):
records = self.env[model].browse([res_id])
else:
records = self.env[model] if model else self.env['mail.thread']
if author1.id == self.env.user:
return records._notify_get_reply_to(default=email_from)[res_id]
else:
return records._notify_get_reply_to(default=email_from1)[res_id]

111
odoo_advanced_chatter/models/schedule_log.py

@ -19,53 +19,49 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields
from odoo import models, fields, _, api
import datetime
class ScheduleLog(models.Model):
"""To schedule the log note"""
_name = "schedule.log"
_name = 'schedule.log'
_description = "Schedule log note in chatter"
body = fields.Html(string="Body", help="Content of the log", required="1")
partner_ids = fields.Many2many(
"res.partner", string="Recipients", help="To whom the log is Mentioned"
)
time = fields.Datetime(
string="Scheduled Time", required="1", help="Time at which the log is scheduled"
)
attachment_ids = fields.Many2many(
comodel_name="ir.attachment", string="Attachments", help="attachments"
)
is_log = fields.Boolean(
string="Is Log",
default=False,
help="to check whether it is log note or send " "messages",
)
model = fields.Char(string="Related Model", help="Related Model")
partner_ids = fields.Many2many('res.partner', string='Recipients',
help='To whom the log is Mentioned')
time = fields.Datetime(string="Scheduled Time", required="1",
help="Time at which the log is scheduled")
attachment_ids = fields.Many2many(comodel_name='ir.attachment',
string="Attachments", help="attachments")
is_log = fields.Boolean(string='Is Log', default=False,
help="to check whether it is log note or send "
"messages")
model = fields.Char(string='Related Model', help="Related Model")
model_reference = fields.Integer(string="Related Document Id")
status = fields.Selection(
[("draft", "Schedule"), ("post", "Post")],
string="Status",
default="draft",
help="status of the message",
)
status = fields.Selection([('draft', "Schedule"), ('post', "Post")],
string='Status', default='draft',
help="status of the message")
def action_save(self):
"""Display notification when messages are scheduled"""
if self.body:
current_time = fields.Datetime.now().replace(second=0)
scheduled_time = fields.Datetime.from_string(self.time).replace(second=0)
time_difference = abs((current_time - scheduled_time).total_seconds())
scheduled_time = fields.Datetime.from_string(self.time).replace(
second=0)
time_difference = abs(
(current_time - scheduled_time).total_seconds())
acceptable_difference = 5
if time_difference <= acceptable_difference:
user_id = self.env.user.commercial_partner_id
partner_ids = self.partner_ids.ids
if user_id.id in self.partner_ids.ids:
partner_ids.remove(user_id.id)
model = self.env[self.model].sudo().browse(self.model_reference)
model = self.env[self.model].sudo().browse(
self.model_reference)
print('elf.is_log', self.is_log)
if not self.is_log:
message = model.message_post(
author_id=self.create_uid.partner_id.id,
@ -75,7 +71,7 @@ class ScheduleLog(models.Model):
)
for mail in message.mail_ids:
mail.send()
self.status = "post"
self.status = 'post'
else:
message = model.message_post(
author_id=self.create_uid.partner_id.id,
@ -83,37 +79,36 @@ class ScheduleLog(models.Model):
body=self.body,
partner_ids=partner_ids,
attachment_ids=self.attachment_ids.ids,
message_type="comment",
subtype_xmlid="mail.mt_comment",
message_type='comment',
subtype_xmlid='mail.mt_comment'
)
print('notify',message.notification_ids)
message.notification_ids = [fields.Command.clear()]
message.notification_ids = [
fields.Command.create({"res_partner_id": pid})
for pid in partner_ids
]
self.status = "post"
message.notification_ids = [fields.Command.create({
'res_partner_id': pid
}) for pid in partner_ids]
self.status = 'post'
else:
return {
"type": "ir.actions.client",
"tag": "display_notification",
"params": {
"title": "Title",
"message": "Message scheduled successfully.",
"sticky": True,
"next": {"type": "ir.actions.act_window_close"},
},
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'title': 'Title',
'message': "Message scheduled successfully.",
'sticky': True,
'next': {'type': 'ir.actions.act_window_close'},
}
}
def schedule(self):
"""To schedule the log note"""
date = datetime.datetime.now()
date_sec = date.replace(second=0).strftime("%Y-%m-%d %H:%M:%S")
date_max = date.replace(second=59).strftime("%Y-%m-%d %H:%M:%S")
scheduled_lognotes = self.env["schedule.log"].search(
date_sec = date.replace(second=0).strftime('%Y-%m-%d %H:%M:%S')
date_max = date.replace(second=59).strftime('%Y-%m-%d %H:%M:%S')
scheduled_lognotes = self.search(
[
("time", ">=", date_sec),
("time", "<=", date_max),
("status", "=", "draft"),
('time', '>=', date_sec), ('time', '<=', date_max),
('status', '=', 'draft')
]
)
for rec in scheduled_lognotes:
@ -121,7 +116,8 @@ class ScheduleLog(models.Model):
partner_ids = rec.partner_ids.ids
if user_id.id in rec.partner_ids.ids:
partner_ids.remove(user_id.id)
model = self.env[rec.model].sudo().browse(rec.model_reference)
model = self.env[rec.model].sudo().browse(
rec.model_reference)
if not rec.is_log:
message = model.message_post(
author_id=rec.create_uid.partner_id.id,
@ -131,7 +127,7 @@ class ScheduleLog(models.Model):
)
for mail in message.mail_ids:
mail.send()
rec.status = "post"
rec.status = 'post'
else:
message = model.message_post(
author_id=rec.create_uid.partner_id.id,
@ -139,12 +135,11 @@ class ScheduleLog(models.Model):
body=rec.body,
partner_ids=partner_ids,
attachment_ids=rec.attachment_ids.ids,
message_type="comment",
subtype_xmlid="mail.mt_comment",
message_type='comment',
subtype_xmlid='mail.mt_comment'
)
message.notification_ids = [fields.Command.clear()]
message.notification_ids = [
fields.Command.create({"res_partner_id": pid})
for pid in partner_ids
]
rec.status = "post"
message.notification_ids = [fields.Command.create({
'res_partner_id': pid
}) for pid in partner_ids]
rec.status = 'post'

3
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_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/11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 KiB

After

Width:  |  Height:  |  Size: 455 KiB

37
odoo_advanced_chatter/static/description/index.html

@ -143,6 +143,11 @@
<img src="assets/misc/check-box.png" class="mr-2"/>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">We can mange Recipients from the follower's list </span>
</div>
<div class="d-flex align-items-center"
style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2"/>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">We can mange Recipients in the Reply Mail. </span>
</div>
</div>
@ -233,6 +238,38 @@
</h3>
<img src="assets/screenshots/screenshot10.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
A new icon is added in the composer,a wizard is opened to select the recipient to which the reply mail is to be sent.
</h3>
<img src="assets/screenshots/11.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
We can choose the recipient to which the reply mail is to be sent.
</h3>
<img src="assets/screenshots/12.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Now sent the message.
</h3>
<img src="assets/screenshots/13.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Go to Settings-> Technical -> Messages , We can see the messages we sent in that we can see the change in Reply-to
</h3>
<img src="assets/screenshots/14.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
In the mail also we can see the changes
</h3>
<img src="assets/screenshots/15.png" class="img-thumbnail">
<img src="assets/screenshots/16.png" class="img-thumbnail">
<img src="assets/screenshots/17.png" class="img-thumbnail">
</div>
</div>

34
odoo_advanced_chatter/static/src/js/composer.js

@ -0,0 +1,34 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { Composer } from "@mail/components/composer/composer";
import { _t } from 'web.core';
import { useService } from "@web/core/utils/hooks";
patch(Composer.prototype, 'chatter_recipients',{
setup() {
this._super();
this.orm = useService('orm')
var userId = this.env.searchModel.userService.userId
this.orm.call(
'mail.wizard.recipient',
'get_user',
[userId]
)
},
replyTo() {
var userId = this.env.searchModel.userService.userId
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:userId,
},
}
this.env.services.action.doAction(action, {})
}
})

18
odoo_advanced_chatter/static/src/js/follower_list.js

@ -8,14 +8,14 @@ registerPatch({
recordMethods:{
//---to manage the recipients to whom the message should sent
Check(){
var index = message_list.indexOf(this.follower.partner.id)
if (message_list.includes(this.follower.partner.id)){
message_list.splice(index, 1)
}
else{
message_list.push(this.follower.partner.id)
}
this.follower.followedThread.composer.check = message_list
var index = message_list.indexOf(this.follower.partner.id)
if (message_list.includes(this.follower.partner.id)){
message_list.splice(index, 1)
}
else{
message_list.push(this.follower.partner.id)
}
this.follower.followedThread.composer.check = message_list
}
}
})
})

100
odoo_advanced_chatter/static/src/js/schedule_mail.js

@ -1,9 +1,6 @@
/** @odoo-module **/
import { registerPatch } from '@mail/model/model_core';
import { patch } from '@web/core/utils/patch';
registerPatch({
name: 'ComposerView',
recordMethods: {
@ -14,63 +11,54 @@ registerPatch({
const recipient = this.composer.check
var followers_list=[]
$.each(composer.thread.followers,(index,follower) => {
followers_list.push(follower.partner.id)
followers_list.push(follower.partner.id)
});
if (recipient){
recipient.forEach(item=>{
const index = followers_list.indexOf(item);
if (index !== -1) {
followers_list.splice(index, 1);
}
})
recipient.forEach(item=>{
const index = followers_list.indexOf(item);
if (index !== -1) {
followers_list.splice(index, 1);
}
})
}
if (!this.composer.isLog ){
const action = {
type: 'ir.actions.act_window',
res_model:'schedule.log',
domain: [],
views: [ [false, "form"],[false, "list"],],
name: this.env._t("Schedule Message"),
target: 'new',
context: {
default_body:postData.body,
default_attachment_ids:postData.attachment_ids,
default_is_log:1,
default_partner_ids:followers_list,
default_model:composer.thread.model,
default_model_reference:composer.thread.id,
},
};
this.env.services.action.doAction(
action,
{
}
);
}
else{
const action = {
type: 'ir.actions.act_window',
res_model:'schedule.log',
domain: [],
views: [ [false, "form"],[false, "list"],],
name: this.env._t("Schedule Log"),
target: 'new',
context: {
default_body:postData.body,
default_attachment_ids:postData.attachment_ids,
default_partner_ids:followers_list,
default_is_log:0,
default_model:composer.thread.model,
default_model_reference:composer.thread.id,
},
};
this.env.services.action.doAction(
action,
{
}
);
}
const action = {
type: 'ir.actions.act_window',
res_model:'schedule.log',
domain: [],
views: [ [false, "form"],[false, "list"],],
name: this.env._t("Schedule Message"),
target: 'new',
context: {
default_body:postData.body,
default_attachment_ids:postData.attachment_ids,
default_is_log:1,
default_partner_ids:followers_list,
default_model:composer.thread.model,
default_model_reference:composer.thread.id,
},
};
this.env.services.action.doAction(action, {});
}
else{
const action = {
type: 'ir.actions.act_window',
res_model:'schedule.log',
domain: [],
views: [ [false, "form"],[false, "list"],],
name: this.env._t("Schedule Log"),
target: 'new',
context: {
default_body:postData.body,
default_attachment_ids:postData.attachment_ids,
default_partner_ids:followers_list,
default_is_log:0,
default_model:composer.thread.model,
default_model_reference:composer.thread.id,
},
};
this.env.services.action.doAction(action, {})
}
},
},
});

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 reply to icon-->
<t name="chatter_recipients" t-inherit="mail.Composer"
t-inherit-mode="extension" owl="1">
<xpath expr="//small[hasclass('o_Composer_followers')]"
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/follower_list.xml

@ -7,4 +7,4 @@
t-ref="check" value="1" t-on-click="followerView.Check"/>
</xpath>
</t>
</templates>
</templates>

2
odoo_advanced_chatter/static/src/xml/schedule_log.xml

@ -9,4 +9,4 @@
title="Schedule Mail" aria-label="Schedule Log" type="button" t-on-click="composerView.scheduleLogNote"/>
</xpath>
</t>
</templates>
</templates>

2
odoo_advanced_chatter/views/schedule_log_views.xml → odoo_advanced_chatter/views/schedule_log_view.xml

@ -28,4 +28,4 @@
<field name="res_model">schedule.log</field>
<field name="view_mode">form</field>
</record>
</odoo>
</odoo>

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

46
odoo_advanced_chatter/wizard/mail_wizard_recipient.py

@ -0,0 +1,46 @@
# -*- 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, api
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")
message_id = fields.Many2one('mail.message')
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)
@api.model
def get_user(self, user_id):
self.env['ir.config_parameter'].set_param('reply_to', user_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