Search code examples
pythonpostgresqlodooodoo-13notnull

Odoo13-CE: Error message: Table 'crm_lead': unable to set NOT NULL on column 'partner_id'


When I update the modules I get this error message:
Table 'crm_lead': unable to set NOT NULL on column 'partner_id'

What should I do to prevent it?


Solution

  • There probably has changed something on the field partner_id on model crm.lead regarding required parameter. But you already have some data in database without fulfilling the NOT NULL constraint resulting from that change.

    So you either try to fix the database table crm_lead by setting all partner_ids or you remove the required=True on that field.

    IIRC there is no required or NOT NULL on crm.lead's partner_id field in Odoo vanilla/default code. So you probably have custom modules changing that.

    The "Error" itself is only a warning. In the end Odoo can't set that constraint in database, but will work anyway.