We have several main types of Items, specifically:
Stickers
Gift bags
Cards
As you can imagine, each has its own custom parameters.
I have two main questions:
How can we have the same field name used more than once? Here’s an example; for stickers we have two types of width and height, one for the sticker sheet and one for the backer sheet. But if I try to use “width” and “height” more than once, it won’t save because they have the same name, and I can’t edit the name (only the label).
Should I be going to “Custom Fields” first and adding all the fields so as to avoid clashes? Here I was able to create fields with names like custom_sticker_height and custom_backer_height both with Label of Height which is good. But it doesn’t change the name of the field; how can I do this?
My proposed design is that the custom fields (stickers, gift bags, cards) would display depending on the value of Item Group. Is this a reasonable approach and if not, what’s the best practice? I haven’t decided yet if they’ll be a separate tab or section but that can be determined later.
Each field has its own column in the database and you cant have two columns with the same id. (i.e., the system won’t know in which column it should store the data)
You do not have to manually add custom fields from the custom field doctype. From the customize form itself you can create your fields and they will be added automatically to the custom fields doctype.
Again, in the same doctype you cant have two fields with the fieldname ‘width’, each field must have a unique name. However, you can set the label to whatever you want.
You can create a child doctype and have the following
Type (Select): Sticker / Backer / Gift / Card
Width (Float)
Height (Float)
Depth (Float) — optional depends on type
Any other parameter
Then you can use this as a child table in the Items doctype where you add rows based on the types
However keep in mind that you can not nest a child table within a child table (i.e., you can not have the same table in ‘Invoice Items’ or ‘Quotation Items’)
I tried to create the fields from Customize Form and that’s when I hit the problem because it doesn’t differentiate between Width in column Sticker sheet and Width in column Backer sheet.
Can you clarify your comment about not nesting a child table within a table? I don’t quite understand the relevance (newbie).
When creating a field at the field properties sidebar assign a value to the fieldname for example sticker_width and then the label can be anything like ‘Width’
Regarding child tables, a standard doctype can hold as many child tables as needed by a doctype of type child cannot have child tables inside it (childtable within a childtable)
So in the Item doctype you can add our custom child table since it is a standard doctype.
Now for example inside the Sales Order doctype there is a child table called Sales Order Items where you enter the item code and the other fields are automatically fetched.
Now in this ‘sales order items’ you cannot add a child table. Meaning, you cannot pass the data from the child table in the items doctype to your invoice.
Anyhow, create a field and call it “Sticker Width” save the customization it will automatically assign to it the name custom_sticker_width then you can change the label back to “Width”
Replying to my own post because I see that I can’t edit field names in upstream DocTypes e.g. Item, even if I add custom fields. However I can edit field names in a DocType that I have created myself (“Print Colour Configuration”).
Is this something to do with not having Developer Mode on? Developer Mode is not configured in our instance but I don’t think it should be because we’re not creating a vanilla Frappe app, we’re using and customizing ERPNext.
What should we do about this? As you can see from the screenshots below, it won’t let me add the second “Print Colour” on the right because there’s already a Custom Field called “Item-custom_print_colour” (even though I renamed it to custom_sticker_print_colour, the ID doesn’t change even though the Fieldname does).
I would have thought this would be much easier, we’re just getting started.
You have renamed the field but the custom field doc id has not changed. Delete those custom fields and try again with the correct naming from the beginning.
If you need some guidance on AnyDesk pm me, ill walk you through it and how to properly do customizations