我试图在产品表单中隐藏“补充”按钮,并使其对特定组可见 这是按钮的定义
<button string="Replenish" type="action"
name="%(action_product_replenish)d"
context="{'default_product_tmpl_id': id}"
groups="stock.group_stock_user"
attrs="{'invisible': [('type', '!=', 'product')]}"/>
我使用xbath添加更改组属性,如下所示
<xpath expr="//button[@name='%(action_product_replenish)d']" position="attributes">
<attribute name="groups">stock.group_stock_manager</attribute>
</xpath>
但是我得到了这个错误
raisevalueerror('在系统中找不到外部ID:%s'%xmlid) 亲爱的,我该怎么做
我认为你几乎是对的。请尝试在模块名称前加上前缀。例如,在
expr
中,使用//button[@name='%(<module_name>.action_product_replenish)d']
另外,正如@Dipen Shah所说,您可能希望使用
attributes
而不是replace
,因为后者将删除其他已定义的属性如果要添加特定的
group
,请使用以下attribute
打开按钮:或者,如果您
replace
该按钮,则必须重新声明该按钮,直到您无法替换出现错误为止。以下代码用于replace
:相关问题 更多 >
编程相关推荐