[IMP] stock,mrp: add indexes on picking type
This commit adds an index on picking_type_id for models stock.picking and mrp.production. Filtering on picking_type_id is often done via the Inventory Overview. This should speed up the list render in case of many object. Task : 2648449 closes odoo/odoo#80434 Related: odoo/upgrade#3068 Related: odoo/enterprise#22535 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -113,7 +113,7 @@ class MrpProduction(models.Model):
|
||||
picking_type_id = fields.Many2one(
|
||||
'stock.picking.type', 'Operation Type',
|
||||
domain="[('code', '=', 'mrp_operation'), ('company_id', '=', company_id)]",
|
||||
default=_get_default_picking_type, required=True, check_company=True)
|
||||
default=_get_default_picking_type, required=True, check_company=True, index=True)
|
||||
use_create_components_lots = fields.Boolean(related='picking_type_id.use_create_components_lots')
|
||||
location_src_id = fields.Many2one(
|
||||
'stock.location', 'Components Location',
|
||||
|
||||
@@ -333,7 +333,7 @@ class Picking(models.Model):
|
||||
'Has Scrap Moves', compute='_has_scrap_move')
|
||||
picking_type_id = fields.Many2one(
|
||||
'stock.picking.type', 'Operation Type',
|
||||
required=True, readonly=True,
|
||||
required=True, readonly=True, index=True,
|
||||
states={'draft': [('readonly', False)]})
|
||||
picking_type_code = fields.Selection(
|
||||
related='picking_type_id.code',
|
||||
|
||||
Reference in New Issue
Block a user