Looking for an SQL command to reset the quantity of all my inventoried parts to 0 before I do a physical.
Just not sure what field to set to 0.
Can someone help?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Looking for an SQL command to reset the quantity of all my inventoried parts to 0 before I do a physical.
Just not sure what field to set to 0.
Can someone help?
Hi,
Resetting all inventoried parts to 0 quantity in Odoo using SQL is dangerous and not recommended unless you're working in a test/dev environment.
- In Odoo, stock levels are not stored directly in the product record.
- They are calculated based on stock moves and quant records.
-You should not manually zero inventory via SQL unless you're wiping clean a testing environment.
Try the following command.
UPDATE stock_quant
SET quantity = 0.0,
reserved_quantity = 0.0
WHERE location_id IN (
SELECT id FROM stock_location WHERE usage = 'internal'
);
-This does not create any traceable inventory adjustment it's a hard overwrite.
-It will not reflect properly in accounting.
-Stock valuation will be off unless you also handle stock_move, stock_valuation_layer, etc.
The safe way is the Physical Inventory Adjustment.
Hope it helps.
For systems with transaction logging or audit trails, resetting stock directly in the database might bypass some important tracking. A safer method might be using a built-in function, if available.
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up