Skip to Content
Menú
This question has been flagged
2 Respostes
1371 Vistes

Hi all,

I've a product with a list of optional products (Upsell & Cross-Sell  configurable) and I would like to show them in product configuration form in a certain order.
I've tried to insert them with the same order I'm expecting to see then within product configuration lines but no way to have a satisfying result.
It seems to me that the order of different optional products is only alphabetical.  
It has no sense for me !
I also can't add a letter in front the description of product or add 01 02... etc. It would be nice to have a sequence field nr to define the default sort of optional products.

Shortly how add a sequence withing the Upsell & Cross-Sell section of product ?

Anybody of you have fixed this bug ?
Thanks

Avatar
Descartar
Autor Best Answer

Thanks Pablo for hints.
I will ask to a more tech than me person to implement it.

I see that below  And you need to add this line....  there is big empty space. 
The same below  And modify the t-foreach.
Did you miss something ? Did you write some code or an image ?

Avatar
Descartar

Look de comments

Best Answer

Hi, 

I have the same problem and it can be solved in the following way:


1º Create new integer field in model product.template in me case with studio (EJ -> x_studio_optional_priority_products)


2º Assing priority to products or variant products.


3º You need to inherit the view and modify in me case the view are optional_product_item

And you need to add this line 

LOOK COMMENTS

 

  

 

is for order the items by priority


And modify the t-foreach.


Thats the unique solution I found.

Avatar
Descartar

<t t-set="optional_products_sorted" t-value="sorted(product.optional_product_ids, key=lambda p: p.categ_id.x_studio_priority)"/>

<t t-foreach="optional_products_sorted" t-as="product">

Thats the code, i dont now why odoo dont let me post in my previus comment

Related Posts Respostes Vistes Activitat
4
de jul. 19
3674
2
de juny 25
1627
0
de març 25
1505
0
de febr. 25
1145
0
d’ag. 24
807