[FIX] point_of_sale: error in pos.config form when editing/discarding

Prior to 28762b79e3, `_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 <pimodoo@users.noreply.github.com>
This commit is contained in:
Joseph Caburnay
2020-11-26 07:13:53 +00:00
parent 1736a15c7c
commit b1dff85a85
@@ -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_') ||