This is my first post. I’m very new to ERPNext, so please excuse me if I don’t have all of the terminology correct.
I installed ERPNext on my Ubuntu server a few days ago and have worked my way through the user manual. I started diving in to custom doctypes and have run into some questions with regards to how foreign keys are managed with child tables.
Here’s what I did:
I created a custom doctype called Pomodoro Log and added Pomodoro Log as a table to the ToDo form. It works, but not as expected.
If I add new Pomodoro Log items to the table they save within the table of that ToDo form, and I can access them when I view the ToDo.
However, if I try to report on the Pomodoro Log document (or open up a single Pomodoro Log item), I can’t see the link back to the parent ToDo item anywhere.
In the standard modules, I’m able to create a task inside of a project doc, then open that task and click the link back to its parent project (and this link populates automatically).
I’d like to be able to link back to the parent ToDo item that each Pomodoro Log references from within that Pomodoro Log.
What’s the recommended approach here?
if you are looking for link field, then please read this.
while adding new field, just select datatype Link and write DocType name in option
@michaelgold welcome to the forum!
The Task - Project connect is custom coded. A child table is not designed to be accessed on its own.
What are you trying to achieve, maybe we can suggest a design.
Thanks fro the responses guys.
I’m wondering if there’s an easy way to automatically populate a link field with a link back to the parent document.
I’m trying to log work completed on each ToDo item. I use a productivity method called The Pomodoro Technique.
There would need to be a one to many relationship from ToDo to Pomodoro Log. The data in each Pomodoro Log would be:
ToDo_id [foreign key]
I’d like to be able to open a ToDo and log Pomodoros to that ToDo item, and also view reports for all Pomodoros that are logged in the system.
I was able to get the functionality I needed here by writing a query report. This allows me to view the parent ToDos alongside the Pomodoro Logs.
todo.name as "ToDo:Link/ToDo:100",
todo.description as "Description:char:300",
todo.status as "Status:char:100",
todo.date as "Date:datetime:100",
todo.expected_pomodoros as "Expected Pomodoros:int:50",
sublog.actual_pomodoros as "Actual Pomodoros:int:50",
log.name as "Log:Link/Pomodoro Log:100",
log.description as "Log Description:char:300",
log.time as "Log Date:datetime:100"
from tabToDo as todo
left join `tabPomodoro Log` as log on todo.name = log.parent
left join (select sublog.parent, count(sublog.parent) as actual_pomodoros
from `tabPomodoro Log` as sublog
group by sublog.parent) as sublog on todo.name = sublog.parent
@michaelgold Awesome. Would be cool if you can share your implementation with some screenshots
Hi @michaelgold, very intersting app. Is it too much to ask if we can find out how you solved it or share the app?
it working u saved me Ty <3