ERPNext Conference 2019* ERPNext.com Blog

Legitimate need for Child DocType within Child DocType


#1

Dear Frappe Team, Others,

I’m trying to build the following relationship between entities in a Polling App:

Poll DocType has one or more Question DocTypes
Each Question DocType has one or more Answer DocTypes

Could someone advice on the best way to achieve this requirement? I’m trying avoid having to create my answers as fields within the Question DocType as each answer has several fields of it’s own and such denormalisation would make the Question DocType look dirty to me.

I read from the following topic How to add Child DocType In another Child DocType that the Frappe Framework might have a challenge handling this type of nested relationship. Basically, the interface becomes non-responsive when I try to add Answers to Questions.

I would like to understand if this challenge is a conscious design decision or if it is a limitation that will be improved sometime in the future.

If this is a limitation with hopes for improvement, I am willing to sponsor development of a solution to this problem. If however, there is a way to achieve it in the current framework, please do let me know.

Regards,
cksgb


#2

You can have relation like

Project (istable=0), Project Task (istable=1) and Task(istable=0) :
Tasks are shown in Project as Child, Task are doctype on their own.

or Customer(istable=0), Contact(istable=0) and Address(istable=0)
Addresses and Contacts are rendered in html under Customer / Supplier.


#3

Thanks Revant, will explore the examples you’ve provided.

I’d like to ask though, when you delete Project Tasks from a Project, doesn’t that leave the Task Id’s linked to the Project Task’s lying around in the tables? Do you explicitly clean these up in a hook or just leave them there?

Regards,
cksgb