Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
journalsale.order1010.0
1 Beantwoorden
9602 Weergaven
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
Annuleer
Avatar
Ray Carnes
Beste antwoord

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
Annuleer
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.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Can not close POS session in Odoo 10 Opgelost
accounting pos journal 10 10.0
Avatar
Avatar
3
dec. 19
9977
How to retain logged in user privileges once sudo.create method executes in Odoo 10
10 10.0
Avatar
Avatar
1
okt. 19
7765
Hide journals, odoo 10 [SOLVED] Opgelost
journal hide 10.0
Avatar
Avatar
2
jun. 23
2802
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
jul. 19
5214
[10.0] Hide cost column in sale order Opgelost
views module sale.order 10.0
Avatar
Avatar
1
mrt. 19
4801
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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