Here is what worked for me.
- Make a computed HTML field with building the link like this:
link = fields.Html(compute='_compute_link')
def _compute_link(self):
for rec in self:
rec.link = f"""<a href="/mail/view?model={self._name}&res_id={rec.id} target="_blank"><i class="oi oi-launch" onclick="event.stopPropagation()"/></a>"""
- Put the field widget HTML on the list view.
<field name="link" nolabel="1"/>
Notes:
- I'm using
/mail/view the same as a link is given on notification emails, avoid putting action id since it can change over every DB/code.
- If you don't include stop propagation on the link, it will open the record on that tab (as expected click on the cell).