Hi- I created a Sales Order, and from it, I accidentally created 2 Projects instead of 1.
Now, when I try deleting the extra project, I get a message:
“Cannot delete or cancel because Project PR0002 is linked with Sales Order SO-00004”
I tried un-linking the Project from the Sales Order by selecting a blank Sales Order, or by selecting another Sales Order in the Project’s edit page. This removed the Project from the Sales Order edit’s page, but did not remove the Sales Order from the Project’s edit page.
The only way to delete a linked Project is to delete the Sales Order. And I do not want to do that. Any help in this regard will be much appreciated.
I tried on ERPNext: v10.0.6 (master), Frappe Framework: v10.0.7 (master). I was able to delete a project linked to sale order. The only warning I got is “Cannot delete or cancel because Project X is linked with Task Y”. After I’ve delete the task, the project was deletable.
Try to delete both links, sale order and project in PR0002 and SO-00004. Then delete PR0002.
Hey thanks for the quick reply. There is no option to remove a Project from Sales Order edit page, because there is no Projects field. Also, my ERPNext is slightly older.
ERPNext: v9.2.23 (master)
Frappe Framework: v9.2.24 (master)
Any guidance on how to update it? I tried ‘bench update --reset’ but no dice. I get error:
error: Your local changes to the following files would be overwritten by merge:
Please, commit your changes or stash them before you can merge.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/update.py”, line 34, in update
File “/home/frappe/.bench/bench/utils.py”, line 256, in update_bench
exec_cmd(“git pull”, cwd=cwd)
File “/home/frappe/.bench/bench/utils.py”, line 140, in exec_cmd
bench.utils.CommandFailedError: git pull
Any help will be much appreicated.
I managed to start the update process.
- Be logged in as the frappe user. su frappe (and enter password)
- Go to the home directory of the frappe user. cd ~
- Then go to a ‘./.bench’ directory. cd ./.bench
- Then run git stash
- Then return to the frappe-bench directory and run ‘bench update --reset’
Hope this helps somebody.
Hurrah! Able to delete the Project linked to a Sales Order. Thanks for your help, Rene_Mailloux!!
OK- premature celebrations! There is now a new problem. I cant cancel (to delete) the Sales Order against which I had deleted the Project. I am able to cancel/delete all new Sales Orders against which Projects were created/deleted. Its just this old one, which was created before the update. The error message I am getting when I try to cancel the Sales Order SO-00004:
Project SO-00004 not found
Did not cancel
The resource you are looking for is not available
Note that it says Project SO-00004. This Project may have existed at some point in time, but is not there any more. Would I need to delete this Sales Order from the DB?
Any help will be much appreciated.
Hey- it looked like I made an error in my repeating steap. Can you test whether its happening on your end or not:
- Create a sales order.
- Make a project from the sales order.
- Save the project
- Try deleting the project.
Can you tell me if you are also getting an error?
Here is what I did.
- Create a Sales Order with Ctrl+B.
- Fill, save and submit the Sales Order.
- Make button then Project.
- Save the new Project.
- Menu button, delete then Yes to confirm.
- Impossible to delete because Task.
- Click the Task.
- Menu, Delete, Yes. (Back to Project)
- Menu, Delete, Yes. (Back to Sales Order)
If you have access to the DB. Go in tabSales Oder and delete all refences to the project in your sales order SO-00004. Maybe you will have to delete all SO-00004 references in tabProject for the project you want to delete. Then go in ERPNext to cancel SO-00004. Don’t delete the entire record.
If this problem append again. Try to delete the first project created instead of the second one. Its an issue in ERPNext. When the second project is created, the first project number is overwritten in project field of sales order. I don’t know if its better to limit to 1 project or to remove the link in Sales Order doctype. Do you want to report this issue?