perf: limit initial POS loyalty member load to 200 records to improve startup time
This commit is contained in:
parent
b8218d83a9
commit
a1915323df
@ -22,8 +22,13 @@ class ResPartner(models.Model):
|
||||
@api.model
|
||||
def _load_pos_data_domain(self, data, config):
|
||||
domain = super()._load_pos_data_domain(data, config)
|
||||
# OR together the standard POS loaded partners (cashier, active orders) with all individual loyalty members
|
||||
return ['|'] + domain + ['&', ('is_company', '=', False), ('loyalty_card_ids', '!=', False)]
|
||||
# Limit initial load of extra loyalty members to 200 to ensure fast POS startup (1-2 seconds)
|
||||
loyalty_members = self.search(
|
||||
[('is_company', '=', False), ('loyalty_card_ids', '!=', False)],
|
||||
limit=200,
|
||||
order='write_date desc'
|
||||
)
|
||||
return ['|'] + domain + [('id', 'in', loyalty_members.ids)]
|
||||
|
||||
@api.model
|
||||
def _load_pos_data_fields(self, config):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user