3

默认情况下,当您单击 Odoo 中的树视图项(在其他文档的表单中)时,它将以弹出窗口的形式打开链接的文档,而不是导航到文档,替换“当前”窗口的内容(即预期的行为)。

我想将您可以使用操作窗口执行的操作(即设置目标:当前)复制到我的表单内的树列表中,以便当我单击列表中的任何相关记录时,我可以导航到相关的记录占用整个当前窗口。可以做到吗?

谢谢。

4

2 回答 2

2

I am not sure if there is a better way to accomplish your goal. I too have shared your pain. To get around it I create a function on the destination model and add a button to the list view to activate it. All the function does is execute a window action opening the record as you have described.

@api.multi
def open_rec(self):
    return {
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'addon.model',
            'res_id': self.id,
            'type': 'ir.actions.act_window',
            'target': 'current',
            'flags': {'form': {'action_buttons': True}}

    }

And wherever your list view is declared you can add something like this.

<tree>
    <field name="field1"/>
    <field name="field1"/>
    <field name="field1"/>
    <button name="open_rec" string="Open" type="object"/>
</tree>
于 2016-10-21T03:30:14.993 回答
-1

安装此模块https://www.odoo.com/apps/modules/8.0/web_tree_many2one_clickable/

然后将小部件“many2one_clickable”添加到树视图中的必填字段

例如:

<field name="partner_id" widget="many2one_clickable" />
于 2017-05-05T21:57:10.520 回答