frappe / frappe

Low code web framework for real world applications, in Python and Javascript
https://frappeframework.com
MIT License
7.33k stars 3.46k forks source link

Child table of another child table #17503

Open nev-21 opened 2 years ago

nev-21 commented 2 years ago

Description of the issue

Can't use a child doctype inside another child doctype. Inside a parent document I click edit button in boxes grid, and i can’t edit it ( because the child table has a Table field).

Context information (for bug reports)

Frappe 13.34.0 Frappe 14.0.0-beta.4

https://user-images.githubusercontent.com/89469783/178801717-11267424-ec6d-4578-aa3d-59b15a4f37d4.mov

Output of bench version

bench does not throw nothing

Steps to reproduce the issue

  1. Create one parent doctype (Pallet)
  2. Create two child table doctypes (Box and products)
  3. One Pallet have many boxes, add Table field to Pallet doctype with options "Box"
  4. One Box have many products, add Table field to Box doctype with options "product"
  5. create a Pallet document, in boxes table, add a row, and then click on edit

Observed result

Cant open sub-form of the child-table when the child-table has another child-table field.

Expected result

allow to open the sub-form and then edit the sub child table field list.

Stacktrace JAVASCRIPT / full error message

Uncaught TypeError: Cannot read properties of undefined (reading 'allow_bulk_edit')
    at Grid.setup_allow_bulk_edit (grid.js:932:58)
    at Grid.make (grid.js:127:8)
    at Grid.refresh (grid.js:328:25)
    at ControlTable.refresh_input (table.js:112:13)
    at ControlTable.refresh (base_control.js:113:12)
    at Layout.attach_doc_and_docfields (layout.js:410:59)
    at Layout.refresh (layout.js:283:8)
    at GridRowForm.render (grid_row_form.js:28:15)
    at GridRow.show_form (grid_row.js:1083:18)
    at GridRow.toggle_view (grid_row.js:1069:9)

Additional information

Discuss: https://discuss.erpnext.com/t/child-table-of-a-child-table/92008?u=nev-21

anhlevfx commented 2 years ago

Hello @nev-21 , I'm facing the same issue. Did you find any solution for this?

ahmedbahgattt commented 2 years ago

me too hope to find a solution in v14

nev-21 commented 2 years ago

Hi @anhlevfx the only solution i found was to make frappe custom pages, but the docs are not well explained on how to achieve this, you have to read a lot of forums, and test some projects etc.

I leave the frappe project in favor of other frameworks for complex enterprise apps. Don't misundestand me, frappe is good, but not for enterprise complex app with high customizations needs.

anhlevfx commented 2 years ago

Hi @nev-21 , hope that you will success with new framework. For now, I'm still using frappe for my project and maybe next versions can handle more complex cases. I try to not use child table of child table for my doctypes.

stockarea commented 10 months ago

Any update here, is there anyway we can achieve this?

anhlevfx commented 10 months ago

@stockarea st I think you should change your schema. Child table of child table is not best practise.

hblanko commented 8 months ago

If we were to encode Subscriptions inside the Quotation DocType (which I'm doing as there is no direct support for it currently within ERPNext), I fall into this use case:

This would be successfully (and correctly, I'd argue) modeled by nesting child tables such as:

Quotation
└ Quotation Subscription (child table of Quotation)
  └ Quotation Subscription Plan (child table of Quotation Subscription)

I do not see a reason to consider this as an antipattern by default, and I hope it will be covered by Frappe soon.

jacksungithub commented 3 months ago

what frame is that? for personal ref.

kalungia commented 1 month ago

@rmehta implemented this here but it was never merged maybe you can look into the code and see how it was done and do it in your custom code. #2917

git-avc commented 1 month ago

@rmehta said last Frappeverse that never found a strong use case for merge that kind of infinite recursivity.

I think it would be helpful on many cases like :