Reputation: 71
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.
Upvotes: 3
Views: 1846
Reputation: 5986
As of this writing, in Odoo 15, it is still not possible to do that directly. You need to add a button in the view, but that can be done easily in the view XML only:
<tree no_open="1">
<field name="name"/>
<button name="get_formview_action" string="View" type="object" class="btn-primary"/>
</tree>
With no_open="1"
, clicking on a line in the tree will not open the popup.
get_formview_action
is a Python method that already exists in Odoo for all models, and you don't have to write yourself.
Upvotes: 0
Reputation: 2825
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.
Upvotes: 3