|
| 1 | +odoo.define('spp_base_common.ListControllerFix', function (require) { |
| 2 | +'use strict'; |
| 3 | + |
| 4 | +/** |
| 5 | + * Patch for Odoo bug: swapped parameters in archive notification message. |
| 6 | + * |
| 7 | + * Bug location: odoo/addons/web/static/src/legacy/js/views/list/list_controller.js:658-659 |
| 8 | + * Bug report: https://github.com/odoo/odoo/issues/xxxxx (if applicable) |
| 9 | + * |
| 10 | + * Original shows: "Of the 20,000 records selected, only the first 50,000 have been archived" |
| 11 | + * Fixed to show: "Of the 50,000 records selected, only the first 20,000 have been archived" |
| 12 | + */ |
| 13 | + |
| 14 | +var ListController = require('web.ListController'); |
| 15 | +var session = require('web.session'); |
| 16 | +var core = require('web.core'); |
| 17 | + |
| 18 | +var _t = core._t; |
| 19 | + |
| 20 | +ListController.include({ |
| 21 | + /** |
| 22 | + * @override |
| 23 | + */ |
| 24 | + _toggleArchiveState: async function (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; |
| 29 | + if (notif && resIds.length === session.active_ids_limit && resIds.length < total) { |
| 30 | + const msg = _.str.sprintf( |
| 31 | + _t("Of the %d records selected, only the first %d have been archived/unarchived."), |
| 32 | + resIds.length, // Fixed: swapped - total selected (larger) |
| 33 | + total // Fixed: swapped - actually processed (smaller) |
| 34 | + ); |
| 35 | + this.displayNotification({ title: _t('Warning'), message: msg }); |
| 36 | + } |
| 37 | + }, |
| 38 | +}); |
| 39 | + |
| 40 | +}); |
| 41 | + |
0 commit comments