跳至內容
選單
此問題已被標幟
1 回覆
4264 瀏覽次數

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

頭像
捨棄
最佳答案

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.


頭像
捨棄
作者

And what about 'filtered'?

See update #1.

作者

Thanks a lot mister! Very nice from you.

No problem, hope it helps!

相關帖文 回覆 瀏覽次數 活動
0
9月 23
1941
2
3月 23
5185
2
3月 22
2567
3
12月 19
5285
0
8月 16
4135