Set product quantities to 0 in Odoo 10

Viewed 947

We are ready to deploy our instance to production and I'm currently cleaning all the demo data made during the process.

I usually follow this steps to clean major sample data:

SSH into server

su postgres
psql abc_db_name

delete from stock_pack_operation;
delete from stock_picking;
delete from stock_move;
delete from account_invoice;
delete from account_partial_reconcile;
delete from account_move;
delete from sale_order;
delete from account_payment;

The main problem I'm facing now is set all the product quantities to 0 without deleting the products. What's the query I need to run to set this to reset them and start the inventory from scratch?

2 Answers

The quantity of the product are in model :

   stock.quant 

just delete those record and the product should be Zero.

try this:

   delete from stock_quant;

because odoo change the name of the model to valid postgres name by changing the . to _

You can try:

UPDATE stock_quant SET qty=0;
Related