From b1dff85a85dc1819c029b564dbb87871c2f5e7ea Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Thu, 26 Nov 2020 07:07:12 +0000 Subject: [PATCH] [FIX] point_of_sale: error in pos.config form when editing/discarding Prior to 28762b79e3398dc883af9e0caef7c86cc5c051e0, `_enableButtons` method is mainly called after saving changes in the record, now, it is also called when discarding such that its argument can become `undefined`. This causes error in pos.config form because it uses a custom form which hooked to the said method in order to reload the window when a module_ or group_ field is modified. This commit prevents this error by having a fallback empty array when `changedFields` is `undefined`. closes odoo/odoo#62366 Signed-off-by: pimodoo --- .../static/src/js/web_overrides/pos_config_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/web_overrides/pos_config_form.js b/addons/point_of_sale/static/src/js/web_overrides/pos_config_form.js index 62cc162af21..9623f3f8cd4 100644 --- a/addons/point_of_sale/static/src/js/web_overrides/pos_config_form.js +++ b/addons/point_of_sale/static/src/js/web_overrides/pos_config_form.js @@ -8,7 +8,7 @@ odoo.define('point_of_sale.pos_config_form', function (require) { var PosConfigFormController = FormController.extend({ _enableButtons: function (changedFields) { let shouldReload = false; - for (let field of changedFields) { + for (let field of (changedFields || [])) { if ( field.startsWith('module_') || field.startsWith('group_') ||