[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):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
if not len(ids):
|
if not len(ids):
|
||||||
return []
|
return []
|
||||||
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
|
reads = self.browse(cr, uid, ids, context=context)
|
||||||
res = []
|
res = []
|
||||||
for record in reads:
|
for record in reads:
|
||||||
name = record['name']
|
if record.parent_id:
|
||||||
if record['parent_id']:
|
name = '%s / %s' % (record.parent_id.name, record.name)
|
||||||
name = record['parent_id'][1]+' / '+name
|
else:
|
||||||
res.append((record['id'], name))
|
name = record.name
|
||||||
|
res.append((record.id, name))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
|
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
|
||||||
|
|
Loading…
Reference in New Issue