如何隐藏弹出窗体上的保存按钮?
How to hide save button on popup form?
如何隐藏弹出窗体的保存按钮?*
python 代码中的操作打开的表单视图。
我已经尝试了一些推荐的解决方案,但它们不起作用。
一些portal/forum说这个flags会解决它。但它没有,更重要的是,它对行为没有任何影响。 (无论如何,我在哪里可以从标志中读取?我找不到任何有用的描述。)
@api.multi
def button(self):
viewId = self.env.ref('Model.model').id
return {
'name': _('Button action'),
'view_type': 'form',
'view_mode': 'form',
'view_id': viewId,
'res_model': 'model',
'type': 'ir.actions.act_window',
'res_id': self.id,
'target': 'new',
'flags': {'form': {'action_buttons': False}}
}
最多的地方说这个方法对,但是不行...
<record id="model" model="ir.ui.view">
<field name="name">model</field>
<field name="model">model</field>
<field name="arch" type="xml">
<form string="Button form" edit="false" create="false" delete="false">
<group>
<field name="test" />
<button name="myButtonFunc" string="Demo button" icon="fa-plus" type="object"/>
</group>
</form>
</field>
</record>
有什么想法吗?或者体验过?
要隐藏向导的默认按钮,您需要替换向导的页脚。请参阅以下 view.xml
的示例
<record id="test_models_wizard" model="ir.ui.view">
<field name="name">test.models.form</field>
<field name="model">test.models</field>
<field name="arch" type="xml">
<form string="Test Wizard">
<group>
<group>
<field name="test_field_1"/>
<field name="test_field_2"/>
</group>
</group>
<footer>
<button name="your_test_method" string="My Button" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
在页脚标记之间添加您想要的按钮!
要完成最后一个答案,如果您需要一个简单的 "CLOSE" 按钮:
<button data-dismiss="modal" string="Close"/>
如何隐藏弹出窗体的保存按钮?*
python 代码中的操作打开的表单视图。 我已经尝试了一些推荐的解决方案,但它们不起作用。
一些portal/forum说这个flags会解决它。但它没有,更重要的是,它对行为没有任何影响。 (无论如何,我在哪里可以从标志中读取?我找不到任何有用的描述。)
@api.multi
def button(self):
viewId = self.env.ref('Model.model').id
return {
'name': _('Button action'),
'view_type': 'form',
'view_mode': 'form',
'view_id': viewId,
'res_model': 'model',
'type': 'ir.actions.act_window',
'res_id': self.id,
'target': 'new',
'flags': {'form': {'action_buttons': False}}
}
最多的地方说这个方法对,但是不行...
<record id="model" model="ir.ui.view">
<field name="name">model</field>
<field name="model">model</field>
<field name="arch" type="xml">
<form string="Button form" edit="false" create="false" delete="false">
<group>
<field name="test" />
<button name="myButtonFunc" string="Demo button" icon="fa-plus" type="object"/>
</group>
</form>
</field>
</record>
有什么想法吗?或者体验过?
要隐藏向导的默认按钮,您需要替换向导的页脚。请参阅以下 view.xml
的示例<record id="test_models_wizard" model="ir.ui.view">
<field name="name">test.models.form</field>
<field name="model">test.models</field>
<field name="arch" type="xml">
<form string="Test Wizard">
<group>
<group>
<field name="test_field_1"/>
<field name="test_field_2"/>
</group>
</group>
<footer>
<button name="your_test_method" string="My Button" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
在页脚标记之间添加您想要的按钮!
要完成最后一个答案,如果您需要一个简单的 "CLOSE" 按钮:
<button data-dismiss="modal" string="Close"/>