Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
5628 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
1
nov. 24
20215
1
sept. 23
3029
3
mai 23
5634
7
avr. 23
49007
1
déc. 22
7873