Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1614 มุมมอง

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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 ?

อวตาร
ละทิ้ง

Look de comments

คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง

<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 ตอบกลับ มุมมอง กิจกรรม
4
ก.ค. 19
3836
2
ก.ย. 25
362
1
ส.ค. 25
566
2
มิ.ย. 25
2023
0
มี.ค. 25
1893