Skip to Content
Menu
This question has been flagged
1 Reply
5144 Views

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
1
Nov 24
18021
1
Sep 23
1208
3
May 23
4096
7
Apr 23
47101
1
Dec 22
6438