Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Cervecería
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y soporte técnico
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Explorar todos los sectores
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Servicios para partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Printing different reports with a same button based on journal type.(odoo 11)

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
pythonaccount.movebuttonqweb-reportodoo11
8 Respuestas
4564 Vistas
Avatar
Abdullah

I have two reports for journal entries and i want to print a report based on the journal type. if journal type is bank then the report1 must print and if journal type is cash then report2 must print. kindly help me with the python code for implying this condition i have already made reports and button but struggling with the conditional statement. Thanks in advance  

0
Avatar
Descartar
Avatar
Vishnu Vanneri
Mejor respuesta

There will be 2 Report option available to print in Print menu if you added two reports in code.

So firstly hide this report from print option by clicking " Remove from the 'Print' menu " in report form.

Then You can add a button in journal entry form view and in button action we can define which report to be printed.

in View and PY  //

Code

2
Avatar
Descartar
Abdullah
Autor

thanks for replying. I do have two reports in the print menu but i want odoo to check if the journal type is "Bank" then after pressing print button it print report 1 and if journal type is "Cash" print report 2. How should i write for that?

Vishnu Vanneri

Yes i got your intuition that's why i said you can remove the 2 print option from print menu and you can add a button in form view . then in py we can check the journal type. Please check the code.

Abdullah
Autor

sir m really sorry as i am bothering you again but it is giving key error "report". kindly check my code. Actually my pasted code :D

class AccountMove(models.Model):

_inherit = 'account.move'

@api.multi

def print_journal_entry(self):

self.ensure_one()

if self.journal_id.type == 'bank':

return self.env['report'].get_action(self,'bi_print_journal_entries.bank_journal_entry_report_id')

elif self.journal_id.type == 'cash':

return self.env['report'].get_action(self, 'bi_print_journal_entries.journal_entry_report_id')

else:

pass

Vishnu Vanneri

No problem, actually that was my issue So sorry. I have used code for V12 , now i have updated the code please check it.

Abdullah
Autor

Hey man! you are a life saver. Thank you soo much :) it works 100%

Vishnu Vanneri

Glad You find your Solution. Have a Great Day dude!

Avatar
danainao@hotmail.com
Mejor respuesta

No problem, actually that was my issue So sorry. I have used code for V12 , now i have updated the code please check it.


0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
How to live rtsp camera in Odoo
python odoo11
Avatar
Avatar
Avatar
2
jul 24
15309
Odoo 11 : _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
python odoo11
Avatar
Avatar
1
jul 21
9417
(Automated Action) Problem with write() and do for loop
python odoo11
Avatar
0
abr 20
5822
how can i add multiple fields to invoice_vals['name_field'] =self.name_field(changing _prepare_invoice(self) in sale_order.py)? Resuelto
python odoo11
Avatar
Avatar
1
may 18
4143
Odoo11- Script: two classes in the same models.py
python odoo11
Avatar
0
abr 18
4669
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

Website made with

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