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.
@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?
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.
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 ...
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’;