Try ERPNext Buy Support Partners Foundation

Cannot Delete Asset because Purchase Invoice is Linked to it

I am using ERPNext for my startup and it is doing great! Before 1 Month I have upgrade my ERPNext to v10.1.28 from the previous version.

After that i cannot able to cancel the wrongly made Asset Entries which i have made before the Upgrade. If i am trying to cancel Asset it is asking to purchase invoice and If i am trying to cancel the Purchase Invoice, it is asking to cancel the Asset.

Both the entries are linked to each other and doesn’t allow me to cancel each other. I appreciate your help to get rid of this issue.

2 Likes

@rohit_w @shreya115 this is a general use-case,… users often get into the loop by creating custom link fields, linked with one-to-one transaction.

Any update on this? I am facing the same issue.

any solution yet? I’m facing the same issue

The same problem here. Any fix for the bug?

i faced same problem, kindly share any update regarding this issue.

@umair So the problem is how to delete a cycle or circular reference ? Has Frappe reviewed what to do in this case or is there say a github issue or feature request note for this, for folks to upvote or implement a tool here?

Hello… Do we have update on this?? at least we need a walk-around to fix our current problem…

You have options here, including -

Post the issue https://github.com/frappe/erpnext/issues for upvoting so all can get a sense of the need.

With sql delete the offensive objects from the database. Do this on a non-production test environment since you do not want to break the integrity of the database.

Engage someone to devise a tool, document the general process they used and so on. The idea is to contribute so all can benefit and learn.

I am facing the same issue

@karthik8592 @Vinit @Jacksoneasyway @Muha @ahmad_Faiaz @Ahmad @FredericVerville
I think frappe team didn’t solve the one-to-one delete issue yet,
I solved the issue temporarily by deleting the records from SQL command,

1. Open the database >> bench --site yoursiteName mariaDB
2. Change the safe update mode to false >> SET SQL_SAFE_UPDATES=0;
3. Delete the records >> delete from tabAsset where ...
1 Like

I had a similar problem where I was not able to cancel a Purchase Receipt because it was assigned to an Asset and couldn’t delete the Asset because it was assigned to a Purchase Receipt.

I ended up going to the database and fixing things manually. I’m not sure how this would affect the DB integrity but could not find a way around it through ERPNext interface.

Please fix this issue as the functionality is basic and should be available to users.

These are the SQL commands I had to run to remove the Purchase Receipt, the Asset and related General Ledger entries:
DELETE FROM tabPurchase Receipt WHERE name=‘MAT-PRE-2019-00001’;
DELETE FROM tabPurchase Receipt Item WHERE name=‘658ba5a34d’;
DELETE FROM tabGL Entry WHERE voucher_no=‘MAT-PRE-2019-00001’;
DELETE FROM tabAsset WHERE name=‘ACC-ASS-2019-00001’;
UPDATE tabItem SET last_purchase_rate=0.000000 WHERE name=‘TOSH-POR’;