Skip to content

[FIX] point_of_sale: create variant for single-value dynamic attribute#264134

Closed
pedrambiria wants to merge 1 commit into
odoo:19.0from
odoo-dev:19.0-pos-opw-6213957-pebr
Closed

[FIX] point_of_sale: create variant for single-value dynamic attribute#264134
pedrambiria wants to merge 1 commit into
odoo:19.0from
odoo-dev:19.0-pos-opw-6213957-pebr

Conversation

@pedrambiria
Copy link
Copy Markdown
Contributor

When a product template has a dynamic attribute with only one value, isConfigurable() returns false (correctly suppressing the configurator popup), but create_product_variant_from_pos was never called, leaving the order line without a proper variant and causing error when trying to add it to the order.

opw-6213957


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented May 12, 2026

Pull request status dashboard

@C3POdoo C3POdoo requested review from a team and adgu-odoo and removed request for a team May 12, 2026 14:44
const result = await this.data.callRelated(
"product.template",
"create_product_variant_from_pos",
[productTemplate.id, attributeValueIds, this.config.id]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of attributeValueIds, you should put every attribute values of the product (even the no-variant ones). Something like

productTemplate.attribute_line_ids.flatMap((l) =>
    l.product_template_value_ids.map((v) => v.id)
)

Otherwise you'll get an error in the backend if you try it with a product that has other attribute lines than dynamic attribute line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing it. I modified it, and also added this case to the test.

@pedrambiria pedrambiria force-pushed the 19.0-pos-opw-6213957-pebr branch from a50555c to 06602cf Compare May 13, 2026 13:25
When a product template has a dynamic attribute with only one value,
`isConfigurable()` returns `false` (correctly suppressing the
configurator popup), but `create_product_variant_from_pos` was never
called, leaving the order line without a proper variant and causing
error when trying to add it to the order.

opw-6213957
@pedrambiria pedrambiria force-pushed the 19.0-pos-opw-6213957-pebr branch from 06602cf to 3fe40f6 Compare May 13, 2026 13:27
Copy link
Copy Markdown
Contributor

@adgu-odoo adgu-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robodoo r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants