Search code examples
odooopenerp-7

Hide to create a new record in many2one or many2many


I am working with res.partner object in customer form view in sale module category_id use many2many field in customer form view. Based on the user I have to hide the create new category record in ODOO or OpenERP.


Solution

  • It is possible using options attribute.
    Check this example:

    <record id="view_customer_form_inherit" model="ir.ui.view">
      <field name="name">view.customer.form.inherit</field>
      <field name="model">res.partner</field>
      <field name="inherit_id" ref="base.view_partner_form"/>
      <field name="arch" type="xml">
        <field name='category_id' position='attributes'>
          <attribute name='options'>
            {"no_create": 1, "no_create_edit": 1}
          </attribute>
        </field> 
      </field>
    </record>
    

    I know it is too late to answer but I hope it'll be helpful

    .