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

Hi All,

How do you pass a field value to an iframe src in Odoo 10?

I have fields latitude and longitude. I want to pass the value to the iframe src:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=latitude,longitude (custom heading)&amp;output=embed"></iframe>


Need your help. Thanks

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

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.  )

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

when i pass an iframe source and tag to an action. when i open it it asks to save to open the page. any ways possible to avoid it

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

have you got an answer for it?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 17
4749
1
thg 5 21
6862
1
thg 2 24
1761
1
thg 6 23
3000
1
thg 6 23
3701