Table Field Type: "Customer"-Table

Hi,

i have added a new doctype, now i want to add a new table with options “Customer”, but he always say “Option Customer for field partners is not a child table”, i want to link the erpnext default customer doctype as a table.

regards and thanks

If you want to just make a connection from 'Your DocType' to 'Customer', then you would create a DocField with type “Link”:

However, if you want to create a Table/Grid within 'Your DocType`. Such as what you see on Purchase Orders:

That can only be achieved when the DocType you are displaying is a “Child Table”.
Customer is not a child DocType/table.

Here’s the official documentation about this:

https://frappeframework.com/docs/v13/user/en/basics/doctypes/child-doctype

Do you know, does it make any affect when i change them to child table?

My use case is something like this, i want to manage my Events & Contracts with Partners.

  1. new Doctype Event
  2. new relation “table” to Customer (to handle partners)
  3. new relation “table” to Contracts (to save the contracts with partners for this event

regards

use table multiselect

Definitely do not edit an existing DocType like 'Customer' , and mark it as a Child. That will break the DocType rather completely.

Here’s a link to what Tufan hinted at: The concept of “Table Multiselect”
https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/articles/table-multiselect-field

Basically, it works like this:

  1. You have an existing Document, which is not a Child. It’s a regular DocType (parent).
  2. You create a brand-new Child DocType. It’s basically acting as “middleware”
  3. In this Child DocType, you create a DocField that is of type “Table Multiselect”. And point it at the Document you really wanted to link originally. In your case, 'Customer'
  4. Add this Child DocType to the parent from Step 1.

So now you have 3 DocTypes, related like this:

  • Parent —> Child (1-to-Many)
  • Child —> Customer (1-to-1)

The visual result is like the screenshot below. Little checkmarks, that indicate they “belong” to the parent.

Not nearly as nice as a Grid display. But it’s the best the framework can do (unless you’re very skilled with JavaScript, HTML, and the DOM, in which case you build your own grid solution)

Hi Brian,

I could use your help with a similar problem. I am working on a custom app for my company, and I have need for multiple Sales Orders to be associated with a Project. Now, as far as the backend goes, this is possible with very little modification.
However, in the UI, I need to convert the Link field into a Table MultiSelect. I have done this, but I am unable to export the changes to my app since it doesn’t quite classify as a “Custome Field”. I tried exporting the relevant DocField directly, but you can see the problem in the attached image. Notice how index 17 is missing, but there are two index 1s?


Any help is appreciated. Thanks!

Hi Gughan,

I don’t have a complete answer, but maybe some ideas.

  • Instead of editing the existing sales_order field, it may be easier/better to add a new DocField. See my screenshot below. I did not edit the ’ sales_order ’ DocField, but instead, added another DocField named 'sales_orders

  • The two index 1’s should solve itself when you save. But if not, try left-clicking on one of them, and dragging the row up/down. That usually recalculates the index values.

  • Another topic you may want to search on the forums are “fixtures”. I don’t know much about them, but I believe they can help a Custom App make changes to a Standard App.

I don’t know why I didn’t think of that. I’ll go with the new DocField to replace this one.
And regarding fixtures, that is how I ended up with the wonky index situation.

Thank you!

Edit: btw, the SSL on your website seems to have expired

Thank you, @SvbZ3r0.
(most days, I forget I even have my own websites. :smile: )
Resolved for now.