Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

254
Visualizações
how to print div from html to qweb report in invoice (website) ? Odoo 14

In the 'report_invoice_document' report, I added :

  <t t-if="report_type == 'html'">
      <div class="from_website" >
           <strong> Printed From Invoice</strong>
      </div>
  </t>

I want to get this div only when printing or downloding from website side .

How can I do it without modifying the content of the report generated from backend. Any help please ? Thanks. enter image description here enter image description here

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

You can use the website variable to check if the invoice report is printed from the website

website
the current website object, if any (this item can be present but None)

Try the following code:

<t t-if="website">
    <div class="from_website" >
        <strong> Printed From Website</strong>
    </div>
</t>

Edit (Report Preview)

You can add an extra parameter to the report URL (inside the report_pdf_preview.js file ?variable_name=) and alter the _render_template function to add a new report value based on the URL parameter then use it inside the template to hide text if the user uses the report preview.

Example:

class IrActionsReport(models.Model):
    _inherit = 'ir.actions.report'
    
    def _render_template(self, template, values=None):
        values['pdf_preview'] = request.params.get('pdf_preview')
        return super(IrActionsReport, self)._render_template(template, values=values)

You can hide an element like following:

<div t-if="not pdf_preview and website">
  From website
</div>
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda