Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
11106 มุมมอง

Hi,

I created a view from pgadmin, and now I want to display its as tree type of view.  How can I do it?

Do I need to create a class for that view?  

for example:

CREATE VIEW AS book.trans .....


on book.py

class BookTrans(models.Model):

    _name = "book.trans"

    _columns = {

   <!-- I put exacts field as view book.trans created from pgadmin ?? -->

    }


I tried that and use field model="book.trans" on Odoo view xml code but nothing shown (not showing any error also on the screen)....any thing I missed?


Thank you community

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Well, views can be updatable (see https://www.postgresql.org/docs/9.3/static/sql-createview.html)  and I suppose ORM can even work with them as with regular 'Model'.

Odoo's view objects have got a 'model' field so python class should be created.

I think you need to review class Model to ensure your view has got all columns this class requires such as, id, write_uid, create_date, maybe tree view doesn't work without them.

Do you think how to install/uninstall your module? During installation new table not a view is created.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

http://odoo-development.readthedocs.io/en/latest/dev/py/postgres-views.html

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

HI, you can follow following tutorial for this:

https://youtu.be/kwkddYoFQCE

Hope it helps,

Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ค. 17
4360
2
ม.ค. 17
2969
1
ก.พ. 16
3760
0
พ.ย. 15
3223
2
พ.ค. 24
5615