gpt4 book ai didi

python - 奥杜/OpenERP : hiding create button from treeview

转载 作者:太空狗 更新时间:2023-10-29 20:28:24 26 4
gpt4 key购买 nike

我这里有个情况。我正在使用 OpenERP 7。我试图从我的产品 TreeView 中隐藏创建按钮。这可以使用

<tree create="false" .....

但情况是这样的。当用户直接从“ Assets 管理”模块打开 TreeView 时,我想保留它。但是当我点击 Reporting for treeview 时隐藏它。

我尝试在报告按钮的功能中使用这样的上下文:

context['prod1']='false'
ctx = dict(context)
print ctx['prod1']

return {
'type': 'ir.actions.act_window',
'res_model': 'product.product',
'view_type': 'form',
'view_mode': 'tree,form',
'target': 'current',
'context':ctx,
'create':False,
'domain':[('id','in',domain)]
}

我以 TreeView 形式做了:

<tree create="context.get('prod1',False)"

但是我得到了这个 json 相关的错误:

ERROR : SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

这些东西适用于我的按钮,但不适用于我的 TreeView 。我也尝试添加 'create':False 作为返回,但无法做我想做的事。我错过了什么?

最佳答案

您访问的 View 是相同的还是不同的?

如果它们不同,我认为实现您的要求的正确方法是用

覆盖相关 View

create="false"

您提到的属性(property)。

来自技术纪念品:

View Inheritance

Existing views should be modifying through inherited views, never directly. An inherited view references its parent view using the inherit_id field, and may add or modify existing elements in the view by referencing them through XPath expressions, and specifying the appropriate position.

希望这对您有所帮助。

关于python - 奥杜/OpenERP : hiding create button from treeview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25379647/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com