我有一个小问题。我目前正在使用的一个模块要求我插入一组字段和一个 TreeView ,当数据输入到表单时 TreeView 会更新。
<field name="lines" widget="one2many_list" colspan="4" nolabel="1">
<tree>
<field name="product_id"/>
<field name="product_qty"/>
</tree>
<form>
<field name="product_id"/>
<field name="product_qty"/>
</form>
</field>
上面是我的一个片段,是否可以在同一页面中将上面的表单 View 和 TreeView 渲染在一起。
举个例子
==============
表单域
TreeView
因此,无需单击新记录图标,我就可以将记录添加到 TreeView 并从上面显示的表单中保存它们。
请指教。
谢谢!
最佳答案
在 TreeView 中有一个名为“可编辑”的属性。您可以使用 editable='top' 或 editable='bottom'
<field name="lines" widget="one2many_list" colspan="4" nolabel="1">
<tree editable='bottom'>
<field name="product_id"/>
<field name="product_qty"/>
</tree>
<form>
<field name="product_id"/>
<field name="product_qty"/>
</form>
</field>
关于python - 一次使用 openerp one2many 列表中的表单和 TreeView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7671298/