[IMP] point_of_sale: faster loading of pos session
name_get of pos.category should use a browse instead of a read. For a company having thousands of products and a few categories, using a browse will greatly improve the load time as it is cached.
This commit is contained in:
parent
ccb4e4332e
commit
35a061eb0d
|
@ -1354,13 +1354,14 @@ class pos_category(osv.osv):
|
|||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
|
||||
reads = self.browse(cr, uid, ids, context=context)
|
||||
res = []
|
||||
for record in reads:
|
||||
name = record['name']
|
||||
if record['parent_id']:
|
||||
name = record['parent_id'][1]+' / '+name
|
||||
res.append((record['id'], name))
|
||||
if record.parent_id:
|
||||
name = '%s / %s' % (record.parent_id.name, record.name)
|
||||
else:
|
||||
name = record.name
|
||||
res.append((record.id, name))
|
||||
return res
|
||||
|
||||
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
|
||||
|
|
Loading…
Reference in New Issue