4

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?

Dani Polo
  • 403
  • 2
  • 6
  • 22
  • I do not recommend you to delete data like this. Instead of this you should keep a database without data and if you want to make some tests you can do it with other different database – ChesuCR Nov 22 '17 at 18:41
  • I think he needs the list of the products – Charif DZ Nov 22 '17 at 18:47

2 Answers2

2

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 _

Charif DZ
  • 14,415
  • 3
  • 21
  • 40
2

You can try:

UPDATE stock_quant SET qty=0;
Lucas
  • 884
  • 9
  • 20