Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1141 Visualizações

Hello, I am using the following code in odoo v17 using Studio. I am trying to add in a simple PDF report the image and unit of measure in the report but the code doesn´t work 


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

    <div class="o_mrp_bom_report_page container py-3 py-lg-5 px-0 bg-view">

        <div t-if="data.get('lines')">

            <div class="px-3 mb-5">

                <h1>Lista de Materiales</h1>

                <div class="d-flex align-items-center mb-3">

                    <!-- Imagen del Producto Principal usando image_data_uri -->

                    <img t-if="data.get('image_1920')" t-att-src="image_data_uri(data['image_1920'])" class="img-thumbnail me-3" style="max-width: 100px; max-height: 100px;"/>

                    <div>

                        <h3 t-esc="data['name']"/>

                        <!-- Unidad de Medida del Producto Principal -->

                        <p>Unidad de Medida: <span t-esc="data['uom_name']"/></p>

                    </div>

                </div>

            </div>

            <table class="table table-borderless">

                <thead>

                    <tr>

                        <th>Imagen</th>

                        <th>Descripción del Producto</th>

                        <th class="text-end">Cantidad</th>

                        <th class="text-start">Unidad de Medida</th>

                    </tr>

                </thead>

                <tbody>

                    <t t-foreach="data['lines']" t-as="line">

                        <tr>

                            <!-- Imagen de los Productos en la Lista de Materiales usando image_data_uri -->

                            <td>

                                <img t-if="line.get('image_1920')" t-att-src="image_data_uri(line['image_1920'])" class="img-thumbnail" style="max-width: 80px; max-height: 80px;"/>

                            </td>

                            <!-- Descripción del Producto -->

                            <td t-esc="line.get('name', '')"/>

                            <!-- Cantidad -->

                            <td t-esc="line.get('quantity', 0)" t-options="{'widget': 'float', 'decimal_precision': 'Product Unit of Measure'}" class="text-end"/>

                            <!-- Unidad de Medida -->

                            <td t-esc="data['uom_name']" class="text-start"/>

                        </tr>

                    </t>

                </tbody>

            </table>

        </div>

        <div t-else="" class="d-flex align-items-center justify-content-center h-50">

            <h4 class="text-muted">No hay datos disponibles.</h4>

        </div>

    </div>

</t>


Someone can help me?

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
5
ago. 25
1325
1
fev. 25
12233
2
dez. 24
829
0
mai. 24
1327
4
jun. 25
1027