How to open one2many record in current window, not a popup in odoo V13

Viewed 773

I searched through the old forums and didn't find any decent answers. Is it possible to click on a record in a one2many list and have it open the full page, rather than just the popup?

If yes, where else i can make changes in the code ?

I'm trying to access attachments/reports/links associated with that record, and that's not possible if I'm only ever getting a popup window.

Thanks for your input.

1 Answers

You can use button to achieve this in form view list. The button type has to be object and it will return ir.actions.act_window type action.

Add following button inside the tree tag:

<button name="open_action" string="Open" type="object" class="oe_highlight"/>

Add this function to the model:

def open_action(self):
  return {
    'name': self.display_name,
    'type': 'ir.actions.act_window',
    'view_mode': 'form',
    'res_model': self._name,
    'res_id': self.id,
    'target': 'current
}

Note that target current ensure the object will open in current window. Target new opens in a modal popup.

Related