Skip to content

Commit 4caaafc

Browse files
committed
[FIX] correct JS
1 parent 7917115 commit 4caaafc

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

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

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
/** @odoo-module **/
22

3-
import { ListController } from "@web/views/list/list_controller";
3+
import { DynamicList } from "@web/model/relational_model/dynamic_list";
44
import { patch } from "@web/core/utils/patch";
55
import { _t } from "@web/core/l10n/translation";
66

7-
// Patch for Odoo bug: swapped parameters in archive notification
8-
patch(ListController.prototype, {
7+
/**
8+
* Patch for Odoo 17 bug: swapped parameters in archive notification message.
9+
*
10+
* Bug location: addons/web/static/src/model/relational_model/dynamic_list.js
11+
* GitHub: https://github.com/odoo/odoo/blob/17.0/addons/web/static/src/model/relational_model/dynamic_list.js
12+
*
13+
* Original bug shows: "Of the 20,000 records selected, only the first 50,000 have been archived"
14+
* Fixed to show: "Of the 50,000 records selected, only the first 20,000 have been archived"
15+
*/
16+
17+
patch(DynamicList.prototype, {
918
async _toggleArchive(isSelected, state) {
1019
const method = state ? "action_archive" : "action_unarchive";
1120
const context = this.context;
1221
const resIds = await this.getResIds(isSelected);
13-
const action = await this.model.orm.call(this.resModel, method, [resIds], {
14-
context
15-
});
22+
const action = await this.model.orm.call(this.resModel, method, [resIds], { context });
1623

17-
// FIXED: Swapped this.count and resIds.length
18-
if (this.isDomainSelected && resIds.length === this.model.activeIdsLimit && resIds.length < this.count) {
24+
// FIXED: Swapped parameters from (resIds.length, this.count) to (this.count, resIds.length)
25+
if (
26+
this.isDomainSelected &&
27+
resIds.length === this.model.activeIdsLimit &&
28+
resIds.length < this.count
29+
) {
1930
const msg = _t(
20-
"Of the %s records selected, only the first %s have been archived/unarchived.",
21-
this.count, // FIXED: Total records selected (larger)
22-
resIds.length // FIXED: Actually processed (smaller)
31+
"Of the %s records selected, only the first %s have been archived/unarchived.",
32+
this.count, // FIXED: Total records selected (larger number)
33+
resIds.length // FIXED: Actually processed (smaller number, limited)
2334
);
24-
this.model.notification.add(msg, {
25-
title: _t("Warning")
26-
});
35+
this.model.notification.add(msg, { title: _t("Warning") });
2736
}
2837

2938
const reload = () => this.model.load();

0 commit comments

Comments
 (0)