odoo hides Many2many's "New" and One2many's "Save and New" buttons to hide

  • For Many2many, open the new form view and hide the "New" button,

Insert picture description here
The effect after hiding
Insert picture description here
Add the field in xml

<field name="production_line_ids"
 options="{
     
     'no_create': True}"/>

# options="{'no_create': True}"

Add options="{'no_create': True}" to hide it

  • For One2many, open the new form view and hide the "Save and New" button. The
    Save and create button
    hidden effect
    Insert picture description here
    is added in the scss file
.modal-footer .btn-primary:nth-of-type(2) {
    
    
  display: None;
}

Import scss file

        <template id="production_front" name="production settings" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <link rel="stylesheet" type="text/scss" href="/production/static/src/scss/production_style.scss"/>
            </xpath>
        </template>

After adding, the One2many "Save and New" button of the entire system is hidden

Guess you like

Origin blog.csdn.net/weixin_42464956/article/details/108360950