[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#59803 X-original-commit: e9c54f6b3d5c36b658308e1900ab68dcc9de0357 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user