[Python] I can't remove a title from a variable in a sales order in Odoo 14

Discussão em 'Python' iniciado por Stack, Agosto 20, 2025.

  1. Stack

    Stack Membro Participativo

    I am working with Odoo 14, and I need to remove the CNPJ/CPF title from the sale.order PDF. I’ve managed to remove the data itself, but the title CNPJ/CPF: is still showing up.

    Here is the XML code I've used to try removing it:

    <?xml version="1.0" encoding="utf-8"?>
    <odoo>
    <data>
    <template id="report_saleorder_controller" inherit_id="sale.report_saleorder_document" priority="20">

    <!-- Remove o campo CNPJ/CPF do cliente -->
    <xpath expr="//span[contains(@t-field, 'partner_id.vat')]" position="replace"/>

    <!-- Remove blocos originais do parceiro, mas mantém layout seguro -->
    <xpath expr="//div[contains(@t-field, 'partner_id')]" position="replace"/>
    <xpath expr="//span[contains(@t-field, 'payment_term_id')]" position="replace"/>

    <!-- Remove endereço de entrega -->
    <xpath expr="//div[contains(@t-field, 'partner_shipping_id')]" position="replace"/>

    <!-- Remove endereço de faturamento -->
    <xpath expr="//div[contains(@t-field, 'partner_invoice_id')]" position="replace"/>

    <!-- Remove a coluna "Taxes" (cabeçalho) -->
    <xpath expr="//th[@name='th_taxes']" position="replace"/>

    </template>
    </data>
    </odoo>


    When I try to remove the entire div or even the specific <span> with partner_id.vat, Odoo can’t find the element and the system crashes. I also tried modifying the backend with a custom model to return an empty value for partner_id.vat, but it still shows the CNPJ/CPF label in the PDF.

    Can anyone guide me on how I can fully remove this title from the sales order PDF?

    Some additional context:

    I’m using Odoo 14.

    I tried both frontend XML and backend methods.

    Logs show issues when trying to find the partner_id.vat field.

    Any suggestions?

    [​IMG]

    image for more context

    Continue reading...

Compartilhe esta Página