[FIX] website_sale: max value for product per page
Entering a value greater than that allowed by a 32-bit integer raises an error Steps to reproduce: 1. Install eCommerce 2. Open the website and go to the 'Shop' page 3. Open the editor and click on any product in the grid 4. Set the value of the 'Number Of Products' to an integer greater than 2147483647 5. An error is raised Solution: Limit the number of product per page to 10000. This will have the effect of avoiding the `NumericValueOutOfRange` error but will also prevent the user to load too much products at once to avoid a timeout. opw-3226154 closes odoo/odoo#124158 X-original-commit: f620e95b5e459551f881a9aec2bc75b45b9d354e Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This commit is contained in:
@@ -230,15 +230,16 @@ options.registry.WebsiteSaleGridLayout = options.Class.extend({
|
||||
* @see this.selectClass for params
|
||||
*/
|
||||
setPpg: function (previewMode, widgetValue, params) {
|
||||
const PPG_LIMIT = 10000;
|
||||
const ppg = parseInt(widgetValue);
|
||||
if (!ppg || ppg < 1) {
|
||||
return false;
|
||||
}
|
||||
this.ppg = ppg;
|
||||
this.ppg = Math.min(ppg, PPG_LIMIT);
|
||||
return this._rpc({
|
||||
route: '/shop/config/website',
|
||||
params: {
|
||||
'shop_ppg': ppg,
|
||||
'shop_ppg': this.ppg,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user