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

标签 python treeview openerp openerp-7 odoo

我这里有个情况。我正在使用 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/

相关文章:

html - 为什么标记中跨度的 dom TreeView 损坏?

c# - 将分层 xml 绑定(bind)到 TreeView

c# - 是否可以向树节点添加值?

python - 通过 Java 网关链接 Netlogo 和 Python

Python mysql 连接器加载语句在错误的目录 Windows 中搜索

python - 从 Ensembl 生成错误的脚本 REST API

python - 从 odoo 中备份 Odoo 数据库

python - 如何将 Odoo 中的菜单链接到计算的 URL

python - 字段 email_from 中的 odoo 电子邮件模板中的 "|safe"是什么

python - 以编程方式生成 requirements.txt 文件