コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
125 ビュー

Hello friends, I am using Odoo Version 18.4+e, I am trying to delete some PO as they were test PO, I was testing out the flow, in those PO I created reciepts which I validated and now I simply cannot find a way to delete the reciepts, once I delete these reciepts I will be able to cancel the PO and eventually delete them.

Every time I try to cancel a PO it says " Unable to cancel purchase order(s): P00004 since they have receipts that are already done."

Then I go to the receipt from the smart button and try to delete it, but it says "You cannot cancel a stock move that has been set to 'Done'. Create a return in order to reverse the moves which took place."

I even created a reverse stock move thinking it would enable me to cancel the PO but it wont. 

I was able to delete other sample entires I made such as, journal entries and payments but when I came to PO I am stuck. 

If somone knows how to solve this please let me know the solution I would be grateful.


Thank You.

アバター
破棄
最善の回答

Cybrosys, You wrote:  "For production environments, the proper way is to process a return to bring stock levels back to zero, then cancel and archive the PO rather than deleting it."  Cancel and archive the PO is blocked.  And that is the issue. 

After the return, set ordered qty = 0.  The the PO is  completed.  Still not able to archive or cancel.  But as the PO is in status Fully delivered, nothing to invoice it is considered closed.

Lesson learned Manav: Never ever test in production evironment.  It takes a few minutes to create a copy of production for testing.  

アバター
破棄
著作者 最善の回答

Solution

Important Note - This solution is suitable for anyone who were simply testing in production database and wants to delete all the reciepts. If there are certain reciepts that are imporatant, make a backup of them and then once impletmenting the solution import the reciepts.


Delete the entire Inventory App and install it back. 

This solution worked perfectly fine for me since I didn't have ANY important data I wanted to keep, but at the same time I didn't want to create a fresh database as I had certain configurataions made in the Settings page of Odoo.

Hope this helps.

アバター
破棄
最善の回答

Hi,


In Odoo, once a Purchase Order has validated receipts, it cannot be canceled or deleted because the stock moves created are locked in the Done state to preserve inventory and accounting accuracy. Even if you create a return, the system records a compensating move but keeps the PO marked as received for historical traceability, so deletion remains blocked. For production environments, the proper way is to process a return to bring stock levels back to zero, then cancel and archive the PO rather than deleting it. For testing environments where you only created dummy data, you can enable Developer Mode, open the validated receipt in Inventory → Operations → Transfers, use “Reset to Draft”, and then delete it before canceling and removing the related PO. As a last resort, direct SQL deletion from stock_picking, stock_move, and purchase_order tables is possible but risky and should only ever be used in test databases. In short, Odoo enforces this restriction by design for stock traceability, so in real use you cancel and archive, while for test data cleanup you either reset to draft and delete, or simply drop and recreate the test database.



Hope it helps

アバター
破棄
関連投稿 返信 ビュー 活動
0
3月 15
3919
3
8月 25
728
1
7月 25
663
1
7月 25
1024
1
7月 25
1408