首页 文章

odoo 9如何将关系字段添加到数据透视图?

提问于
浏览
1

我正在自定义Project的数据透视图以显示时间表描述以及任务的名称 .

这是我的代码,但是当我点击数据透视图时,它会显示错误

<!-- Insert Project Issue Pivot Field -->
<record id="project_task_custom_pivot" model="ir.ui.view">
    <field name="name">project.task.custom.pivot</field>
    <field name="model">project.task</field>
    <field name="inherit_id" ref="project.view_project_task_pivot"/>
    <field name="arch" type="xml">
        <field name="stage_id" position="after">
            <field name="name" type="row"/>
            <field name="timesheet_ids" type="row"/>
        </field>
    </field>
</record>

错误如下

assert groupby_def and groupby_def._classic_write, "Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True"

Edit

我重新定义了@George Daramouskas提到的字段“timesheet_ids” .

timesheet_ids = fields.One2many('account.analytic.line', 'task_id', string="Timesheetss", store=True)

但它没有用 . 所以我看了Odoo Source中的源代码

函数“One2many”没有这样的参数 .

我猜Store = True仅适用于常规字段不相关的字段 .

还有其他解决方案吗?

谢谢

1 回答

  • 0

    使用构造函数中的属性 store=True 创建字段,以便将字段存储在数据库中 .

相关问题