تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6823 أدوات العرض

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
يوليو 17
4709
0
مارس 15
4165
2
أغسطس 22
7928
0
سبتمبر 23
1283
0
نوفمبر 22
3296