ERPNext Conference 2019* Blog

Frappe Hack: Links using related title, instead of name


@JoEz I fixed the issue with the List View

But my account is blocked by github, for the next hours!

When I can login again, I’ll publish it!

Another point! I believe that keep it in a separated app, is more organic, due the developers can address your issues related with it, to me, instead of the frappe or erpnext issue list.


@max_morais_dmm i think u r right …is better to have it as a separate app …

btw i’ve got an error while installing …

bench get-app title_links app title_links
Cloning into 'title_links'...
remote: Counting objects: 45, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 45 (delta 12), reused 45 (delta 12), pack-reused 0
Unpacking objects: 100% (45/45), done.
Checking connectivity... done.
installing title_links title_links
Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 79, in <module>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 12, in main
    commands = get_app_groups()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 20, in get_app_groups
    for app in get_apps():
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 76, in get_apps
    return frappe.get_all_apps(with_internal_apps=False, sites_path='.')
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 691, in get_all_apps
    apps = get_file_items(os.path.join(sites_path, "apps.txt"), raise_not_found=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 820, in get_file_items
    content = read_file(path, raise_not_found=raise_not_found)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 835, in read_file
    from frappe.utils import cstr
ImportError: cannot import name cstr
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/", line 40, in cli
  File "/usr/local/lib/python2.7/dist-packages/click/", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/", line 28, in get_app
    get_app(name, git_url, branch=branch)
  File "/home/frappe/bench-repo/bench/", line 60, in get_app
  File "/home/frappe/bench-repo/bench/", line 144, in build_assets
    run_frappe_cmd('build', bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/", line 499, in run_frappe_cmd
    raise CommandFailedError(args)
bench.utils.CommandFailedError: ('build',)

Another small thing, looking at your code it call subscription app …probably is better to give a “definitive” name :grin:


@JoEz thanks to report! Is fixed now!

Try install again!


Will try this too as soon as I can and report back.

Maybe we can work together on this if you like treating the Links with the UI like Attachments.

Thank you very much for your hard work.


@Pau_Rosello, I understood that this is your requirement, but is not the same of mine :frowning:, We can work together in global issue, like the reports that still pending!


@max_morais_dmm installed …:grinning: :grinning: …it seems to be working … :grin: i can remove all add_fetch from custom script … :sweat_smile:

Edit: It seems i got an javascript error :

TypeError: callback is not a function. (In 'callback()', 'callback' is undefined)

Edit 2: i’ve removed ur app and all is back working …


@JoEz where is this error?




  • /home/frappe/frappe-bench/apps/frappe/frappe/public/js/frappe/assets.js

    eval_assets: function(items, callback) {
    for(var i=0, l=items.length; i<l; i++) {
    // execute js/css if not already.
    var path = items[i];
    if(frappe.assets.executed_.indexOf(path)===-1) {
    // execute
    frappe.assets.handler[frappe.assets.extn(path)](frappe.assets.get(path), path);
    callback(); <–

It seems some kind of conflict with erpnext code …


@JoEz are you using v7?


yup v7 …at least the develop branch


@max_morais_dmm FYI, problem is in


I’ve commented out:


from title_links.js and it’s working properly. Not sure where is the error …


@JoEz without this you will have issues in list view!

I’m not using v7, so I’m unable to fix it for now!


@max_morais_dmm yes, but actually i prefer to have the issue in the list view …instead of not having it working at all …


@max_morais_dmm …i’ve got a little bug on Sales Invoice in the Customer Link …Customer name doesn’t show as main option in bold in the search box, main is Territory.

Is that correct?

Edit: I think the problem is in the search fields …whathever search field I put it keeps the 3 by default: territory, customer_name, customer_group …


@JoEz Check the title_link of your doctype it’s needed!


@max_morais_dmm …got the problem …it’s due because of this:


@JoEz, you are right! ERPNext use some fixed queries for some fields, like Customer!


@max_morais_dmm …i didn’t know that …actually i’ve changed the query file …but next update will change again …do u know a nice way to modify it?


@JoEz, nope!


@max_morais_dmm thx anyway :wink: