mirror of
https://github.com/bringout/oca-ocb-mail.git
synced 2026-04-23 06:02:03 +02:00
Initial commit: Mail packages
This commit is contained in:
commit
4e53507711
1948 changed files with 751201 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class Rating(models.Model):
|
||||
|
||||
_inherit = "rating.rating"
|
||||
|
||||
@api.depends('res_model', 'res_id')
|
||||
def _compute_res_name(self):
|
||||
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':
|
||||
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()
|
||||
|
||||
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['views'] = [[view_id, 'form']]
|
||||
return action
|
||||
Loading…
Add table
Add a link
Reference in a new issue