Same field in list view 3 times (how to really change the name of 'name' / hide name from list view?)

image

If I want to have the ‘name’ of a document be based on something like “Truck VIN”, I can create a field truck_vin, and then have the naming for the doctype be based on that field:truck_vin.

Great! That all works fine.

But if I want to have a <th> in the list view with “Truck VIN” instead of “Name” then I have to add the “Truck Vin” field to list view settings.

However, since “name” is not removable from the <th>list, the following columns are shown when I only want a single column…

Name | Truck Vin | Name

(all 3 fields being the same thing).

That’s silly.

Why is “Name” being repeated at as the last <th> anyway? Isn’t one forced non-removable “doc.name” field enough?

Questions…

    • Is it possible to change the label/display name of name field? (for list view table header)
    • Is it possible to remove the repeating ‘name’ field at the end of the list view?

Here’s the example in images:

image

image

image

image

1 Like

Here’s what you’re looking for. You also want to set the Title field to ‘Truck VIN’

1 Like

Thanks… setting title field alone gets it down to 2:

Are you self hosting or on erpnext.com? I don’t think there’s a way to implement the solution via a custom script.

self hosting

rmehta basically said:

If you want to hide the field, add a truck_list.js file and set a property hide_name_column: true

I need to do this in terminal/command line?

  1. Check if you’re in developer mode (developer_mode: 1 in /yoursite/site_config.json)
  2. Sign in as the Administrator
  3. Make sure your Truck doctype does not have the ‘Custom’ box checked
  4. Navigate to bench/apps/your_app/the_module/doctype/truck/
    4a. If you haven’t created your own app, you should to save your customizations. Follow the instructions in bench new-app. Make sure you install it after you create it (bench install-app your_app)
    4b. The tutorial is absolutely worth your time and will save you days of frustration starting in the near future.
  5. Create a truck_list.js file
  6. Paste in the following code:
frappe.listview_settings['Truck'] = {
    hide_name_column: true
}

6a. Refresh the Truck list view.

You may need to flip the order of 3 and 4 depending if you’ve created your app already or not.

Thanks! I will try this in a couple hours.

Why should it not be custom? I think it is.

Also, I created a module def for something like “Truck Entry” so I could isolate this doctype and form/entry to specific users.

‘Custom’ in this context means that the definition for this doctype will only exist in the database and that schema for it will not be saved with the application. If you want to have any business logic associated with Truck (it is very likely you will), you are better off using the scaffolding Frappe provides.

Sorry… still not clear to me. “will not be saved with the application” Will I lose data? or records of trucks if [x] custom is checked?

Using the scaffolding frappe provides = unchecking doctype custom?

Before responding I tried to read about this [x] custom elsewhere too, but it’s confusing what it actually does. I think for all of my doctypes that I created, I selected custom because I thought it was custom.

This field is poorly labeled. Frappe is designed so that your custom doctype can exist only in your database or you can associate it with your application. By using an application you gain version control over your app.

Using the scaffolding frappe provides = unchecking doctype custom?

Yes. Frappe will create all the files you would need to execute logic around your doctype. This allows you to keep your changes in version control, which is the tooling you need to use if you want to have multiple instances of your app (development and production, for instance).

I think you can also try custom script for list views.

https://www.youtube.com/watch?v=PmdYzIX2mjA