@ -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] |
|
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 354 KiB After Width: | Height: | Size: 455 KiB |
@ -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, {}) |
|||
} |
|||
}) |
@ -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> |
@ -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 |
@ -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) |
@ -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> |