Multiple purchase receipt on same transaction

I find that is very easy to make mistakes when working with Purchase orders, purcharse invoice and purchase receipt.

Here are the ways to receive items that I’m aware of within the purchase order/invoice cycle.

The “default” way is to make a purchase order and then a purchase receipt so with this method it’s possible to follow and stock qty should be ok and we make purchase invoice after.

It is possible to have a purchase invoice without purchase order or purchase receipt and no warning so without looking it’s hard to figure out if the receipt was forgotten.

It’s also possible to make the purchase receipt on the invoice without Purchase order.

It’s possible to make a purchase invoice with the update stock option which is equivalent to make a purchase receipt after.

It is also possible to make a purchase order, purchase receipt, then purchase invoice and also make a purchase receipt on the invoice and now you have the double of the quantity purchased in stock.

Is there a way to prevent errors or be aware what is really received, over received or not received at all so the stock can balance?

Anyone? This is a big problem and makes the inventory easy to mix up

check the buying settings.

the only option I see is to force the PO on Purchase Invoice but this is not what I want.

if this is the case, then use python script to force PO on some condition is the way to go.

if doc.field1 == 'some_value' and not doc.purchase_order:
    frappe.throw("PO is needed")

I created PO, then PR and then tried to create PI with the update stock ticked. It does not allow receipt of stock twice. Throws a notification
Untitled

So I was wondering what was your case and how did you manage to create second PR. You cannot create second PR from PO as there is no such option.