How to remove “save&new” button from popup in odoo

2019-07-28 02:30发布

I have a one2many field, and when I click to create a new record, I have 2 buttons.

I want to remove the "Save & New" button and keep the "Save & Close" button.

enter image description here

3条回答
混吃等死
2楼-- · 2019-07-28 03:00

I know there's an option disable_multiple_selection that you can turn on/off to show/hide that button. I don't know if it's usable within a XML definition of a view/form/field but if this is not the case you could try to do it via JS.

This is the place https://github.com/OCA/OCB/blob/9.0/addons/web/static/src/js/views/form_common.js#L854

查看更多
老娘就宠你
3楼-- · 2019-07-28 03:04

Try to give access of only write, remove access of create for the related form object.

查看更多
Rolldiameter
4楼-- · 2019-07-28 03:09

I hope you do not mind sleazy hacks.

In your form view you can try this. You may need to clear your cache before it works for you. This is only sensible if you do not want it to appear but its not really a security thing just for looks and process. You may need to ensure the class selector is correct for your version.

I tested this by placing it in the xml for the form view that appears, not in the xml for the form view that you are adding a new one2many record within. So to be clear this css needs to be in the form view that pops up and contains the "Save & New" button.

<style>
     .oe_abstractformpopup-form-save-new {
          display:none !important;
     }
</style>
查看更多
登录 后发表回答