Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 根据使用属性的条件隐藏按钮_Python_Xml_Odoo - Fatal编程技术网

Python 根据使用属性的条件隐藏按钮

Python 根据使用属性的条件隐藏按钮,python,xml,odoo,Python,Xml,Odoo,我试图用属性隐藏一个按钮,但它不起作用。这是我的密码: <button name="button_to_approve" states="draft" string="Request approval" type="object" class="oe_highlight" groups="my

我试图用属性隐藏一个按钮,但它不起作用。这是我的密码:

<button name="button_to_approve" states="draft"
                        string="Request approval" type="object"
                        class="oe_highlight"                            
                        groups="mygoups"
                        attrs="{'invisible': [('is_responsible', '=', False)]}">
                          <field name="is_responsible" invisible="1"/>    
                </button>
它没有给出错误消息,但工作不正常。

“属性”和“状态”不能在同一个按钮中。 从按钮中删除“states”,并将其用作按钮功能的条件(在python文件中)

is_responsible = fields.Boolean('Is current user', compute='_compute_is_member')

@api.multi
def _compute_is_member(self):
    self.ensure_one
    if self.env.uid == self.assigned_to_responsible_affected_to.id:
        self.is_responsible = True
    else:
        self.is_responsible = False