列 "center_id" 中的空值违反了非空约束 (Odoo)



当我想在odoo中插入一个人到项目中时,为什么我会得到这个错误消息?

ERROR odoo.sql_db: bad query: b'INSERT INTO "project_profile_rel" ("id", "no_counter", "state", "locked", "note", "profile_id", "p_id", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('project_profile_rel_id_seq'), 0, 'new', false, '', 1057312, NULL, 1, 1, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id'
ERROR: null value in column "project_id" violates not-null constraint
DETAIL:  Failing row contains (173192916, null, 1057312, null, f, null, new, null, 1, 2022-04-10 12:03:46.078911, 1, 2022-04-10 12:03:46.078911, , null, 0, null, null, null, null).

你得到了错误,因为项目(p_id)是空的,它不应该是空的,因为profile_idp_id不应该是空的表project_profile_rel

检查insert:

p_id的值
INSERT INTO "project_profile_rel" ("id", "no_counter", "state", "locked", "note", "profile_id", "p_id", "create_uid", "write_uid", "create_date", "write_date")
                            VALUES(nextval('project_profile_rel_id_seq'), 0, 'new', false, '', 1057312, NULL, 1, 1, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id'

最新更新