在odoo 9中使用上下文

时间:2017-05-26 07:27:43

标签: openerp odoo-9

我有两种形式。首先,task_view.xml显示所有用户的所有任务。在打开一个用户之后,在第二种形式user_view.xml中添加 按钮

<button class="oe_inline oe_stat_button" style="float:right;" type="action" icon="fa-folder" name="%(task_view_form)d"
    context="{'??????}">
    <field string="total" name=total_qty" widget="statinfo" />
</button>

现在,当点击按钮时,我获得所有用户的所有任务,如何在点击按钮之后使用上下文或任何其他解决方案我只需要(过滤)该用户的任务。

我需要从表格放置按钮过滤project_task_user_id = id用户。

2 个答案:

答案 0 :(得分:2)

试试这个:

context="{'search_default_project_task_user_id ': active_id}"

答案 1 :(得分:1)

我认为要实现这一点,您需要将域添加到您的操作中:

my_list = []

def fun1():
    *do smth with my_list*

def fun2():
    *do smth with my_list too*