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

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhấ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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 24
20215
1
thg 9 23
3026
3
thg 5 23
5631
7
thg 4 23
49005
1
thg 12 22
7869