diff --git a/modules/product/CHANGELOG b/modules/product/CHANGELOG index fed8f5b83f..c645e57ad0 100644 --- a/modules/product/CHANGELOG +++ b/modules/product/CHANGELOG @@ -1,3 +1,4 @@ +* Order the list of variants on the product * Allow a different list price to be set for each variant Version 7.6.0 - 2025-04-28 diff --git a/modules/product/product.py b/modules/product/product.py index c1e89e89ee..94c8739bd6 100644 --- a/modules/product/product.py +++ b/modules/product/product.py @@ -120,6 +120,10 @@ class Template( 'template', 'category', "Categories", readonly=True) products = fields.One2Many( 'product.product', 'template', "Variants", + order=[ + ('position', 'ASC NULLS FIRST'), + ('id', 'ASC'), + ], help="The different variants the product comes in.") @classmethod @@ -416,6 +420,9 @@ class Product( code = fields.Char( "Code", readonly=True, help="A unique identifier for the variant.") + position = fields.Integer( + "Position", + help="The order of the variant in the list of variants on product.") identifiers = fields.One2Many( 'product.identifier', 'product', "Identifiers", help="Other identifiers associated with the variant.") @@ -498,6 +505,10 @@ class Product( ] cls._sql_indexes.add( Index(t, (t.code, Index.Similarity(cardinality='high')))) + cls._sql_indexes.add( + Index(t, + (t.position, Index.Range(order='ASC NULLS FIRST')), + (t.id, Index.Range(order='ASC')))) for attr in dir(Template): tfield = getattr(Template, attr) diff --git a/modules/product/product.xml b/modules/product/product.xml index 0ce9393b51..f0c79c7b9e 100644 --- a/modules/product/product.xml +++ b/modules/product/product.xml @@ -113,6 +113,13 @@ this repository contains the full copyright notices and license terms. --> product_tree_simple + + product.product + tree + + product_tree_simple_sequence + + product.product diff --git a/modules/product/view/product_form_simple.xml b/modules/product/view/product_form_simple.xml index fd3d565f4f..919219f7a6 100644 --- a/modules/product/view/product_form_simple.xml +++ b/modules/product/view/product_form_simple.xml @@ -2,9 +2,6 @@
-