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

Hello there,

In the delivery slip, there is this line of code :

<t t-set="has_serial_number" t-value="o.pack_operation_ids.filtered('pack_lot_ids')" groups="stock.group_production_lot" />

Could you please translate this code in ENGLISH? In your words.

Thanks

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

Basically you are creating a variable called has_serial_number using t-set directive and assigning its value with the evaluated expression of t-value which is o.pack_operation_ids.filtered('pack_lot_ids') and only shows this element to the members of group_production_lot.  In pseudocode,

has_serial_number = o.pack_operation_ids.filtered('pack_lot_ids')

From https://www.odoo.com/documentation/8.0/reference/qweb.html , in setting variables section.


Update #1:

o.pack_operation_ids will return you a list or an iterator and by using filtered, you filter the list to contains only the member of the list which has the field pack_lot_ids defined.

From https://www.odoo.com/documentation/8.0/reference/orm.html, in Other recordset operations section.


Ảnh đại diện
Huỷ bỏ
Tác giả

And what about 'filtered'?

See update #1.

Tác giả

Thanks a lot mister! Very nice from you.

No problem, hope it helps!

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 9 23
1947
2
thg 3 23
5187
2
thg 3 22
2573
3
thg 12 19
5286
0
thg 8 16
4139