问题
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.
回答1:
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>
回答2:
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:
Try to give access of only write, remove access of create for the related form object.
来源:https://stackoverflow.com/questions/39598670/how-to-remove-savenew-button-from-popup-in-odoo