3
votes

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.

2

2 Answers

2
votes

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>
-1
votes

Install this module https://www.odoo.com/apps/modules/8.0/web_tree_many2one_clickable/

then add the widget "many2one_clickable" to the required fields in the tree view

For example:

<field name="partner_id" widget="many2one_clickable" />