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.
@kolate_sambhaji,
I’m wondering if there’s an easy way to automatically populate a link field with a link back to the parent document.
@rmehta,
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:
*ID
Comment
ToDo_id [foreign key]
Timestamp
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.
select
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