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
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • 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

Tutorial that explains interaction with the OpenERP ORM?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
modulesorm
2 Antwoorden
11532 Weergaven
Avatar
P Mittal

I am in process of writing OpenERP modules and want to learn how:

(1) To be able to create model objects

(2) Store data or records in them via an API.

(3) Query them to retrieve data. (Just like we do in Django Models using the Queryset API)

Where can I get a good tutorial that explains the above 3 cases with all the available methods? Also, I want to interact with the ORM with the help of easy to use Python API's without using XML-RPC's as much as possible.

1
Avatar
Annuleer
Avatar
patrick
Beste antwoord

Regarding (1): when you do a search for 'openerp create module', there are various sites (including youtube) which show and help you to create a new module. Although many of them say it is for V6 or V6.1, it also works for V7.

Regarding (2): What do you mean by this question?

Regarding (3): within the module, you can use API-like things like

model_id = model.search([('fieldname', '=', some_value')])

if there is no result, model_id will be [], otherwise [<id>]

It is not clear to me what you mean by the last sentence, but I think you want to use the openERP ORM, from script(s), without logging in into openERP. In that case, I use openerplib, a module you can install 'openerplib'. This allows you to hide the XML-RPC like code, to get some nicer looking code. Next week I can post how to install this library and an example, how to make a script using this library.

#openerplib I use Ubuntu, so if you are using Windows, change the commands to Windows commands.

To install openerplib, you need to download and install setup_tools:

wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sudo ./setuptools-0.6c11-py2.7.egg

now you can openerplib:

sudo easy_install openerp-client-lib

usage of openerplib in a script

import openerplib
h = 'localhost'
db = 'myDB'
u = 'admin'
pw = 'verySecurePassword!'

connection = openerplib.get_connection(
    hostname=h, database=db, login=u, password=p)

#now you have a connection to the DB and can you do some things
#first get an object of your model
user_obj = connection.get_model('res.model')
# use this object to execute some action, in this case, search for user(s)
# with John in the name, but also Johnny....
user_id = user_obj.search([('name', 'in', 'John')])
if user_id == []:
    print 'No user found who has John in his name'
else:
    #now read all the users whose IDs are in user_id
    users = user_bj.read(user_id)
    print 'There are %s user(s) with John in the name' %(len(user_id)
    for u in users:
        print 'User %s has userID %s' %(u['name'], u['id'])

#close the connection nicely
connection.close()
2
Avatar
Annuleer
P Mittal
Auteur

(2) I want to load a model (table) with data retrieved dynamically from an external application API. The idea is to be able to interact with the external API from within OpenERP, synchronize OpenERP model data with the API data, (when a new record is created via Openerp action, a resource is added for the same via a PUT or POST request to the external API too, and vice versa)

P Mittal
Auteur

Perhaps (2) needs to be framed into a new question. The openerplib thing sounds exiting. Can you give me a link to it; get lots of stuff when I search?

Avatar
Borni DHIFI
Beste antwoord

Hi,

you can start with Developer Memento OpenERP for Open Source RAD with OpenERP 7.0 and good start with ORM.

1
Avatar
Annuleer
P Mittal
Auteur

Yes, got it a day back. I got a link on one of your other answers on a question asking about Module development. This doc is perhaps the best I have see so far. Thanks, (On a sidenote, I still think there needs to be more documentation to explain module development in detail and with different examples)

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
What does OSV mean in OpenERP modules?
modules orm osv
Avatar
Avatar
Avatar
Avatar
3
jan. 20
38965
Nuevo menú en "CRM"
modules
Avatar
Avatar
Avatar
Avatar
3
jul. 25
2766
Allow Access to update module
modules
Avatar
Avatar
Avatar
Avatar
3
mei 25
4640
How to translate actual name of module listed in apps Opgelost
modules
Avatar
Avatar
Avatar
2
jun. 25
5173
Extend Odoo Quotes
modules
Avatar
0
jun. 21
3108
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