コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
1099 ビュー

In the MRP Module's Production Order Report, I need to display the total of all components measured in grams. If necessary, an additional calculated studio field can be used in the form view. Any suggestions are appreciated.

Sharing parts of the components lines within the report

<t t-name="mrp.report_mrp_production_components">

    <table class="table table-sm">

        <div class="oe_structure"/>

        <t t-set="has_product_barcode" t-value="any(m.product_id.barcode for m in o.move_raw_ids)"/>

        <t t-set="i" t-value="1"/>

        <thead>

            <tr style="font-size: 0.9rem; font-weight: bold">

                <th style="font-weight: bold;">Nº</th>

                <th style="font-weight: bold;">Ingredientes</th>

                <th style="font-weight: bold;">Nº Lote</th>

                <th style="font-weight: bold;">Fecha Caducidad</th>

                <th style="font-weight: bold;" t-attf-class="{{ 'text-end' if not has_product_barcode else '' }}">Candidad (g)</th>

                <th style="font-weight: bold;" t-if="has_product_barcode" width="15%" class="text-center">Barcode</th>

            </tr>

        </thead>

        <tbody>

            <tr style="height: 28.4px;font-size: 0.9rem;" t-foreach="o.move_raw_ids" t-as="raw_line">

                <td>

                    <strong t-esc="i"/>

                    <t t-set="i" t-value="i+1"/>

                </td>

                <td>

                    <span t-field="raw_line.product_id">8 GB RAM</span>

                </td>

                <td>

                    <span t-field="raw_line.lot_ids" t-field-options="{'widget': 'many2many_tags'}"/>

                </td>

                <td>

                    <span t-field="raw_line.lot_ids.expiration_date" t-options="{'format': 'dd/MM/yyyy'}"/>

                </td>

                <td t-attf-class="{{ 'text-end' if not has_product_barcode else '' }}">

                    <span t-field="raw_line.product_uom_qty">25</span>

                    <span t-field="raw_line.product_uom" groups="uom.group_uom">Pieces</span>

                </td>

                <td t-if="has_product_barcode" width="15%" class="text-center">

                    <t t-if="raw_line.product_id.barcode">

                        <span t-field="raw_line.product_id.barcode" t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:100%;height:35px'}">12345678901</span>

                    </t>

                </td>

            </tr>

        </tbody>

アバター
破棄
最善の回答

<t t-set="total_weight_grams" t-value="sum(o.move_raw_ids.mapped(lambda x: (x.product_id.weight * x.product_uom_qty) * 1000)) "/>

アバター
破棄
著作者 最善の回答

Thank you so much, it is working more than fine.

アバター
破棄
関連投稿 返信 ビュー 活動
2
8月 25
475
3
8月 25
634
3
8月 25
1820
1
7月 25
800
0
8月 25
636