refactor: reduce customer fetch limit from 100 to 25 in partner list sync

This commit is contained in:
Suherdy Yacob 2026-06-13 23:04:22 +07:00
parent 0dfe27fadb
commit fce0369533

View File

@ -24,17 +24,17 @@ patch(PartnerList.prototype, {
}
return;
}
try {
this.state.loading = true;
// console.log("[pos_loyalty_multi_level] Fetching the latest 100 customers from the backend...");
// In Odoo 19, data.searchRead fetches data AND creates/updates the local reactive models invisibly
const newPartners = await this.pos.data.searchRead(
"res.partner",
[["active", "=", true]],
this.pos.data.fields["res.partner"],
{ limit: 100, order: 'id desc' }
"res.partner",
[["active", "=", true]],
this.pos.data.fields["res.partner"],
{ limit: 25, order: 'id desc' }
);
let addedCount = 0;
@ -47,18 +47,18 @@ patch(PartnerList.prototype, {
addedCount++;
}
}
// Refresh initial view
this.state.initialPartners = this.pos.models["res.partner"].filter((p) => {
const par = p.property_account_receivable_id;
return !par || par.non_trade !== true;
});
if (this.notification) {
this.notification.add(`Successfully synced list. Found ${addedCount} new customers.`, 3000);
}
// console.log(`[pos_loyalty_multi_level] Fetch complete. Added ${addedCount} customers to the session.`);
} catch (e) {
console.warn("[pos_loyalty_multi_level] Failed to update customer data:", e);
if (this.notification) {