Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
4355 Lượt xem

Hi All,

I am using Odoo15. When I am creating a Customer selecting parent_id (say 1000),  I am getting the mentioned error. I have checked the logs and the below got the below error.


bad query: INSERT INTO "mail_message" ("id", "add_sign", "author_id", "body", "create_date", "create_uid", "date", "email_from", "is_internal", "message_id", "message_type", "model", "parent_id", "record_name", "reply_to", "res_id", "subject", "subtype_id", "write_date", "write_uid") VALUES (nextval('mail_message_id_seq'), true, 3, '

Contact created

', '2022-11-04 18:02:48.485415', 2, '2022-11-04 18:02:48', '"Administrator" <admin@example\.com>',\ true,\ '',\ 'notification',\ 'res\.partner',\ 1000,\ NULL,\ '"Administrator"\ <admin@example.com>', 1001 NULL, 2, '2022-11-04 18:02:48.485415', 2) RETURNING id

ERROR: insert or update on table "mail_message" violates foreign key constraint "mail_message_parent_id_fkey"
DETAIL: Key (parent_id)=(1000) is not present in table "mail_message".



This is not happening if I create a company which is not having a parent ID. I am not getting why parent_id is getting passed to mail.message which is actually the parent_id of Customer getting created. Any idea why this is happening and how can it be resolved?

Ảnh đại diện
Huỷ bỏ
Tác giả

found a similar issue in the below link. But no answer found.

https://www.odoo.com/forum/help-1/account-follow-up-email-error-39090

Câu trả lời hay nhất

Make sure that parent_id is not being inherited or overridden incorrectly in the mail_messagemodel or any related models. This could be causing

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Just as players must navigate the challenges in to progress, resolving this foreign key issue requires careful attention to ensure that all parent IDs are correctly referenced in the database.

Ảnh đại diện
Huỷ bỏ

Absolutely! Just like in https://poppyplaytimechapter3.io where each step requires careful planning to avoid pitfalls, resolving foreign key constraints in Odoo demands a thorough check of parent IDs to ensure data integrity.

Tác giả Câu trả lời hay nhất

Issue resolved by using active_id in odoo.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 4 25
672
0
thg 5 23
1512
1
thg 9 22
3085
0
thg 3 15
4777
0
thg 8 25
188