Yes, you can modify the mrp.BomOverviewTable in Odoo to make the product links open in a new tab. This typically involves customizing the relevant QWeb template or JavaScript component to include the target="_blank" attribute in the <a> tags that generate the product links.
Below are step-by-step instructions on how to achieve this by creating a custom module. This approach ensures that your changes are maintainable and won't be overwritten by future Odoo updates.
Step 1: Create a Custom Module
If you don't already have a custom module, you'll need to create one. Here's a brief outline:
inherit_id="mrp.BomOverviewTable": This tells Odoo that you want to inherit the existing mrp.BomOverviewTable template.
<xpath> Selector: Adjust the XPath expression to correctly target the <a> tag used for product links. Replace @class='product_link' with the actual class or identifier used in your template if different.
<attribute name="target">_blank</attribute>: This adds the target="_blank" attribute to the <a> tag, ensuring that the link opens in a new tab.
Step 3: Update and Install the Module
Update the App List:
Go to Apps in your Odoo backend.
Click on the Update App List (you might need to activate the developer mode to see this option).
Install Your Custom Module:
Search for MRP BOM Overview Enhancements (or whatever name you provided).
Install the module.
Step 4: Verify the Changes
Navigate to the BOM Overview in the Manufacturing (MRP) module. When you click on a product link within the BomOverviewTable, it should now open the product details in a new browser tab.
Additional Considerations
JavaScript Components: If mrp.BomOverviewTable is primarily managed by a JavaScript component (especially in newer Odoo versions using Owl), you might need to extend the JavaScript component instead. Here's a brief outline:
javascript
// In your custom module's static/src/js/mrp_bom_overview_custom.js
odoo.define('my_custom_module.BomOverviewTable', function (require) {
"use strict";
const BomOverviewTable = require('mrp.BomOverviewTable');
BomOverviewTable.include({
render_product_link: function(product) {
return <a href={product.url} target="_blank">{product.name}</a>;
},
});
});
Note: Ensure you include and properly load this JavaScript file in your module's assets.
CSS Adjustments: If needed, you can also add CSS to style the links or add indicators that the link will open in a new tab.
Security and UX: Opening links in new tabs can improve user experience by keeping the original page accessible. However, ensure that this behavior aligns with your overall UX strategy and that it doesn't confuse users.
Conclusion
By inheriting the mrp.BomOverviewTable template and adding the target="_blank" attribute to the product links, you can successfully make these links open in new browser tabs. Ensure you test the changes in a development environment before deploying them to production.
If you encounter any issues or require further customization, feel free to ask!