İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
5607 Görünümler

looking at mrp_bom_strucuture_report:


<tr t-foreach="get_children(o.bom_line_ids)" t-as="l">
    <td style="padding-left: 20px;">
        <span style="color: white;" t-esc="'... '*(l['level'])"/>
        <span t-esc="l['pname']"/>
    </td>
    <td>
        <span t-esc="l['pqty']"/>
        <span t-esc="l['uname']" groups="product.group_uom"/>
    </td>
    <td>
        <span t-esc="l['code']"/>
...


How does this relate to a model? How do I add my fields I have added to mrp.bom.lines?


Cheers,

Rob

Avatar
Vazgeç
En İyi Yanıt

In Odoo Qweb template engine there are variables that you can use that are defined in the qweb context of the report render, for example as you could see there is a t-foreach tag to iterate over an 'docs' variable and name every element as 'o' docs in that report is an mrp.bom recordset so you could use the 'o' variable as you need by accessing it's fields, also you could review this particular interesting report parser at the end of the file 

/odoo/addons/mrp/report/mrp_bom_structure_report.py

where you could find the definition of the get_children function used in the report and more, specifically the method render_html is the one that is calling the report mrp_bom_strucuture_report to be rendered

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Kas 24
20215
1
Eyl 23
3026
3
May 23
5631
7
Nis 23
49004
1
Ara 22
7869