Skip to content
Snippets Groups Projects
Commit a4349a03 authored by Victor Feyens's avatar Victor Feyens
Browse files

[FIX] sale: configurator opening on variant input


When the optional column "Product Variant" is enabled on
the sales order lines tree view, if the variant of a
configurable template is given, the configurator was triggered
and opened when it shouldn't have, since the variant is already
chosen.

Backport of de7a6f5f3d83356eb02f8fc25b4a0b8aabb946b3 in 16.0+
Fixed in 16.3+ by the forward-port, but not in the base commit.

task-3397870
opw-3450317

closes odoo/odoo#131574

Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
parent e631bff0
No related branches found
No related tags found
No related merge requests found
......@@ -9,16 +9,34 @@ export class SaleOrderLineProductField extends Many2OneField {
setup() {
super.setup();
let isMounted = false;
let isInternalUpdate = false;
const super_update = this.update;
this.update = (recordlist) => {
isInternalUpdate = true;
super_update(recordlist);
};
if (this.props.canQuickCreate) {
this.quickCreate = (name, params = {}) => {
if (params.triggeredOnBlur) {
return this.openConfirmationDialog(name);
}
isInternalUpdate = true;
return this.props.update([false, name]);
};
}
useEffect(value => {
if (!isMounted) {
isMounted = true;
} else if (value) {
} else if (value && isInternalUpdate) {
// we don't want to trigger product update when update comes from an external sources,
// such as an onchange, or the product configuration dialog itself
if (this.props.relation === 'product.template') {
this._onProductTemplateUpdate();
} else {
this._onProductUpdate();
}
}
isInternalUpdate = false;
}, () => [Array.isArray(this.value) && this.value[0]]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment