Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
4804 Переглядів

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.

 

Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Автор

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)

Related Posts Відповіді Переглядів Дія
0
груд. 21
2507
2
лют. 19
9679
14
груд. 17
101368
0
вер. 17
2641
0
бер. 15
3700