Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adding task to project from task doctype #17774

Closed
wants to merge 20 commits into from

Conversation

@Don-Leopardo
Copy link
Contributor

Don-Leopardo commented May 28, 2019

fix #17730

The error wasn't only that you couldn't add more than one task to a project, it was that you couldn't add tasks to a project from the task doctype.
With this fix, if you create a task with an assigned project, the task will apear in the project child table; furthermore, if you edit a task and change the project, it will be moved to the child table of the new project you selected and it will be deleted from the child table of the old one (it works when you select no project too).

Don-Leopardo and others added 14 commits May 29, 2019
…to proyect_task_problem
Copy link
Member

rmehta left a comment

  • Add tests
  • Move this to develop
@@ -101,6 +107,39 @@ def update_project(self):
if self.project and not self.flags.from_project:
frappe.get_doc("Project", self.project).update_project()

def update_project_tasks(self):
tasks = frappe.db.sql("""SELECT name

This comment has been minimized.

This comment has been minimized.

Copy link
@rmehta

rmehta Jun 14, 2019

Member

Also use ORM

This comment has been minimized.

Copy link
@Don-Leopardo

Don-Leopardo Jun 14, 2019

Author Contributor

I think that this is solved now, can you confirm?

Copy link
Member

rmehta left a comment

see comments

@Don-Leopardo

This comment has been minimized.

Copy link
Contributor Author

Don-Leopardo commented Jun 14, 2019

  • Add tests
  • Move this to develop

Does this mean that I should close this PR or should I just open another to develop? (I prefer the to open another)

Can you provide some links about making tests? I had never done it and I don't know how they work. What should I make a test for?

@barredterra

This comment has been minimized.

Copy link
Contributor

barredterra commented Jun 15, 2019

@rmehta can this be treated like a bugfix? It solves the unexpected behavior described in #17730 , that makes it hard to use project management.

@rodrigoinformationsys

This comment has been minimized.

Copy link

rodrigoinformationsys commented Jun 18, 2019

I've done some testing in your branch and I've found an unexpected behaviour. Maybe it is how erpnext works as default.
Testing the connection between the "Project Task" and the "Task" and everything went well. But I do use "Track Changes" in my projects and tasks so I can keep up with my team. When I change status from "Open" to "Working" of a task from project's page it doesn't show this change in the task track.

So i got some odd changes like:
image

Maybe it should be another issue but I need to know if this is the proper behaviour or not.

@barredterra

This comment has been minimized.

Copy link
Contributor

barredterra commented Jun 18, 2019

@rodrigoinformationsys this PR only syncs changes in Task to the corresponding Project, not the other way round. But please open a new issue for the bug you found :)

@Don-Leopardo

This comment has been minimized.

Copy link
Contributor Author

Don-Leopardo commented Jun 18, 2019

I've done some testing in your branch and I've found an unexpected behaviour. Maybe it is how erpnext works as default.
Testing the connection between the "Project Task" and the "Task" and everything went well. But I do use "Track Changes" in my projects and tasks so I can keep up with my team. When I change status from "Open" to "Working" of a task from project's page it doesn't show this change in the task track.

So i got some odd changes like:
image

Maybe it should be another issue but I need to know if this is the proper behaviour or not.

That issue is caused by the line 167 in the project.py file:

task.run_method("validate")
task.db_update()
else:

The db_update method does not log the changes. You can try by changing it with a simple save. I don't know if this is a bug or not.

@rmehta

This comment has been minimized.

Copy link
Member

rmehta commented Jun 21, 2019

@Don-Leopardo please open another PR. There needs to be one PR for all supported versions.

Please also add tests

@rmehta

This comment has been minimized.

Copy link
Member

rmehta commented Jun 24, 2019

The task table should be reloaded when a new linked task is added. The is a UI problem

@rmehta rmehta closed this Jun 24, 2019
@Don-Leopardo

This comment has been minimized.

Copy link
Contributor Author

Don-Leopardo commented Jun 24, 2019

@rmehta What do you mean? Are you saying that this PR has that error in the UI or are you saying that all that we need to do is to solve that error in the UI? If it's the latest, it's not true. I've just finished a new test in the latest v11 and it stills does not create the record in the proyect's child table, even after reloading it.
If you are trying to say that this PR has that error and needs to be solved, then I get confused with the closing of it.
Can you resolve this to know if I have to keep working in the tests?

@yrestom

This comment has been minimized.

Copy link

yrestom commented Jun 25, 2019

Hi
I do not think it's a UI problem, because when you add a task from a task doctype and link it to an existing project, the number of tasks within the project increases by one, but it does not appear within the task table within the project.
If you try to modify the project page, it will unlink the project from the newly added task.
In addition, any change to any task within the same task is not reflected on the tasks within the project, for example change the start date or end date or task name.

@rmehta

This comment has been minimized.

Copy link
Member

rmehta commented Jun 25, 2019

#18059

@Don-Leopardo

This comment has been minimized.

Copy link
Contributor Author

Don-Leopardo commented Jun 25, 2019

@rmehta Are you planning to solve the issue in v11 too?

@rmehta

This comment has been minimized.

Copy link
Member

rmehta commented Jun 25, 2019

@barredterra

This comment has been minimized.

Copy link
Contributor

barredterra commented Jun 26, 2019

IMO most people won't use Task and Project as the entry point in the same session.

It fails even if you use only Task. My scenario in #17730 never touched the project's task table, but still Project will be unlinked from Tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.