Search code examples
python-2.7odooodoo-8odoo-survey

Odoo : How to remove not null constraint from Odoo?


I have to remove not null constraint from odoo not in postgresql.

Eg:

time_table_lines_1 = fields.One2many(
        'gen.time.table.line', 'gen_time_table', 'Time Table Lines',
        domain=[('day', '=', '1')], required=True)

I want to remove required = True from Odoo Python.


Solution

  • Simply set required to False if you're extending an existing model

    or omit it entirely if you're building a custom model that doesn't extend any existing model.

    time_table_lines_1 = fields.One2many(
            'gen.time.table.line', 'gen_time_table', 'Time Table Lines',
            domain=[('day', '=', '1')], required=False)