Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3154 Lượt xem

Hello,

I would like to ask for an advice about many2one fields please.

I created a model called 'mymodel' which is connected to 'project.issue' like this:

class project_issue_mymodel(models.Model):
_inherit = 'project.issue'
mymodel_id = fields.Many2one('mymodel',string='mymodel data', ondelete='cascade')

When I want to use 'mymodel_id' field in a view it works just fine when I add this into the xml file:

<field name="mymodel_id" />

Then 'name' of that record is displayed there.

But when I want to customize this further and display some more fields from the connected 'mymodel' record nothing more is displayed there. Basically everything inside <field name="mymodel_id">...</field> is ignored.I haven't found any way to display fields from my connected 'mymodel' record. This is my source code:

#mymodel.py file

class mymodel(models.Model):
_name = 'mymodel'
testfield1 = fields.Char()
testfield2 = fields.Char()

#project.issue view

<field name="mymodel_id">
<form>
<field name="id" />
<field name="testfield1" />
<field name="testfield2" />
</form>
</field>

Would you please give me some advice about this? Is this even possible?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 21
3974
5
thg 8 24
46672
0
thg 5 24
46
2
thg 4 24
2568
3
thg 6 23
5821