Fetch Supplier in Purchase invoice from more then one field

By default the Supplier on a Purchase Order/Invoice is fetched from the supplier_name field I believe.

In my usecase there is an additional supplier_code field in the supplier DocType which is much more commonly known to employees then the actual name.

So what I would like to achieve is that you can find a Supplier on a Purchase Invoice also by typing part of the “Supplier Code” in the “Supplier” field.

i.e.
Supplier name = United Fruit Co. Ltd.
Supplier Code = UF2022

so I should find the Supplier by either typing "United Fruit ..." or "UF20 ..." in the “Supplier” filed on a Purchase Invoice.

Can anyone advise how to approach this?

Hi,
Have you tried adding the field at “Search Fields”?

1 Like

That came to my mind as well especially as the supplier_group is visible when you get the list of recommendations when you type in anything on the Supplier field.

However it apparently does not support to be used as a search term. For example if you type "Other" as a search term (with an existing supplier_group named` “Other”) you would not be recommended with all Suppliers within that group.

I just remember that I tried something similar time ago…

Maybe you can find the solution.

I’ll see whether I can draw anything from that.
I understand the solution that worked for you for that usecase was this, right?

The thing is that at that time result that the filter seems that doesn’t work with any field…

Work on item_group

But the same script didn’t work with customer_group

Hope you find a better solution.