IntegrityError: null value in column "name" violates not-null constraint
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Dự án
- MRP
Câu hỏi này đã bị gắn cờ
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
Please read this:
IntegrityError: null value in column "name" violates not-null constraint
Please also search the forum before asking questions.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký
Where? When? Why? If you write some information it will be cool!!!