如何在Odoo 9中从儿童模型中获取父模型?

时间:2017-05-16 03:38:20

标签: listview model odoo-9

我正在创建一个自定义模块,用于在树视图中添加新行。

我正在尝试将父模型“project.project”的新行添加到树视图“project.task”

我到目前为止所做的是

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-extend="ListView">
        <t t-jquery="thead" t-operation="before">
            <t t-if="options.action.res_model=='project.task'">
                <button type="button" class="btn btn-sm btn-primary o_list_button_add" accesskey="C">
                    <!-- I'd like to add project.project's custom field below -->
                    <t t-esc="project.project.custom.field"/>
                </button>
            </t>
        </t>
    </t>
</templates>

我想在按钮名称中添加自定义字段。

请帮忙

1 个答案:

答案 0 :(得分:0)

你这样做了吗?

<!-- I'd like to add project.project's custom field below -->
<t t-esc="o.project.project.custom.field"/>