Browse Source

Jun 21: [FIX] Bug Fixed 'odoo_advanced_chatter'

pull/331/head
RisvanaCybro 1 year ago
parent
commit
c0f36949a2
  1. 2
      odoo_advanced_chatter/__manifest__.py
  2. 5
      odoo_advanced_chatter/doc/RELEASE_NOTES.md
  3. 4
      odoo_advanced_chatter/models/mail_thread.py
  4. 27
      odoo_advanced_chatter/static/description/index.html
  5. 7
      odoo_advanced_chatter/static/src/js/chatter.js
  6. 6
      odoo_advanced_chatter/static/src/js/recipient_list.js
  7. 25
      odoo_advanced_chatter/static/src/js/schedule_mail.js
  8. 8
      odoo_advanced_chatter/wizard/mail_wizard_recipient.py

2
odoo_advanced_chatter/__manifest__.py

@ -21,7 +21,7 @@
#############################################################################
{
'name': 'Odoo Advanced Chatter',
'version': '17.0.2.0.0',
'version': '17.0.2.0.1',
'category': 'Discuss',
'summary': 'Schedule Log note and Send Message in Chatter',
'description': """We have the capability to schedule log notes and send

5
odoo_advanced_chatter/doc/RELEASE_NOTES.md

@ -9,3 +9,8 @@
#### Version 17.0.2.0.0
#### UPDATE
- UPDATE
#### 19.06.2024
#### Version 17.0.2.0.1
#### UPDATE
- BUG FIX

4
odoo_advanced_chatter/models/mail_thread.py

@ -136,8 +136,6 @@ class Message(models.AbstractModel):
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(
@ -153,7 +151,7 @@ class Message(models.AbstractModel):
'model': self._name,
'res_id': self.id,
# content
'body': escape(body), # escape if text, keep if markup
'body': escape(body),
'message_type': message_type,
'parent_id': self._message_compute_parent_id(parent_id),
'subject': subject or False,

27
odoo_advanced_chatter/static/description/index.html

@ -89,7 +89,7 @@
</div>
</div>
</div>
<div class="col-md-6 col-sm-12 p-3">
<div class="col-md-12 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); ">
@ -111,7 +111,7 @@
</div>
</div>
</div>
<div class="col-md-6 col-sm-12 p-3">
<div class="col-md-12 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); ">
@ -132,6 +132,26 @@
</div>
</div>
</div>
<div class="col-md-12 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;
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;
font-size: 1.2rem; margin-bottom: 2px;">
Manage Recipients.</p>
<p class="m-0" style="color:#718096">We can manage
recipients in the Reply Mail.
</p>
</div>
</div>
</div>
</div>
<div class="container rounded">
<ul class="nav nav-tabs d-flex"
@ -389,7 +409,8 @@
<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>
We can the same corresponding changes in the
Mail details also.</h4>
</div>
</div>
</div>

7
odoo_advanced_chatter/static/src/js/chatter.js

@ -2,10 +2,17 @@
import { Chatter } from "@mail/core/web/chatter";
import { patch } from "@web/core/utils/patch";
import { _t } from "@web/core/l10n/translation";
import { useService } from "@web/core/utils/hooks";
//patch the class ChatterContainer to added the click function
patch(Chatter.prototype ,{
setup() {
super.setup();
this.orm = useService("orm");
this.orm.call(
'mail.wizard.recipient',
'get_user',
[this.env.model.user.userId]
);
},
replyTo(){
//-----On clicking thr reply to icon a wizard is opened to select the recipient

6
odoo_advanced_chatter/static/src/js/recipient_list.js

@ -6,8 +6,8 @@ import { useState } from "@odoo/owl";
patch(FollowerList.prototype, {
setup() {
super.setup();
this.state = useState({
id:[]
this.state = useState({
id:[]
});
},
async check(ev, follower){
@ -20,5 +20,5 @@ patch(FollowerList.prototype, {
this.state.id.push(follower.partner.id)
}
this.threadService.check = this.state.id
}
}
})

25
odoo_advanced_chatter/static/src/js/schedule_mail.js

@ -3,9 +3,16 @@ import { Composer } from "@mail/core/common/composer";
import { patch } from "@web/core/utils/patch";
import { prettifyMessageContent, escapeAndCompactTextContent } from "@mail/utils/common/format";
import { useRef } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
patch(Composer.prototype, {
setup() {
super.setup();
setup() {
super.setup();
this.orm = useService("orm");
this.orm.call(
'mail.wizard.recipient',
'get_user',
[this.env.model.user.userId]
)
},
async scheduleLogNote(){
// ------to schedule lognote -------------
@ -19,23 +26,23 @@ setup() {
? this.messageService.getMentionsFromText(message, {
mentionedChannels: this.props.composer.mentionedChannels,
mentionedPartners: this.props.composer.mentionedPartners,
})
})
: undefined;
$.each(validMentions.partners,(index,mentions) => {
mentioned_list.push(mentions.id)
});
});
var followers_list=[]
$.each( this.props.composer.thread.followers,(index,follower) => {
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);
if (index !== -1) {
followers_list.splice(index, 1);
}
})
}
}
if (this.props.type === "note" ){
const action = {
type: 'ir.actions.act_window',
@ -55,7 +62,7 @@ setup() {
},
};
this.env.services.action.doAction(
action,
action,
{
}
);

8
odoo_advanced_chatter/wizard/mail_wizard_recipient.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields
from odoo import models, fields, api
class AddRecipient(models.TransientModel):
@ -39,3 +39,9 @@ class AddRecipient(models.TransientModel):
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):
"""if reply mail is sent to the person who sent the mail,
then default person will be set in config parameters"""
self.env['ir.config_parameter'].set_param('reply_to', user_id)

Loading…
Cancel
Save