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

[Odoo 10] How to create a journal through code (custom module)?

S'inscrire

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

Cette question a été signalée
journalsale.order1010.0
1 Répondre
9616 Vues
Avatar
Mark DC

I want my customers to have a specific payment option when they install my custom module, I've looked everywhere for examples to add a journal / payment option through code and can only find people adding it through the GUI, which is a no-go for me.


Are there any examples out there or a hidden guide? I've been stuck for days on this issue.


Cheers.  

0
Avatar
Ignorer
Avatar
Ray Carnes
Meilleure réponse

A journal is just like any other Odoo model or class.

You can create an instance of a model (record in a class/table) three ways in your own module:

  • Via code

  • Via XML

  • Via CSV


Each option does exactly the same thing - create  a record in the database.  No matter how it gets there, the result is the same (even when added via the UI).


Code:

vals = {
'name': 'The Name',
'code': 'THECODE',
...
}

self.env[account.journal].create(vals)

More at https://www.odoo.com/documentation/10.0/reference/orm.html#common-orm-methods


XML:

Supply an XML file that imports a record into the database:

<odoo>
    <data>
   
 
<record id="your_id" model="account.journal"> <field name="name">The Name</field>
<field name="code">THECODE</field>
...
</record>
 
</data> </odoo>

More at https://www.odoo.com/documentation/10.0/reference/data.html


CSV:

Supply a file called 'account.journal.csv' in your module with the fields and values you want to import.  You can export an existing Journal to see the schema for the CSV file:

"id", "name", "code", "company_id/id", ...
"your_id", "The Name", "THECODE", "base.main_company", ...

More at https://www.odoo.com/documentation/10.0/reference/data.html#csv-data-files


Note: Since a Journal also requires a sequence, you should also create one of those, before creating the Journal, so the Journal can refer to it.



3
Avatar
Ignorer
Ermin Trevisan

What a beautiful answer!

Akash Raval

How do I create same journal for all companies in Database ? There can be any number of companies in Database for eg. there can be 1 or 2 or 4 companies depending on database so I want to create same journal for all companies available in Database.

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é
Can not close POS session in Odoo 10 Résolu
accounting pos journal 10 10.0
Avatar
Avatar
3
déc. 19
9986
How to retain logged in user privileges once sudo.create method executes in Odoo 10
10 10.0
Avatar
Avatar
1
oct. 19
7770
Hide journals, odoo 10 [SOLVED] Résolu
journal hide 10.0
Avatar
Avatar
2
juin 23
2813
how to raise multiple invoice against that SO (percentage wise or amount wise) without down payment lines
invoice sale.order 10 version10
Avatar
Avatar
Avatar
3
juil. 19
5220
[10.0] Hide cost column in sale order Résolu
views module sale.order 10.0
Avatar
Avatar
1
mars 19
4807
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