我想在Form View中的Action中添加一个按钮。我不想为其创建单独的向导。crm.lead
是我的模型。
Python代码
def create_booking(self):
print "hello_from_booking"
print "hello_from_booking"
print "hello_from_booking"
XML
<record id="create_booking_form" model="ir.ui.view">
<field name="name">create_booking</field>
<field name="model">crm.lead</field>
<field name="arch" type="xml">
<form string="Create Booking">
</form>
</field>
</record>
<record id="action_view_create_booking" model="ir.actions.act_window">
<field name="name">Create Booking</field>
<field name="res_model">crm.lead</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="create_booking_form"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="action_create_booking">
<field name="name">Create Booking</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_view_create_booking'))" />
<field name="key">action</field>
<field name="model">crm.lead</field>
</record>
预先感谢...
答案 0 :(得分:1)
您可以使用ir.actions.server而不是ir.actions.act_window来直接从“创建预订”操作中运行自定义操作代码