How to make linked document from doctype that have field link to another?

I have 2 doctype

  1. Kelas
  2. Siswa (with field kelas (linked to Kelas doctype)

on Kelas doctype i successfully create linked doctype to Siswa doctype, like this picture below:
image

My question is, how to make same Linked Document but from Siswa Doctype to Kelas Doctype, so i can click what Kelas is Siswa linked too, i try like this picture below:

But when i click Kelas (on connection bar on Siswa Doctype), its redirect too Kelas Doctype with filter nama equals too siswa name, that must be nama equals too kelas from Siswa Doctype field is the correct

Thank you.

Name is the primary key in Frappe doctypes, and as far as I’ve seen, your link seems wrong. Please check this for reference.

That’s good example, from that example
Lead have Linked Document to Special Lead, and its work.
But my true question is, how to make Linked Document from Special Lead to Lead, not from Lead to Special Lead. So i know what Lead that Special Lead is Linked.

I try to use this code but didnt work

from frappe import _

def get_data():
    return {
        "fieldname": "kelas",  # Nama field default di dokumen Kelas
        "non_standard_fieldnames": {
            # Mendefinisikan koneksi non-standar, karena filter harus berdasarkan siswa.kelas
            "Kelas": "kelas"
        },
        "transactions": [
            {
                "label": _("Kelas"),
                "items": ["Kelas"]  # Dokumen Kelas yang terkait
            },
        ]
    }

Add a “Special Lead” field to the Lead DocType, and then add links to Special Leads in the Special Lead DocType.