Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

Why is my custom invoice report only being printed in the draft state and not in invoice state?

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
qwebinvoicesprintingreportsodoo8.0
2 Respostas
11277 Visualizações
Avatar
Yenthe Van Ginneken (Mainframe Monkey)

Hi everybody

I've set up a second report for invoices. I want an alternative report option in the print dropdown so I created a second report in the account module.

I've added a report in account_report.xml under /addons/account/ like this:

        <report 
            id="account_invoices"
            model="account.invoice"
            string="Invoices"
            report_type="qweb-pdf"
            name="account.report_invoice"
            file="account.report_invoice"
            attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
        />

    <!--Custom report link->
        <report 
            id="account_aangetekend"
            model="account.invoice"
            string="Aangetekende zending"
            report_type="qweb-pdf"
            name="account.report_aangetekend"
            file="account.report_aangetekend"
        />

Then I added an XML file, named report_aangetekend.xml with 95% the same code as the 'normal' report (coming from report_invoice.xml). I've only changed the names and added one field.

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_aangetekend_document">
    <t t-call="report.external_layout">
        <div class="page">
            <div class="row">
                <div class="col-xs-5 col-xs-offset-7">
                    <address t-field="o.partner_id"
                        t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' />
                    <span t-field="o.partner_id.vat"/>
                </div>
            </div>
<p>TEST</p>
<!--Lots of other, irrelevant code here-->
</div>
</t>
</template>

<template id="report_aangetekend">
    <t t-call="report.html_container">
        <t t-foreach="doc_ids" t-as="doc_id">
            <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'account.report_aangetekend_document')"/>
        </t>
    </t>
</template>
</data>
</openerp>

The report works, is showing up and I can print it. There is however a strange effect.
If I now create a new invoice (in draft modus) and choose the two different print options I'll get two different report prints, so far so good, as you can see here.


If I now make a second invoice, validate this and then print out the two different reports I'll get the same report twice. Both coming from the file report_invoice.xml (addons/account/views/). As you can see here:


Is there a reason why my custom report is not being printed in validated state but it is in draft? Do I have to define something more elsewhere or what am I missing?

With kind regards
Yenthe
 

0
Avatar
Cancelar
Avatar
Zbik
Melhor resposta

Probably your report is printed from an attachment in both cases. If standard invoice state is ('open','paid') the attachment is generated, in state 'draft' no attachment.

0
Avatar
Cancelar
Yenthe Van Ginneken (Mainframe Monkey)
Autor

@zbik that is correct, at the moment I have both set to attachment_use="True" but even if I only set one or none I still don't get the wished result. Could you give me some more details about what is wrong/how to fix it?

Zbik

Do you have removed the old attachment? In my opinion, if attachment_use="False", should work.

Zbik

My solution: https://www.odoo.com/forum/help-1/question/how-we-inherit-invoice-report-to-change-the-attachment-attribute-on-odoo-v8-69628

Yenthe Van Ginneken (Mainframe Monkey)
Autor

@zbik even if I set both attachment_use="False" there is no difference. When the invoice is validated both versions will print the original sadly. Any more ideas / solutions?

Zbik

Erase attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')". Your code xml (deleted all attachment lines) normally working on my tmp system. I think this is an Odoo error with attachment_use="False", if attachment='xxx' not empty.

Avatar
Yenthe Van Ginneken (Mainframe Monkey)
Autor Melhor resposta

I've found the solution and it was very simple. I just had to set both records to attachment_use="True" and had to give them both a different name.
I have no idea why the two different names fixed it though. Those two files are added as an attachment and that seems to do the trick.

Final code:

        <report 
            id="account_invoices"
            model="account.invoice"
            string="Invoices"
            report_type="qweb-pdf"
            name="account.report_invoice"
        attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
            file="account.report_invoice"
        />

    <!--Custom-->
        <report 
            id="account_aangetekend"
            model="account.invoice"
            string="Aangetekende zending"
            report_type="qweb-pdf"
            name="account.report_aangetekend"
            attachment_use="True"
           <!--This one has to have a different name then the other one. The magic happens here.-->
            attachment="(object.state in ('open','paid')) and ('INV2'+(object.number or '').replace('/','')+'.pdf')"
            file="account.report_aangetekend"
        />

If you don't want any files attached under attachments there is a second solution:

        <report 
            id="account_invoices"
            model="account.invoice"
            string="Invoices"
            report_type="qweb-pdf"
            name="account.report_invoice"
        attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
            file="account.report_invoice"
        />

    <!--Custom-->
        <report 
            id="account_aangetekend"
            model="account.invoice"
            string="Aangetekende zending"
            report_type="qweb-pdf"
            name="account.report_aangetekend"
           <!--No attachment -->
            attachment_use="False"
            file="account.report_aangetekend"
        />

0
Avatar
Cancelar
Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
How to create div in QWeb that is always at the bottom of the page? Resolvido
qweb reports odoo8.0
Avatar
Avatar
Avatar
Avatar
Avatar
14
mai. 22
48323
Background image gets cut off on the last page of a QWeb report (Odoo8) Resolvido
qweb reports odoo8.0
Avatar
1
fev. 24
6039
Printing multiple reports in one method?
qweb printing reports buttons methods
Avatar
Avatar
Avatar
Avatar
Avatar
4
nov. 22
12201
[SOLVED] Error to generate a qweb-pdf (odoo 8) Resolvido
pdf qweb reports wkhtmltopdf odoo8.0
Avatar
Avatar
1
mar. 15
13918
Directly printing to printer
printing reports
Avatar
Avatar
Avatar
2
mai. 25
3473
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now