This seems to be broken now. I'm getting a Missing Error: "One of the documents you are trying to access has been deleted, please try again after refreshing." When the product definitely exists. The wrong ID is being given to the script. I don't know why this is. But this still might be a vaguely useful answer for someone trying to do this.
This is a bit of a dirty method. And it definitely isn't the ideal method for doing this. It doesn't retain history, and the links require a double click on the browser back button, because odoo changes the url slightly. But it works and it's a place to start.
I found a way to do this using javascript and modifying a view.xml in the form of a module:
<addons folder>/bom_links/__init__.py
<addons folder>/bom_links/__openerp__.py
{
'name' : 'Bom Links',
'version' : '1.0',
'author' : 'Will Stott',
'description' : 'MRP override module, adds links to the BOM view',
'category': 'Manufacturing',
'website': 'http://www.openerp.com',
'depends' : ['base', 'mrp', 'web'], # list of dependencies, conditioning startup order
'data' : [
'view/views.xml',
],
'installable': True,
'auto-install': False,
}
<addons folder>/bom_links/view/views.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="bom_assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/bom_links/static/src/override.js"/>
</xpath>
</template>
<record id="mrp_bom_form_view" model="ir.ui.view">
<field name="name">mrp.bom.form</field>
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_form_view"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page[@string='Components']/field/tree/field[@name='product_id']" position="replace">
<field name="product_id" widget="link" on_change="onchange_product_id(product_id, product_qty)"/>
</xpath>
</field>
</record>
</data>
</openerp>
<addons folder>/bom_links/static/src/override.js
openerp.bom_links = function(instance) {
instance.web.list.columns.add("field.link","instance.web.list.FieldTextLink");
_format: function (row_data, options) {
return _.template('<a class="oe_form_uri" href="<%-src%>"><%-text%></a>', {
src: instance.session.url('/web',
{id: row_data[this.id].value[0], view_type:'form', model: 'product.template'}
).replace('?', instance.session.debug ? '?debug=#' : '?#'),
text: row_data[this.id].value[1],
});
}
});
}
I hope this helps some people.
Did you get anywhere with this? I would like to do the same thing. I found the following module: https://www.odoo.com/apps/6.1/web_treeviewlinks/ and the source: http://bazaar.launchpad.net/~credativ/credativ-openerp/addons-6.1/files/head:/web_treeviewlinks/ But it's quite old and I am having trouble understanding how you define the links.