How to fetch 'title' from Project in stead of 'name'


I wanted to fetch the Project title in other doctypes. But as far as I get I can fetch the name or any other field from the Project DocType, but not the name.

For example, the custom script I’m using to fetch data to a Sales Order when adding a Sales Order from a Project is this:

frappe.ui.form.on('Sales Order', {
    refresh: function (frm) {
        // Fetch the project name from the Project field
        var project_name = frm.doc.project;

        // Set the field quotation_reference value to the project name
        frm.set_value('quotation_reference', project_name);

This returns the Project Name, in our case that is an automatically generated number based on the naming_series, like P-10456

A project has also a Title based on the field ‘project_name’ but when you want to change that Title - for better human readability - the field to change it is not called ‘project_name’ but ‘title’.

That is the exact value I want to fetch, but as this ‘title’-field is not an actual Field that can be found in the DocType Customization, I can’t use this in the var like var project_name = frm.doc.title

when looking deeper in to it I’ve found requests for this on Github:

ending up on this page:

I’m on Version 13 so I’m missing something here… as there is no option for ‘Show Title in Link Fields’

On the other hand that would change te overall behaviour of ERPNext, and currently, that is not what I want.

I’m thinking of adding a custom field to the Project DocType that gets automatically filled in with the value from Title. I think I need a server script in combination with a custom script for that, but as I can’t wrap my head around where to get the actual ‘Title’-data, I’m not getting anywhere for the moment. So any insight or help would be really appreciated!