I create doctype “Vendors” ,and I want to use this doctype in purchase invoice for example Specifically on supplier field , but supplier field contain one option “supplier” .
I created field “is vendor” Type “Check”, to fetch vendors in supplier field, But it’s no use
First, you should update the “supplier” field in the Purchase Invoice doctype to be linked to the “Vendors” doctype instead of the default “Supplier” doctype.
Next, the set_query function needs to be called on the supplier field, not on the is_vendor field.
Yes, it is possible to use both “Vendors” and “Supplier” in a Purchase Invoice. You can modify the “Supplier” field to allow it to fetch values from both the “Supplier” doctype and the “Vendors” doctype.
I think creating new doctype for vendor is not good way to handle this scinario
You can create one dropdow(select field ) in supplier master with options (Supplier, Vendor)
then you have to do vendor entry in supplier master only
that way you can use both in supplier field in purchase invoice and this way it’ll not break erpnext internal flow which base on Supplier master
Make sure that your custom query in the filter_purchase_invoice module is returning the correct data. You can test this by running the query directly in the database or using the bench console command to test it in the Frappe shell.
Double-check that the supplier field is of the correct type and has been linked to the Vendors doctype. You can do this by going to the Purchase Invoice doctype in the Frappe Desk, clicking on the supplier field, and verifying that the Options field is set to Vendors.
Check that there are no errors in the browser console when you try to select a vendor. Open the browser console (usually by pressing F12) and try to select a vendor. If there are any errors in the console, they may provide a clue as to what is going wrong.
Try removing the is_vendor filter from the set_query function and see if you can select any vendors at all. If you can, then the problem may be with your filter. If you still can’t select any vendors, then the problem may be elsewhere in your code.
Finally, consider adding some debug statements to your code to help you identify where the problem is. You can use the console.log() function to output messages to the browser console, which can help you track the flow of your code and see where things are going wrong.