跳至內容
選單
此問題已被標幟
1 回覆
11182 瀏覽次數

Hii!!!!!

Can anyone help me know how to insert the button 'Save & Close' in a popup.

Thanks a lot in advance.

Best regards.    

頭像
捨棄
最佳答案

hi, see this code

@api.multi 
def action_save(self):     #your code     self.ensure_one()     #close popup     return {'type': 'ir.actions.act_window_close'}
<odoo>
<record id="darkroom_modal_view_form" model="ir.ui.view">
<field name="name">Darkroom Modal Wizard</field>
<field name="model">darkroom.modal</field>
<field name="arch" type="xml">
<form string="Darkroom Modal">
<header />
<sheet>
<group name="data">
<field name="image" widget="darkroom" nolabel="1"/>
</group>
</sheet>
<footer>
<button special="cancel" string="Cancel" class="pull-left"/>
<button name="action_save" type="object" string="Save" class="oe_highlight pull-right"/>
</footer>
</form>
</field>
</record>
</odoo>
if you want just a classic save button instead 'action_save' use 'write' and your python code will be approximately:
class Meeting(models.Model):

  .....
     @api.multi
     def write(self, values):
         return super(Meeting, self).write(values)
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
5月 21
9070
2
8月 16
5340
gantt-popover 已解決
2
9月 21
4054
0
8月 17
5016
2
8月 25
3464