Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How can we display data from another database?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
developmentdatabaseexternalintegrationpostgresql
4 Respostes
37469 Vistes
Avatar
Moin

We have integrated OpenERP with an external application (Java) which has its own database (Postgres). We want to create a frontend in OpenERP which gets its data from that database and commits any changes we make in OpenERP back to that database. We don't want to import that data in OpenERP database first since there are millions of records to handle and we don't want duplication or massive performance delays. How can this be implemented?

EDIT I essentially want to intercept the data source of the list view and form view to plug my own data in. From the console logs it seems like the search_read method is responsible for acquiring data that is finally displayed, is it possible to plug my own data in that method? Thank You.

3
Avatar
Descartar
Avatar
Mohammad Alhashash
Best Answer

If the external application uses integer primary keys, you can use PostgreSQL Foreign Data Wrapper (doc) to link the external data to the OpenERP database and create new models to access these tables.

You need to have PostgreSQL v9.1 or higher. There are FDWs for many databases and other data sources including PostgreSQL iteself, Oracle, MySQL.

Start by creating foreign tables in the OpenERP database mapped to the external tables/views. OpenERP meta data columns id, create_uid, create_date, write_uid, write_date are required, you can create these columns in a view based on other columns or as a static data and use that view as the model table.

Then, you should create OpenERP models for these tables just like normal models. Each model must have an attribute _table = '_Linked_Table_Name_' to have OpenERP using the linked table instead of creating new one.

Foreign tables are read-only. So, you have to override the create(), write() and unlink() methods to update the original table. Other OpenERP functionality like search should work directly.

If the external table does not have integer id, you may use integer hash function to map the primary key and all foreign keys in other tables to integers (should be 64bit to minimize hash collision probability).

3
Avatar
Descartar
Moin
Autor

Thanks for your answer, I looked into experimenting with FDW but I'm stuck as to how shall I go about 'installing' the pgsql_fdw library? There's no download file on the page you linked and google didn't yield any results either. What do I need to do to produce a simple example? Thank You.

Mohammad Alhashash

@Moin What is your operating system and postgresql version?

Moin
Autor

@Mohammad Ali Ubuntu 12.04, postgresql 9.1 and OpenERP 6.1

Avatar
Yohanes Iwan Sugiarto
Best Answer

Maybe you can create fields of type function in an object which will act like a proxy for the other database/external application you have. Just make sure your external database/app is accessible using Python. But this approach would make the fields read only.

If you want to allow changes to be made from OpenERP: Create object with stored fields (not function fields) which mirrors the external database field.

  • Override 'read' method to populate the mirroring fields by reading values from the external database.
  • Override 'write' method to allow changes from OpenERP frontend to be made to external database.

e.g:

def read(self, cr, uid, ids, fields=None, context=None):
    #Populate local fields with values from external database
    res = super(your_proxy_object, self).read(cr, uid, select, fields=fields, context=context)
    return res

def write(self, cr, uid, ids, vals, context=None):
    #Write changes to external database
    return super(your_proxy_object, self).write(cr, uid, ids, vals, context=context)
1
Avatar
Descartar
Moin
Autor

This makes perfect sense, I knew about the write method but wasn't aware of the read method. This is exactly what I was looking for, Thank you. Could you please answer the question at http://help.openerp.com/question/1040/how-does-the-orm-read-method-work-exactly/ regarding how to use the read metho

Yohanes Iwan Sugiarto

Sure, I just posted an answer about how the read ORM method work. Just a simple example but I hope it helps.

Avatar
Daniel Reis
Best Answer

There is a simple module to access data in foreign databases from OpenERP: base_external_dbsource in branch lp:openobject-extension. I have used it toaccess data from Oracle an SQL Server databases. It should be difficult to extend it to also add write features.

You can find more about in it's manifest.

1
Avatar
Descartar
René

Hello For testing I installed the module base_external_dbsource and created an externel data source. Connection to my external db is successful, but now I dont know how to use this connection in my custom module. Are there any informations how to use this connection and make the external data available in a module ? Can someone help? René

Avatar
René
Best Answer

Hello For testing I installed the module base_external_dbsource and created an externel data source. Connection to my external db is successful, but now I dont know how to use this connection in my custom module. Are there any informations how to use this connection and make the external data available in a module ? Can someone help? René

0
Avatar
Descartar
Dinesh

Hello René, did you find any solution for this question?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
How to integrate Microsoft SQL Server with Odoo? Solved
server database integration postgresql microsoft
Avatar
Avatar
Avatar
Avatar
5
d’ag. 24
27393
how to execute pgsql query in odoo to update a particular column from different table? Solved
development database postgresql query odoo8
Avatar
Avatar
1
d’abr. 15
14935
How to reset the development database Solved
development database
Avatar
Avatar
Avatar
2
d’ag. 25
3082
Database Migration
database postgresql
Avatar
Avatar
1
de jul. 23
6648
Integration from Rails
external integration
Avatar
Avatar
1
de jul. 17
6205
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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