Skip to Content
Menu
This question has been flagged
2 Replies
7547 Views

IntegrityError: null value in column "name" violates not-null constraint

Avatar
Discard

Where? When? Why? If you write some information it will be cool!!!

Best Answer

I know this is late for your question, but on odoo 15 i just met exactly this issue, and If you or some one else meet this issue, here is how you can deal with it:

If you met this issue when coding with wizard (popup), you can try this:

This issue is because you missing "name" column, to solve this, you need to set value for "name" column.

In below example, i've try to set value for "name" column by onchange function, and it's worked for me, the issue is gone.

But you can try other way to set value for "name" column. Best Wishes.

# declare "your_column" column so we can use it to call onchange, without this, onchange function won't be called
your_column = fields.Binary(string="Your Column")

@api.onchange('your_column')
def your_column_onchange(self):
for wizard in self:
wizard.name = False
# set "name" to this wizard model, to prevent this issue:
# null value in column "name" violates not-null constraint
if wizard.your_column:
wizard.name = wizard.your_column
Avatar
Discard
Best Answer

Please read this:

IntegrityError: null value in column "name" violates not-null constraint

Please also search the forum before asking questions.

Avatar
Discard