【发布时间】:2019-09-30 07:44:55
【问题描述】:
我的工单有很多 cmets,我为我的评论创建了一个视图,并在工单模型中创建了一个 One2Many 字段。但它没有显示我想要的视图。这是我的模型
class Ticket(model.Model):
_name = 'Tickets'
comment_ids = fields.One2many('comments', 'comment_id')
这是我的第二个模型
class Comments(models.Model):
_name = 'comments'
comment = fields.Text(string="Comment")
comment_id = fields.Char(string='Comment Id')
这是我的票证视图:
<notebook>
<page name="body" string="Body">
<field name="comment_ids" />
</page>
</notebook>
这是我的评论表单视图:
<form>
<div class="form-group">
<label name="comment">Comment:</label>
<textarea class="form-control" rows="5" />
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
这是我的评论树视图:
<tree>
<field name = 'comment_id'/>
<field name = 'comment'/>
</tree>
【问题讨论】:
标签: forms view tree odoo one2many