Skip to content
Snippets Groups Projects
Commit e9c54f6b authored by Nicolas Lempereur's avatar Nicolas Lempereur
Browse files

[FIX] sale: default on product change in configurator


When a product is set on a line and we change product with the product
configurator wizard, we will use the attributes values of the previous
product.

But then since the attributes are the ones of wrong product, not
attribute is selected and if eg. we have radio button with one option
and custom value, it will never be selectable (because the radio button
is hidden and unselected).

In this commit, we do not use the current variant values when we change
product in the product configurator wizard.

note: this commit also increases the limit of (custom values) inside the
product configurator wizard, for an arbitrary 10000 limit. Without this
change, each opening of the wizard would only keep 40 customs values and
discard the other ones.

opw-2333091
closes #59016

closes odoo/odoo#59768

X-original-commit: 8f6b38ea63c4e85254e6bed71a44abb447c21332
Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
parent b827936b
No related branches found
No related tags found
No related merge requests found
......@@ -112,6 +112,8 @@ var ProductConfiguratorFormController = FormController.extend({
*/
_configureProduct: function (productTemplateId) {
var self = this;
var initialProduct = this.initialState.data.product_template_id;
var changed = initialProduct && initialProduct.data.id !== productTemplateId;
var data = this.renderer.state.data;
return this._rpc({
route: '/sale_product_configurator/configure',
......@@ -119,10 +121,10 @@ var ProductConfiguratorFormController = FormController.extend({
product_template_id: productTemplateId,
pricelist_id: this.renderer.pricelistId,
add_qty: data.quantity,
product_template_attribute_value_ids: this._getAttributeValueIds(
product_template_attribute_value_ids: changed ? [] : this._getAttributeValueIds(
data.product_template_attribute_value_ids
),
product_no_variant_attribute_value_ids: this._getAttributeValueIds(
product_no_variant_attribute_value_ids: changed ? [] : this._getAttributeValueIds(
data.product_no_variant_attribute_value_ids
)
}
......
......@@ -9,7 +9,7 @@
<field name="product_template_id" class="oe_product_configurator_product_template_id" />
<field name="product_template_attribute_value_ids" invisible="1" />
<field name="product_custom_attribute_value_ids" invisible="1" widget="one2many" >
<tree>
<tree limit="10000">
<field name="custom_product_template_attribute_value_id"/>
<field name="custom_value"/>
</tree>
......
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