[FIX] sale_product_configurator : fix variants dynamic creation

Before this commit, when selecting a dynamic attribute on the
configurator, an RPC call is made to the server, and the id of the
variant was returned if it existed. If it didn't exist, the server
didn't return the id, and the previous id, if any, was kept in the
client, causing the dynamic creation to fail believing that the product
was already created.

Now, the server will return `False` as `id` if the variant is not yet
created. This value will override any value previously saved as `id` in
the client, allowing the creation of new variants when needed.

opw-3423821

closes odoo/odoo#130720

X-original-commit: 4540f971db2d65bc3453e9579c39109775cd5794
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Leloup Loïc (lole)
2023-08-03 19:32:02 +02:00
parent 24edd423dd
commit 6ec298fabe
2 changed files with 2 additions and 2 deletions
@@ -312,7 +312,7 @@ class ProductConfiguratorController(Controller):
# and no_variant attributes into account. Also, drop the id which was auto-included by the
# search but isn't relevant since it is supposed to be the id of a `product.product` record.
if not product_or_template.is_product_variant:
basic_information.pop('id')
basic_information['id'] = False
combination_name = combination._get_combination_name()
if combination_name:
basic_information.update(
@@ -10,7 +10,7 @@ export class Product extends Component {
static components = { PTAL };
static template = "sale_product_configurator.product";
static props = {
id: { type: Number, optional: true },
id: { type: [Number, {value: false}], optional: true },
product_tmpl_id: Number,
display_name: String,
description_sale: [Boolean, String], // backend sends 'false' when there is no description