python - 一次使用 openerp one2many 列表中的表单和 TreeView

标签 python xml openerp

我有一个小问题。我目前正在使用的一个模块要求我插入一组字段和一个 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/

相关文章:

python - 如何正确使用 fout 函数写入输出?

python - 如何使用 NumPy (Python) 截断矩阵

java - 修改特定节点的XML文件

python - 我如何使用 python 打开远程服务器文件夹?

centos - 我应该在我的 CentOs 设备上哪里安装 Odoo erp?

Openerp 用户菜单

python - 如何确定 CSV 文件的编码?

python - 如何在 Python 中捕获 EINTR?

将 .CSV 文件转换为 .XML 的 PHP 脚本

java - 使用 JAXB 将具有不同架构的 XML 映射到相同的类