mirror of
https://github.com/bringout/oca-ocb-mail.git
synced 2026-04-25 07:22:02 +02:00
19.0 vanilla
This commit is contained in:
parent
5df8c07b59
commit
daa394e8b0
2114 changed files with 564841 additions and 299642 deletions
|
|
@ -4,8 +4,7 @@
|
|||
from odoo import api, models
|
||||
|
||||
|
||||
class Rating(models.Model):
|
||||
|
||||
class RatingRating(models.Model):
|
||||
_inherit = "rating.rating"
|
||||
|
||||
@api.depends('res_model', 'res_id')
|
||||
|
|
@ -13,15 +12,23 @@ class Rating(models.Model):
|
|||
for rating in self:
|
||||
# cannot change the rec_name of session since it is use to create the bus channel
|
||||
# so, need to override this method to set the same alternative rec_name as in reporting
|
||||
if rating.res_model == 'mail.channel':
|
||||
if rating.res_model == 'discuss.channel':
|
||||
current_object = self.env[rating.res_model].sudo().browse(rating.res_id)
|
||||
rating.res_name = ('%s / %s') % (current_object.livechat_channel_id.name, current_object.id)
|
||||
else:
|
||||
super(Rating, rating)._compute_res_name()
|
||||
super(RatingRating, rating)._compute_res_name()
|
||||
|
||||
def action_open_rated_object(self):
|
||||
action = super(Rating, self).action_open_rated_object()
|
||||
if self.res_model == 'mail.channel':
|
||||
view_id = self.env.ref('im_livechat.mail_channel_view_form').id
|
||||
action = super().action_open_rated_object()
|
||||
if self.res_model == 'discuss.channel':
|
||||
if self.env[self.res_model].browse(self.res_id):
|
||||
ctx = self.env.context.copy()
|
||||
ctx.update({'active_id': self.res_id})
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'mail.action_discuss',
|
||||
'context': ctx,
|
||||
}
|
||||
view_id = self.env.ref('im_livechat.discuss_channel_view_form').id
|
||||
action['views'] = [[view_id, 'form']]
|
||||
return action
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue