I have 2 doctypes, one links to the other. For example: The doctype “Site Component” links to “Site”. In doctype “Site Component”, if I only declare a Link field which points to doctype Site, on the detail form, after selecting a site, the field will show the site primary key. That’s make our users impossible to know what site it is.
I follow this guide to add another read-only field, called site_name into doctype “Site Component”. And configure it to fetch site.site_name
which is the title of that a Site.
That works, but creates another problem. Since the read-only field is a denormalized field added to table tabSite Component
. When the corresponding Site changes its site name (title), the denormalized field in table tabSite Component
is not updated which leads to data inconsistency.
Currently, I solve it by updating the denormalized field in table tabSite Component
when never a Site changes its title.
Is that the correct frappe way to handle this case?