Is adding Indexes to core fields using modules a good idea?


We are going to add some indexes to certain fields (Odoo 10). But I'm not 100% sure that this is the best approach. So currently I'm inheriting for example sale.order.line to add an index to product_id.  Any side effect to this? If I uninstall the module it will not remove the field (that's good) but the index will stay. 

class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'

product_id = fields.Many2one('product.product', string='Product', domain=[('sale_ok', '=', True)], change_default=True, ondelete='restrict', required=True, index=True)
2 Comentários
James Becker

I would love to know the answer to this question. I, too, am considering adding an index to a core field.

nobody answered until now on this ? I don't understand why Odoo didn't add indexes on a lot of ID fields as well, so I want to do this at least for a couple of them ...