Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
4 Odpovědi
19799 Zobrazení

it says I must first cancel the order, So I click cancel. Then it says I must "first cancel all receptions related to the purchase order". So, I went ahead and canceled the delivery, but it still gives me the same message.

Avatar
Zrušit
Nejlepší odpověď

go into each order line in the purchase order and delete them, that will help you discover which line still has a reception attached to it. Then cancel it.

Avatar
Zrušit
Autor

I don't understand. I can no longer edit the purchase order. What am I deleting?

You could go to warehouse/deliver/receive by order and cancel the incoming shipment that corresponds to the PO. Next step is to cancel the PO

Autor

I did cancel the shipment corresponding to the PO, but it still will not cancel the PO

Make sure you are cancelling the INCOMING SHIPMENT. In your question you typed that you cancelled the DELIVERY, which is related to the SALES ORDER, not the PURCHASE ORDER.

Autor

Yes. I did cancel the incoming shipment and not the delivery. Sorry about that confusion.

@ Lars. Thanks I got my problem solved with your help.

Nejlepší odpověď

Hello Robert,
You need to cancel first all the invoices related to particular purchase orders. Also, cancel all the receipt stock pickings.
you can do like this. Here the self is particular purchase order.

picking_order = self.env["stock.picking"].search([
('partner_id', '=', self.partner_id.id),
('origin', '=', self.name)])
for picking in picking_order:
if picking.state != 'cancel':
​picking.action_cancel()
if self.invoice_ids:
for invoice in self.invoice_ids:
invoice.button_draft()
​invoice.button_cancel()
record.button_cancel()

Kind Regards,


Avatar
Zrušit

I'm newbee on odoo. Could you let me know how to run your script? I'm using odoo v16.x (online). Thanks in advance.

Nejlepší odpověď

You can manully delete them from data base.

check the model name  goto the respective table

and delete the record 

also delete other related records like receipt , delivery details


Avatar
Zrušit
Nejlepší odpověď

Just an indication for those like me who have the same problem but who do *not* have installed the warehouse module, you won't be able to see the menu "Warehouse".

Then to cancel the order proceed as follow :

- Purchases / Invoice Control / Incoming shipments

- cancel the appropriate line

- then go back to the order and you will be able to cancel it.

Kind regards

Avatar
Zrušit

How can I cancel the purchase order that has receive product? I mean shipment has "done".