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


I tired to install website_sale ,,,same popup Error
I tried to install stock_delivery ,,, same popup Error
I tried to create constraint in Technical,,,same popup  Error

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

Hi,



The validation error appears because Odoo’s database integrity rules prevent the deletion of a record that is still being referenced in another model. In this case, the issue is related to the Product Moves (Stock Move Line) model and the carrier_id field, which is linked to a delivery carrier record. When Odoo detects that a stock move line is still referencing a delivery carrier that you are trying to delete or modify, it blocks the action to maintain data consistency.


This problem commonly occurs when you try to install or uninstall modules such as website_sale or stock_delivery, especially if some existing stock move lines still reference deleted or missing carrier records. It can also happen due to inconsistencies left behind during upgrades or partial uninstalls of delivery-related modules.


To resolve this, you should first avoid deleting carrier records that are still linked to stock move lines, archiving them is a safer option. You can also check and manually remove or update any stock move lines referencing carriers that no longer exist. If the problem is caused by outdated module definitions or missing relationships, upgrading the delivery and stock_delivery modules can help fix it. Running module updates using ./odoo-bin -u delivery,stock_delivery -d your_database_name will refresh database constraints and restore correct relationships.


If the issue persists, you can consider uninstalling and reinstalling the delivery modules, ensuring no dependent records remain. Lastly, if you have any custom modules modifying the carrier_id field, check that the field definition does not restrict deletions unnecessarily, changing the ondelete property to 'set null' might prevent similar errors in the future.

Check the methods in the testing environment first, and then in production.




Hope it helps

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

This worked!
Query:

UPDATE stock_picking

SET carrier_id = NULL

WHERE carrier_id IS NOT NULL;



Result:

UPDATE 2

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 25
2733
2
thg 2 25
1939
2
thg 3 25
7238
2
thg 11 24
2534
1
thg 5 24
2383