[PERF] mrp: add missing indexes
Add missing indexes on stock.move and mrp.workorder to speed up search_read on mrp.production. That's mostly useful at the opening of the Shop Floor app. closes odoo/odoo#160349 Related: odoo/enterprise#59998 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -33,7 +33,7 @@ class MrpWorkorder(models.Model):
|
||||
product_id = fields.Many2one(related='production_id.product_id', readonly=True, store=True, check_company=True)
|
||||
product_tracking = fields.Selection(related="product_id.tracking")
|
||||
product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure', required=True, readonly=True)
|
||||
production_id = fields.Many2one('mrp.production', 'Manufacturing Order', required=True, check_company=True, readonly=True)
|
||||
production_id = fields.Many2one('mrp.production', 'Manufacturing Order', required=True, check_company=True, readonly=True, index='btree')
|
||||
production_availability = fields.Selection(
|
||||
string='Stock Availability', readonly=True,
|
||||
related='production_id.reservation_state', store=True) # Technical: used in views and domains only
|
||||
|
||||
@@ -135,7 +135,7 @@ class StockMove(models.Model):
|
||||
'mrp.routing.workcenter', 'Operation To Consume', check_company=True,
|
||||
domain="[('id', 'in', allowed_operation_ids)]")
|
||||
workorder_id = fields.Many2one(
|
||||
'mrp.workorder', 'Work Order To Consume', copy=False, check_company=True)
|
||||
'mrp.workorder', 'Work Order To Consume', copy=False, check_company=True, index='btree_not_null')
|
||||
# Quantities to process, in normalized UoMs
|
||||
bom_line_id = fields.Many2one('mrp.bom.line', 'BoM Line', check_company=True)
|
||||
byproduct_id = fields.Many2one(
|
||||
|
||||
Reference in New Issue
Block a user