Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

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

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
pythonaccount.movebuttonqweb-reportodoo11
8 Réponses
4573 Vues
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
Ignorer
Avatar
Vishnu Vanneri
Meilleure réponse

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
Ignorer
Abdullah
Auteur

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
Auteur

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
Auteur

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
Meilleure réponse

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
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
How to live rtsp camera in Odoo
python odoo11
Avatar
Avatar
Avatar
2
juil. 24
15310
Odoo 11 : _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
python odoo11
Avatar
Avatar
1
juil. 21
9423
(Automated Action) Problem with write() and do for loop
python odoo11
Avatar
0
avr. 20
5835
how can i add multiple fields to invoice_vals['name_field'] =self.name_field(changing _prepare_invoice(self) in sale_order.py)? Résolu
python odoo11
Avatar
Avatar
1
mai 18
4153
Odoo11- Script: two classes in the same models.py
python odoo11
Avatar
0
avr. 18
4675
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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