Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
3820 Lượt xem

Hi, thanks in advance for your help.

The Delivery Slip report (WH / IN or WH / OUT) organizes the products by Lot and not by reference. Example:

Product description          Lot 
Product 1                            L001 
Product 2                            L001 
Product 1                            L002 
Product 2                            L002 

I would like the report to go like this: 


Product description               Lot 
Product 1                                 L001
Product 1                                 L002
Product 2                                 L001
Product 2                                 L002

I am using Odoo Studio. Odoo V12

Thanks!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

Have you tried like this way in report qweb template :

https://github.com/odoo/odoo/blob/4909e87cd463c3bedcf096e0535ec90d829aa491/addons/stock/report/report_stockpicking_operations.xml#L91

for example : 

o.move_ids_without_package.sorted(key=lambda m: m.product_id.id)" t-as="move" that will sort move lines by product id.

You can use like that way to sort record by pass that field as key on lambda..

Thanks 


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi Walled, 

Could you tell me where I can find (key=Nonereverse=False) parameter?

Thanks for your help.

Ảnh đại diện
Huỷ bỏ

For example if you want to sort by product name and then by qty:

<tr t-foreach="lines.sorted(key=lambda p: (p.product_id.name, p.product_uom_qty))" t-as="move">

Câu trả lời hay nhất

You can use sorted(key=Nonereverse=False)

Parameters

  • key – either a function of one argument that returns a comparison key for each record, or a field name, or None, in which case records are ordered according the default model’s order
  • reverse – if True, return the result in reverse order



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 24
2863
3
thg 12 20
3242
2
thg 9 20
3549
1
thg 2 20
3291
0
thg 11 19
8