- 场景阐述:
 
form表单自定义按钮,在编辑模式显示,在只读模式隐藏
- 效果:
 


这里的保存按钮是自定义按钮,在编辑状态的时候显示,非编辑状态下隐藏
- 解决方案:
 
如下所示,只需要在按钮中添加odoo自带class类oe_edit_only即可
            
            
              XML
              
              
            
          
          <header>
    <button type="object" name="save" class="btn btn-primary oe_edit_only" string="保存"/>
</header>