Reputation: 229
I want to add a tree view inside an forme view in odoo 10,but the result is no table here is the result :
and here is my model.py file an view.xml file :
Upvotes: 1
Views: 2094
Reputation: 14801
You can only display a list view with x2many
fields. A Many2one
field represents exactly zero or one record. There is no widget for showing such fields in a list.
If you want to show more data like name and unit price, you can override name_get()
and build up another representation of such a record like <name> (<unit_price>)
. You can use the context with some flags to only show this new name representation. The model res.partner
is doing something like that. On normal views you can only see the partner name, but for example in orders you will also see the whole address. It's done by using the context flag show_address
.
Another possibility is to write your own list widget for Many2one
fields. But that would be a lot of work ;-)
Upvotes: 1