perf: reduce POS loyalty member search and render limit from 200 to 100 for improved performance

This commit is contained in:
Suherdy Yacob 2026-06-03 10:11:24 +07:00
parent a1915323df
commit a6cb85b6c0
2 changed files with 4 additions and 4 deletions

View File

@ -22,10 +22,10 @@ class ResPartner(models.Model):
@api.model
def _load_pos_data_domain(self, data, config):
domain = super()._load_pos_data_domain(data, config)
# Limit initial load of extra loyalty members to 200 to ensure fast POS startup (1-2 seconds)
# Limit initial load of extra loyalty members to 100 to ensure fast POS startup (1-2 seconds)
loyalty_members = self.search(
[('is_company', '=', False), ('loyalty_card_ids', '!=', False)],
limit=200,
limit=100,
order='write_date desc'
)
return ['|'] + domain + [('id', 'in', loyalty_members.ids)]

View File

@ -38,7 +38,7 @@ patch(PartnerList.prototype, {
.replace(/%/g, ".*")
);
// Pre-normalize and cache p.searchString, then filter and limit to 200 items to avoid rendering lag
// Pre-normalize and cache p.searchString, then filter and limit to 100 items to avoid rendering lag
const matches = [];
for (const p of filteredPartners) {
if (!p._normalizedSearchString) {
@ -46,7 +46,7 @@ patch(PartnerList.prototype, {
}
if (regex.test(p._normalizedSearchString)) {
matches.push(p);
if (matches.length >= 200) {
if (matches.length >= 100) {
break;
}
}