A previous refactoring brought a bom_line_ids field on the mrp.bom, thus deprecating the _child_compute method. But the previous refactoring did not go through all the views, breaking everything that relied on the _child_compute (tree view, report). As the bom_line_ids refers to the mrp.bom.line model (introduced by this previous refactoring, note: _child_compute returned mrp.bom record) and that we can't make a treeview showing different model, this patch introduce a function field _get_child_bom_lines on the mrp.line model, allowing to go through the bom_line_ids of a mrp.bom.line if this mrp.bom.line refers to a mrp.bom. [IMP] Rename bom_line_ids to child_line_ids in mrp_bom_line to avoid confusion
55 lines
2.2 KiB
XML
55 lines
2.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<openerp>
|
|
<data>
|
|
<template id="report_mrpbomstructure">
|
|
<t t-call="report.html_container">
|
|
<t t-call="report.internal_layout">
|
|
<div class="page">
|
|
<h2>BOM Structure</h2>
|
|
<table class="table table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>BOM Name</th>
|
|
<th>Quantity</th>
|
|
<th>BOM Ref</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<t t-foreach="docs" t-as="o">
|
|
<tr style="font-weight: bold;">
|
|
<td>
|
|
<span t-field="o.product_id.default_code"/>
|
|
<span t-field="o.name"/>
|
|
</td>
|
|
<td>
|
|
<span t-field="o.product_qty"/>
|
|
<span groups="product.group_uom" t-field="o.product_uom.name"/>
|
|
</td>
|
|
<td>
|
|
<span t-field="o.code"/>
|
|
</td>
|
|
</tr>
|
|
<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['pcode']"/>]
|
|
<span t-esc="l['pname']"/>
|
|
</td>
|
|
<td>
|
|
<span t-esc="formatLang(l['pqty'])"/>
|
|
<span t-esc="l['uname']" groups="product.group_uom"/>
|
|
</td>
|
|
<td>
|
|
<span t-esc="l['code']"/>
|
|
</td>
|
|
</tr>
|
|
</t>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
</template>
|
|
</data>
|
|
</openerp>
|