Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4566 Visualizzazioni

Hi, im new to odoo kindly help me thanks.

my scenario:

I have created a working module name 'shipping info' in the odoo, 

class SI(orm.Model):

_name: 'SI'

_column: {

'Shipaddr':fields.char('Shipping Address',size(100)),

}

I have also create a database and table in postgresql, i also install pgAdmin3 so it will be easy for me to monitor records in the database because it has gui. 

databasename is 'sirecord'

table name is 'sirecordtable'

table consists of fields 'address' which has datatype of char which has size of(100)

im wondering (is it possible?) how can i transfer the input data in the shipping info in odoo to my postgresql database

for example i put record of 'my address123' into the field in my module and then i save it, how will the postgresql catch this. thanks.

 

Avatar
Abbandona
Risposta migliore

Lakay, there are a couple of ways to achieve what you required.  One way is to create sirecordtable within the OpenERP and update it there when SI model is created.  Second is to use database trigger.

Avatar
Abbandona
Autore

Hi john doe, thank you but can you more further elaborate that?

Lakay, you can read about PostgreSQL's Trigger from this link: http://www.postgresql.org/docs/9.2/static/plpgsql-trigger.html. As for creation sirecordtable within OpenERP, you just need create a new model. If you already have that table, you can only do this if all the fields are compatible with OpenERP's fields. In the existing table, add a column called id (must be named such) which is a serial column which will became the Primary Key. Then create a .py file that hold the class for this model and list out all fields in _columns. To prevent OpenERP to create the same table, set the _auto = False. If the table is in another database, you can use PostgreSQL's dblink (http://www.postgresql.org/docs/9.2/static/dblink.html)

Post correlati Risposte Visualizzazioni Attività
0
dic 21
2254
2
feb 19
9329
14
dic 17
100892
0
set 17
2439
0
mar 15
3333