跳至內容
選單
此問題已被標幟
1 回覆
4397 瀏覽次數

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)

相關帖文 回覆 瀏覽次數 活動
0
12月 21
1980
2
2月 19
9168
14
12月 17
100612
0
9月 17
2305
0
3月 15
3155