Skip to content

Commit b998f62

Browse files
committed
[FIX] js
1 parent 35fa530 commit b998f62

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

spp_base_common/static/src/legacy/js/views/list/list_controller_fix.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,33 @@
1010
* Fixed to show: "Of the 50,000 records selected, only the first 20,000 have been archived"
1111
*/
1212

13-
import {ListController} from "@web/views/list/list_controller";
13+
import ListController from "web.ListController";
14+
import session from "web.session";
15+
import core from "web.core";
1416
import {patch} from "@web/core/utils/patch";
1517

18+
const _t = core._t;
19+
1620
patch(ListController.prototype, {
1721
/**
1822
* @override
1923
*/
20-
async toggleArchiveState(archive) {
21-
const resIds = await this.getSelectedResIds();
22-
const total = this.model.root.count;
23-
24-
await this.model.root.archive(resIds, archive);
24+
async _toggleArchiveState(archive) {
25+
const resIds = await this.getSelectedIdsWithDomain();
26+
const notif = this.isDomainSelected;
27+
await this._archive(resIds, archive);
28+
const total = this.model.get(this.handle, {raw: true}).count;
2529

26-
if (this.model.root.isDomainSelected && resIds.length < total) {
27-
const message = _.str.sprintf(
28-
this.env._t("Of the %d records selected, only the first %d have been archived/unarchived."),
29-
total, // Fixed: swapped - total selected (larger)
30-
resIds.length // Fixed: swapped - actually processed (smaller)
30+
// Fixed: Swapped parameters from original (total, resIds.length) to (resIds.length, total)
31+
// Logic: resIds.length < total, so resIds.length is the smaller number (actually archived)
32+
// and total is the larger number (total selected)
33+
if (notif && resIds.length === session.active_ids_limit && resIds.length < total) {
34+
const msg = _.str.sprintf(
35+
_t("Of the %d records selected, only the first %d have been archived/unarchived."),
36+
resIds.length, // Fixed: total selected (smaller due to active_ids_limit)
37+
total // Fixed: actually archived (larger - all that were selected)
3138
);
32-
this.notification.add(message, { type: "warning" });
39+
this.displayNotification({ title: _t('Warning'), message: msg });
3340
}
3441
},
3542
});

0 commit comments

Comments
 (0)