Add Parent column in Search Field

Hi All,

I would like to add the parent field of a doctype record to its search fields. How can I do that?

can you please give an example?

i have category and many subcategories.
when i use sub category as a link field, as the names of subcategory is listed in bold. i want to display the category names also below it in small letters. :grin:
subcategory is a child table

Or tell me how i can find the parent field (the parent table key) before i save the child table rows.

I have invoice (parent table) and bill items(child table) table.
invoice number is the naming field for invoice
in i wrote

def autoname(self): = self.parent+"/"+self.bill_item_name

expecting the name to be invoice_number/bill_item_name. (eg- inv2098/green_basket)
but i got “New Invoice 1/green_basket”.

So when the form is not saved, parent field is having value “New Invoice 1”
how can i get inv2098?
How to know the name(id) of a new record before its saved?