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

Hello everybody!!!

I want to ask you : I have a function with it i want to test a value.

But, the question is how can i call it in qweb.

Can anyone give me an example please.

Thanks a lot in advance.

Best regards.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

you can call the function like this:

<span t-esc="o.function(o.your_parameter_value)" />

Hope this help for you..

Cheers,

Ankit H Gandhi.

อวตาร
ละทิ้ง

Is there any way I could call the function on t-field attribute. My function returns a float value and calling the function in t-esc attribute causes some stripping in floating point value. For example, if the function returns 10.00, calling it from t-esc displays only 10.0 and the last zero is stripped.

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

I have function on py:

 def _get_batch_exp_date(self,invoice_line):

packing_list= []

res= {}

product_list= []

pack_obj= self.pool.get('stock.pack.operation')

for line in invoice_line:

if not line.invoice_id.origin:

break

else:

if line.product_id and (line.product_id.id not in product_list):

product_list.append(line.product_id.id)

pack_ids= pack_obj.search(self.cr, self.uid, [('picking_id.origin','=',line.invoice_id.origin),('product_id','=',line.product_id.id)])

for pack_line in pack_obj.browse(self.cr, self.uid, pack_ids):

packing_list.append(pack_line)

return packing_list

then i call it on qweb by write :

<tr t-foreach="get_batch_exp_date(o.invoice_line)" t-as="l">

<td></td>

<td><span t-field="l.product_id.name"/></td>

<td><span t-field="l.product_qty"/></td>

<td><span t-field="l.lot_id.name"/></td>

<td><span t-field="l.lot_id.life_date"/></td>

</tr>

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 23
6249
1
มิ.ย. 23
4276
1
เม.ย. 23
5014
1
พ.ย. 22
3715
1
ต.ค. 21
12061