By default, when you click on a tree view item in Odoo (while inside some other document's Form), it will open the linked document as a popup instead of navigating to the document, replacing the content of the 'current' window (which is the expected behavior).
I would like to replicate what you can do with action windows (that is, setting the target:current) to a tree list inside my Form so that when I click on any of the related records in the list, I can navigate to the related record taking up the entire current window. Can it be done?
Thanks.
I am not sure if there is a better way to accomplish your goal. I too have shared your pain. To get around it I create a function on the destination model and add a button to the list view to activate it. All the function does is execute a window action opening the record as you have described.
@api.multi
def open_rec(self):
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'addon.model',
'res_id': self.id,
'type': 'ir.actions.act_window',
'target': 'current',
'flags': {'form': {'action_buttons': True}}
}
And wherever your list view is declared you can add something like this.
<tree>
<field name="field1"/>
<field name="field1"/>
<field name="field1"/>
<button name="open_rec" string="Open" type="object"/>
</tree>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With