Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
594 มุมมอง

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 25
79
0
เม.ย. 25
521
1
เม.ย. 25
533
1
ก.พ. 25
577
1
ม.ค. 25
735