Unable to delete an employee

We’ve recently set up self-hosted instance in production mode and begun setting up couple of our companies. As part of that, we added few employees and users (including couple of test ones). Now, while trying to delete one of the test employees, we are getting the below error:

Cannot delete or cancel because Employee EMP/0003 is linked with None Sales Team

From what I understand, the said employee record is linked to another doctype with record name “Sales Team” but somehow that link is broken and hence ‘None’ is being returned. Clicking on Sales Team returns an error because ofcourse there is no such record.

It will be helpful if anyone can nudge in the right direction to help us fix this.

Thanks,
Shubham

In the Sales Person tree, under Sales Team group can you see any entries, check each one to if any entry is linked to EMP/0003 ? If yes then remove it and I think your problem should be solved.

1 Like

Great! Thank you so much @root13F . That did it. Had to login as an administrator with privileges to be able to delete that node.
I didn’t even know that something called a Sales Person tree existed, till now. :sweat_smile:

By the way, isn’t the original error sort of a bug, why does it not link to the Sales Person Tree instead of None Sales Team?:face_with_raised_eyebrow:

Of course you can do that but structuring it is better when you have sales team that may varying focus - such as retail vs corporate, area wise teams etc. that depends on the company.

If you see, Sales Team is actually a Group, under that you can make more groups or add individual sales person according to your needs.

Yes, I didnt mean Sales Team Tree shouldn’t be there. I meant, while deleting the employee, if the reason was that the Employee was linked to a Sales Team Group, then error message should have made that clear. Seems like a minor and easy to fix bug to me :slight_smile:

Maybe, as soon as I get my own hands dirty with the code, I’d fix it myself and send a PR :smiley:

1 Like