Circular reference when canceling documents

Hi, when I try to cancel a purchase invoice, I’m told it can’t be done because that invoice is already submitted:

  1. I try to cancel PI-11395, I get this message:

  2. When I click on button and try to cancel all linked documents, I then get this message:

Any ideas what could I do here? I’m even trying to do so as Administrator, no luck.

  1. When I then go to the PR and try to cancel directly, I get this message:

  2. When I click on cancel all, I then get this message:

Going crazy, here. Please help!

Someoen, please :pray:

You can try cancelling both documents through server script. If that didn’t work, your best bet would be force deleting them through server script. For both cases, make sure you cancel/delete both of them as well as any other referenced/linked document so you don’t turn your database into a mess.

doc = frappe.get_doc(doctype, docname)
doc.cancel()
doc.save(ignore_permissions=True)
# doc.delete(force=1) # if cancelling does not work.
frappe.db.commit() 

1 Like