This question has been flagged

For scanning MRP Operations, we have added a customised button in barcode Application screen, which on click loads All MO before opening the actual scanning screen, which takes more than 1.40mins to load, Kindly help  to optimise the code

def get_all_mo_by_barcode(self):
self.env.cr.execute("""select barcode,name,product_id,id from mrp_production WHERE state in ('confirmed','progress') and barcode IS NOT NULL;""")
mos = self.env.cr.dictfetchall()


I have also tried using ORM methods :

 mos = self.search_read([('barcode', '!=', None),('state','in',['confirmed','progress'])],['barcode', 'name', 'product_id', 'workorder_ids'])


Kindly help us find a solution. Thanks in Advance
Avatar
Discard