コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
6915 ビュー

Hello, i need a way to pass record's fields which contain variables to be used in iframe src any idea on how to do that?

Thank you in advance

アバター
破棄
最善の回答

From the looks of it QWEB statements does not work in form and tree views.

But this can be done with a computed HTML field on the model and adding it to your views. 


Model:

tracking_number = fields.Char ("Tracking Number") 

tracking_iframe = fields.  Html ("Tracking Preview", sanitize = False, compute = 'get_html') 


def get_html (self): 

  for record in self: 

    record.tracking_iframe = f '<iframe   src = "http://dhl.com/en/express /tracking.html?AWB=} record.tracking_number}" />   


View:

<field name = "tracking_number" /> 

<field name = "tracking_iframe" />


(In the compute function there should be curly brackets around   ecord.tracking_number, forum editor is not accepting it.  )

アバター
破棄
関連投稿 返信 ビュー 活動
0
7月 17
4841
0
3月 15
4334
2
8月 22
8050
0
9月 23
1380
0
11月 22
3405