|
1 | 1 | /** @odoo-module **/ |
2 | 2 |
|
3 | | -import { ListController } from "@web/views/list/list_controller"; |
| 3 | +import { DynamicList } from "@web/model/relational_model/dynamic_list"; |
4 | 4 | import { patch } from "@web/core/utils/patch"; |
5 | 5 | import { _t } from "@web/core/l10n/translation"; |
6 | 6 |
|
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, { |
9 | 18 | async _toggleArchive(isSelected, state) { |
10 | 19 | const method = state ? "action_archive" : "action_unarchive"; |
11 | 20 | const context = this.context; |
12 | 21 | 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 }); |
16 | 23 |
|
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 | + ) { |
19 | 30 | 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) |
23 | 34 | ); |
24 | | - this.model.notification.add(msg, { |
25 | | - title: _t("Warning") |
26 | | - }); |
| 35 | + this.model.notification.add(msg, { title: _t("Warning") }); |
27 | 36 | } |
28 | 37 |
|
29 | 38 | const reload = () => this.model.load(); |
|
0 commit comments