Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
3108 Vistas

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!

Avatar
Descartar
Mejor respuesta

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

Avatar
Descartar
Autor Mejor respuesta

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 . 

Avatar
Descartar

What issue you’re facing now

Mejor respuesta

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

.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 24
2257
1
nov 23
4845
4
feb 25
18376
3
nov 24
11141
1
jun 21
3243