zaviagodev / frappe

MIT License
0 stars 1 forks source link

Enhance Item Deletion in ERPNext - Soft Delete and Automated Stock Removal #179

Open John-zaviago opened 8 months ago

John-zaviago commented 8 months ago

Issue Title: Enhance Item Deletion in ERPNext - Soft Delete and Automated Stock Removal

Issue Description: To provide more flexibility in managing items within ERPNext, we need to enhance the item deletion process. The goal is to introduce a soft delete mechanism for items connected with other documents and automate the removal of stock in cases where the item is associated with stock ledger entries or has existing stock in the system.

New Features:

  1. Soft Delete for Connected Items:

    • Modify the item deletion process to perform a soft delete for items connected with other documents.
    • Instead of permanently removing the item, hide it from tables while keeping a record of the deletion with status deleted
    • Apply this behavior specifically when the default ERP behavior prevents deletion due to connections with documents like Stock Ledger Entries, Sales Invoice, Sales Order, etc.
  2. Automated Stock Removal:

    • In cases where the item has a stock ledger entry or existing stock in the system, implement a server or client script to automate the removal of stock.
    • Utilize Material Issue to remove the item from all warehouses where it currently exists.

Implementation Steps:

  1. Soft Delete for Connected Items:

    • Adjust the item deletion process to hide items from tables without permanently deleting them.
    • Implement logic to detect and apply the soft delete behavior when the default ERP behavior prevents deletion due to document connections.
  2. Automated Stock Removal:

    • Develop a client script to identify items with stock ledger entries or existing stock.
    • Implement Material Issue transactions to automatically remove the item from all connected warehouses.
    • Ensure the script runs seamlessly when triggered by the soft delete process.

Expected Outcome:

Additional Information:

Labels:


Action Plan:

  1. Assign the issue to a team member specializing in ERPNext development and item management.
  2. Modify the item deletion process to perform a soft delete for connected items.
  3. Implement logic to hide items from tables without permanently deleting them.
  4. Develop a client script to identify items with stock ledger entries or existing stock.
  5. Implement Material Issue transactions to automatically remove the item from all connected warehouses.
  6. Ensure the client script runs seamlessly when triggered by the soft delete process.
  7. Test the implemented features across various scenarios to ensure reliability.
  8. Provide notifications or logs to inform users about soft deletions and automated stock removal.
  9. Update documentation to inform users about the new item deletion and stock removal processes.
  10. Communicate updates to the team and stakeholders.
  11. Document the implementation details for future reference.

How to Test:

John-zaviago commented 8 months ago

Please record video and paste it here - then @Fyn5 and @chomchuen will help review it. -

deviljutt commented 8 months ago

https://www.loom.com/share/e236d768d4524014bbfd50ea489e1a44?sid=0e34ecca-481e-4bcc-b75a-20334247c5c2

John-zaviago commented 8 months ago

@chomchuen can you and Fyne help test this @Fyn5

John-zaviago commented 8 months ago

@deviljutt If you check the documentation: Instead of permanently removing the item, hide it from tables while keeping a record of the deletion with status deleted - make sure that we have additional status so it changed to delete as in the requirement

Also check the Automated Stock Removal:

In cases where the item has a stock ledger entry or existing stock in the system, implement a server or client script to automate the removal of stock. Utilize Material Issue to remove the item from all warehouses where it currently exists.

Make sure you read it throughly so we are on the same page

John-zaviago commented 8 months ago

About the status, Muzzamal can work on this,

About the stock @deviljutt plan to start on it 1 Feb 2024

John-zaviago commented 8 months ago

Timeline for stock - 1 - 2 hours

chomchuen commented 8 months ago

Nabeel is going to update this to apps.hosting.

deviljutt commented 8 months ago

@John-zaviago its also on live server, with stock removal also active, please test it and you can assign 2nd part of it to show the status

John-zaviago commented 8 months ago

So where does the item go to?` which doctype it will show up as deleted?

John-zaviago commented 8 months ago

The item is deleted and also the stock issue automation is also working, checked and review.

But we need to change the status of the deleted item from Enable to deleted and then move the item to a custom doctype name "Trash" where in there you can revert or redo the soft deleted item back to the item

@deviljutt @Fyn5

deviljutt commented 8 months ago

https://apps.hosting.zaviago.com/app/soft-delete

@John-zaviago

John-zaviago commented 7 months ago

Some issue on the architecture, let discuss this in a meeting