跳至内容
菜单
此问题已终结
1 回复
4377 查看

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
1975
2
2月 19
9136
14
12月 17
100589
0
9月 17
2294
0
3月 15
3132