Good afternoon, I am creating a report in order of delivery, and would like to pull the value of the invoice, total value of the product Within this report I've been able to pull a few more fields from the billing and total value of the product, not yet I have not been able to. Do I need to create some relationship between objects or give to do this within the report template? for example: <Span t-field = "o.product_id.company_id.partner_id.invoice_ids.number" t-options = '{"widget": "monetary", "display_currency": o.product_id.currency_id}'> </ span> did not work :( I'm kind of lost.
My code in xml template:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="danfe_assets_backend" name="Danfe assets" inherit_id="report.assets_common">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/css" href="/inventoryindigoway/static/css/format.css"/>
</xpath>
</template>
<record id="paperformat_report_delivery_slip" model="report.paperformat">
<field name="name">Formato Nota</field>
<field name="default" eval="True" />
<field name="orientation">Portrait</field>
<field name="margin_top">3.0</field>
<field name="margin_left">3.0</field>
<field name="margin_right">3.0</field>
<field name="margin_bottom">5.0</field>
</record>
<record id="action_report_delivery2" model="ir.actions.report.xml">
<field name="paperformat_id" ref="paperformat_report_delivery_slip"/>
<field name="name">Nota de Entrega Indigo</field>
</record>
<data>
<template id= "inventoryindigoway.report_deliveryslips">
<!-- T-CALL USADO PARA CHAMAR SUB TEMPLATES-->
<t t-call="report.html_container" >
<t t-foreach ="docs" t-as ="o">
<t t-call ="report.external_layout">
<div class="page" >
<div class="oe_structure container">
<div class="row">
<div class="borda-completa col-xs-12">
<div class="row bb">
<div class="col-xs-12 line">
<span class="medium">Recebemos de <t t-raw="o.company_id.name"/> os produtos constantes neste controle indicada ao lado</span>
</div>
</div>
<div class="row line">
<div class="br col-xs-3 line">
<span class="small">Data de Recebimento</span>
</div>
<div class="col-xs-9 line">
<span class="small">Identificação e assinatura do recebedor</span>
</div>
</div>
</div>
<div class="borda-completa col-xs-12">
<div class="row line">
<div class="br col-xs-3 line">
<span class="enfase">Nº PEDIDO: <t t-raw="o.origin"/></span>
</div>
<div class="col-xs-9 line">
<span class="big">CONTROLE DE ENTREGA</span>
</div>
</div>
</div>
</div>
<div> EMITENTE<t t-esc = "name" /> </div>
<span class="medium">Admin: <t t-esc="request.env.user.name"/></span>
<!--T-IF USADO PARA CRIAR CONDICOES EXEMPLO ABAIXO -->
<div>
<p t-if = "request.env.user.name == 'Administrator'" > Mestre boas-vindas! </p>
<p t-else = ""> Bem-vindo! </p>
</div>
<t t-foreach = "[1, 2, 3]" t-as = "i" >
<t t-esc ="i"/>
</t>
<div class="row">
<div class="borda-completa col-xs-12">
<div class="row line">
<div class="bt bl br col-xs-8 line">
<span class="small">Nome/Razão Social</span><br />
<span t-raw="o.company_id.name"></span>
</div>
<div class="bt br col-xs-2 line">
<span class="small">CNPJ/CPF</span><br />
<span t-field="o.company_id.name"></span>
</div>
<div class="bt br col-xs-2 line">
<span class="small">INSC. ESTADUAL / RG </span><br />
<span t-field="o.company_id.name" style="font-size:11px;"></span>
</div>
</div>
</div>
</div>
<hr style="border-top:0px dashed black; margin:3px;" />
<div> DESTINATÁRIO/REMETENTE<t t-esc = "name" /> </div>
<hr style="border-top:0px dashed black; margin:3px;" />
<div class="row line">
<div class="bt bl br col-xs-8 line">
<span class="small">Nome/Razão Social</span><br />
<span t-raw="o.partner_id.name"></span>
</div>
<div class="bt br col-xs-2 line">
<span class="small">CNPJ/CPF</span><br />
<span t-field="o.partner_id.name"></span>
</div>
<div class="bt br col-xs-2 line">
<span class="small">Data da Emissão</span><br />
<span t-field="o.min_date" style="font-size:11px;"></span>
</div>
</div>
<div class="row line">
<div class="bt bl br col-xs-6 line">
<span class="small">Endereço</span><br />
<span t-field="o.partner_id.street"></span>
</div>
<div class="bt br col-xs-3 line">
<span class="small">Bairro/Distrito</span><br />
<span t-field="o.partner_id.street"></span>
</div>
<div class="bt br col-xs-1 line">
<span class="small">CEP</span><br />
<span t-field="o.partner_id.zip" style="font-size:11px;"></span>
</div>
<div class="bt br col-xs-2 line">
<span class="small">Data da Saída/Entrada</span><br />
<span t-field="o.min_date" style="font-size:11px;"></span>
</div>
</div>
<div class="row line">
<div class="bt bl br bb col-xs-6 line">
<span class="small">Município</span><br />
<span t-field="o.partner_id.city"></span>
</div>
<div class="bt br bb col-xs-3 line">
<span class="small">Fone</span><br />
<span t-raw="o.partner_id.phone or o.partner_id.mobile"></span>
</div>
<div class="bt br bb col-xs-1 line">
<span class="small">UF</span><br />
<t t-if="o.partner_id.state_id == '3'">
<span>EX</span>
</t>
<t t-if="o.partner_id.state_id != '3'">
<span t-field="o.partner_id.state_id"></span>
</t>
</div>
<div class="bt br bb col-xs-2 line">
<span class="small">Inscrição Estadual</span><br />
<span t-field="o.partner_id.zip"></span>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<span class="enfase">Faturas</span>
</div>
</div>
<div class="row line">
<div class="borda-completa col-xs-6 line">
<span class="small">Número da Fatura</span><br />
<span t-field="o.product_id.company_id.partner_id.invoice_ids.number" t-options='{"widget": "monetary", "display_currency": o.product_id.currency_id}'></span>
</div>
<!-- <div class="bt br bb col-xs-2 line">
<span class="small">Valor Original</span><br />
<span t-field="o.fatura_bruto"></span>
</div>
<div class="bt br bb col-xs-2 line">
<span class="small">Desconto</span><br />
<span t-field="o.fatura_desconto"></span>
</div>
<div class="bt br bb col-xs-2 line">
<span class="small">Valor Líquido</span><br />
<span t-field="o.fatura_liquido"></span>
</div> -->
</div>
<hr style="border-top:0px dashed black; margin:3px;" />
<div>TRANSPORTADOR/VOLUMES TRANSPORTADOS<t t-esc = "name" /> </div>
<hr style="border-top:0px dashed black; margin:3px;" />
<div class="row line">
<div class="borda-completa col-xs-5 line">
<span class="small">Nome/Razão Social</span><br />
<span t-esc="o.move_type"></span>
</div>
<div class="bt br bb col-xs-2 line">
<span class="small">Frete por conta</span><br />
<span t-field="o.group_id"></span>
</div>
<div class="bt br bb col-xs-1 line">
<span class="small">Código ANTT</span><br />
<span t-field="o.priority"></span>
</div>
<div class="bt br bb col-xs-1 line">
<span class="small">Placa</span><br />
<span style="font-size:11px;" t-field="o.priority"></span>
</div>
<div class="bt br bb col-xs-1 line">
<span class="small">UF</span><br />
<span t-field="o.partner_id.state_id"></span>
</div>
<div class="bt br bb col-xs-2 line">
<span class="small">CNPJ/CPF</span><br />
<span t-field="o.partner_id.name"></span>
</div>
</div>
<hr style="border-top:0px dashed black; margin:3px;" />
<div>DADOS DO PRODUTO/SERVIÇO<t t-esc = "name" /> </div>
<hr style="border-top:0px dashed black; margin:3px;" />
<div class="row">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th style="width:6%;">Cód. Produto</th>
<th style="width:33%;">Descrição do Produto/Serviço</th>
<th style="width:3%;">Un.</th>
<th style="width:6%;">Quantidade</th>
<th style="width:7%;">Valor Unitário</th>
<th style="width:7%;">Valor Total</th>
</tr>
</thead>
<tbody>
<t t-foreach="o.move_lines" t-as="move">
<tr>
<td><span t-esc="move.product_id.default_code"></span></td>
<td>
<span t-raw="move.product_id.name"></span>
</td>
<td><span t-field="move.product_uom"></span></td>
<td><span t-field="move.ordered_qty"></span></td>
<td><span t-field="move.price_unit" t-options='{"widget": "monetary", "display_currency": o.product_id.currency_id}'></span></td>
<td> <span t-esc = "move.ordered_qty * move.price_unit " t-options='{"widget": "monetary", "display_currency": o.product_id.currency_id}'/> </td>
</tr>
</t>
</tbody>
</table>
</div>
<hr style="border-top:0px dashed black; margin:3px;" />
<div> DADOS ADICIONAIS<t t-esc = "name" /> </div>
<hr style="border-top:0px dashed black; margin:3px;" />
<div class="row">
<div class="borda-completa col-xs-7 line4">
<span class="small">Informações Complementares</span><br />
<span class="small" t-field="o.note" style="text-transform: none;"></span><br />
</div>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
<report
string="Nota de Entrega Indigo"
id="action_report_delivery2"
model="stock.picking"
report_type="qweb-html"
name="inventoryindigoway.report_deliveryslips"
file="inventoryindigoway.report_deliveryslips"
/>
</data>
</odoo>
Invoice_ids is x2many so you can't acces to data just like invoice_ids.number. you need to do a for or mapped to show the number