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

1 Like

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)