[IMP] mail: quick-open related record from message
Before this commit if you found a message and wanted to open the related record you would need to find it manually by finding the right view and then using the ID stored on the message to open it. By adding a smartbutton the user can quick-navigate to the related record in a second. This allows for quickly finding and opening records which is usually handy when debugging things. Ref Task-2660873 closes odoo/odoo#77675 closes odoo/odoo#77803 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Thibault Delavallée
parent
aaef93c017
commit
50f6e5f2be
@@ -691,6 +691,17 @@ class Message(models.Model):
|
||||
self.update(attachement_values)
|
||||
thread._message_update_content_after_hook(self)
|
||||
|
||||
def action_open_document(self):
|
||||
""" Opens the related record based on the model and ID """
|
||||
self.ensure_one()
|
||||
return {
|
||||
'res_id': self.res_id,
|
||||
'res_model': self.model,
|
||||
'target': 'current',
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
}
|
||||
|
||||
# ------------------------------------------------------
|
||||
# DISCUSS API
|
||||
# ------------------------------------------------------
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Message">
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="action_open_document" string="Open Document"
|
||||
type="object" class="oe_link" icon="fa-file-text-o"
|
||||
attrs="{'invisible': ['|', ('model', '=', False), ('res_id', '=', 0)]}"/>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="subject"/>
|
||||
|
||||
Reference in New Issue
Block a user