Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
3191 Widoki

Hello,

I made a mistake while setting up the warehouses. So now I need to delete the warehouse.  It is a new warehouse fresh and without any record. 


I am getting the following error note.


The operation cannot be completed: another model requires the record being deleted. If possible, archive it instead.  

Model: Stock Rule (stock.rule), Constraint: stock_rule_picking_type_id_fkey 


I am using odoo v17. How can we get clear of that constraint?


Thanks!

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,
The error message "The operation cannot be completed: another model requires the record being deleted. If possible, archive it instead." indicates that the warehouse you're trying to delete is referenced by another record, specifically a Stock Rule. In Odoo, deleting a warehouse with linked Stock Rules isn't allowed due to foreign key constraints.

Here's how you can resolve this and delete the warehouse:

Identify Linked Stock Rules:

Go to Inventory > Configuration > Stock Rules.
Use the filters or search bar to find Stock Rules referencing the warehouse you want to delete.
Delete or Modify Linked Stock Rules:

There are two approaches:

a) Delete Stock Rules:

If the Stock Rules are no longer needed, select them and click Delete.
b) Modify Stock Rules:

If the Stock Rules are still relevant, edit them and change the "Warehouse" field to a different warehouse.
Retry Deleting the Warehouse:

After deleting or modifying the linked Stock Rules, navigate back to the Warehouses list (Inventory > Configuration > Warehouses).
Select the warehouse you want to delete and click Delete. This time, it should delete successfully without the constraint error.
Here are some additional points to consider:

Archiving vs. Deleting: While the error message suggests archiving, it's generally better to delete unwanted data in Odoo to maintain a clean database.
Data Backups: It's always recommended to have a recent backup of your Odoo database before making any significant changes.

Hope it helps

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Hello,

I have deleted all those and looked and them... still cant delete it.

Stock Rule table seems to have entry that you can get rid of . 

Awatar
Odrzuć

What issue you’re facing now

Najlepsza odpowiedź

Hello,


When you create a new warehouse in that case some rules and routes are created.

So, you need to do the following things: 

1. Archive or delete rules 

2. Archive or delete routes 

3. Archive or delete warehouse


Instead of deleting those records first Archive and checking the system is working fine and after the cross verification delete those records.


Thanks

.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
paź 25
228
1
sie 24
2331
1
lis 23
4933
4
lut 25
18461
3
lis 24
11253