odoo 按钮不可点击功能

在一个需求里,要把一个按钮做成不可点击的状态
类似以下效果
在这里插入图片描述
此三个按钮不可点击,只是来表示某些情况
代码如下:

 <button string="技术通过" name="action_none" class="oe_highlight"
         type="object" style="background-color: #e7e7e7; color: black;pointer-events: none;" attrs="{
     
     'invisible': [('technical_pass','=', False),('state', '!=', 'reviewed')]}"/>
<button string="生产通过" name="action_none" class="oe_highlight"
        type="object" style="background-color: #e7e7e7; color: black;pointer-events: none;" attrs="{
     
     'invisible': [('production_pass','=', False),('state', '!=', 'reviewed')]}"/>
<button string="质检通过" name="action_none" class="oe_highlight"
        type="object" style="background-color: #e7e7e7; color: black;pointer-events: none;" attrs="{
     
     'invisible': [('quality_pass','=', False),('state', '!=', 'reviewed')]}"/>

    def action_none(self):
        """按钮必须执行方法,不然报错,写次方法"""
        return None

主要是在按钮里面加了 style=“pointer-events: none;”, css不可点击,样式是有
style=“background-color: #e7e7e7; color: black;pointer-events: none;”
故有次上面的样式以及功能

猜你喜欢

转载自blog.csdn.net/weixin_42464956/article/details/110244905