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

How to set a dynamic iframe src in Views when editing a Form in Odoo Studio?

I want to achieve some thing like this:

<page name="studio_page_uj7zz" string="MyTabName">
  <group name="studio_group_uj7zz">
     <iframe marginheight="0" marginwidth="0" frameborder="0" src="https://www.example.com/salepage.aspx?SaleOrderId={model.id}" width="100%" height="1000"/>
  </group>
</page>
Ả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ỏ
Câu trả lời hay nhất

Hi @Bertus

Can you You could load some images of the view when you call the tracking number?
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 21
4436
1
thg 5 25
4058
3
thg 12 23
11246
1
thg 11 22
4894
1
thg 3 22
9801