Cancel SO without cancelin PO that is linked

Hi experts, I would need to cancel a Sales Order for which a Purchase Order has already been created.

The Purchase Order cannot be canceled because that is how the agreement with the supplier is set up, but the customer has canceled his Sales Order and we cannot cancel the Sales Order without canceling the Purchase Order.

How should that be handled? Any ideas?

but when you cancel the sales order then purchase order can’t be canceled. it will un-linked.

Hi, thanks for replay. I forgot to mention that problem occurs when PO has an approved status. Than I receive 2 type of messages.
When only approved but not received
image

an when approved and received with PR document
image

Which version are you using? A purchase receipt is already created from the purchase order. So, when you cancel the purchase order, the purchase receipt is also canceled. This is the default process of the system.

We haven’t encountered this type of issue in version 15, when cancel the sales order.

I am using the newest version 15.
This is about canceling SO with linked PO(in status submited)
Of cours I understand that if I have Purchase Recipt and I try to cancel PO than it will need to cancel both, but it is not the case.
The case is to cancel SO without canceling PO,

just add in override sales invoice js file on refresh event
frm.ignore_doctype_on_cancel_all=['Purchase Order’s,‘Purchase Receipt’] it allow to cancel so without cancelling po and pr

Hi, unfortunately your solution does not work. The same problem still occurs.

image
image
image

Please check this.

it doesn’t help :frowning:

migrate the site and bench build --force

Yes I already did that, but it is not helping.

Caching issue!

Please apply the code in the client script doctype and check it.

Nope. Still the same problem…

change event refresh to setup

After changing the event from refresh to setup, this issue still occurs.

frappe.ui.form.on("Sales Order", {
    setup(frm) {
        frm.ignore_doctypes_on_cancel_all = ['Purchase Order', 'Purchase Receipt'];
    }
})
1 Like

Does anyone has any other idea ?

Try this script,
frappe.db.set_value(“Purchase Order”, purchase_order_name, sales_order_field", “”). It will removes the Sales Order linked with Purchase Order.
Must check it reflect to any accounts entries, user permissions or default function.

Looks like it should not be disconnected and it is done in porpoues.
We have created our workflow with additional stem for that kind of situation. Anyway thank you for your suggestions.