Restrict a supplier/customer from transacting with one of my company

Hi,

How can one restrict a supplier/customer from transacting with one of my company
Suppose I have 2 company X and Y supplier A should one be able to transact with company X

2 Also is there any way I can hide some suppliers from a particular set of users?

To restrict a Supplier or Customer from transacting with a specific Company in ERPNext, here are two ways you can manage it:


:white_check_mark: 1. Restrict Supplier/Customer to a Specific Company

By default, ERPNext allows you to associate a Supplier or Customer with a Company using the “Default Company” field on their form. However, this is just a default—it doesn’t stop users from using that party in another company.

To strictly enforce the restriction, you can use User Permissions:

  • Go to Settings > User Permissions
  • Add a new permission for the Customer or Supplier
  • Choose the party (e.g., Supplier A)
  • In the “Applicable For” field, choose the target transaction (like Purchase Order)
  • Set it to be only visible for users working with Company X

This way, users won’t be able to select Supplier A while working in Company Y.


:white_check_mark: 2. Hide Some Suppliers from Specific Users

You can hide or limit access to specific suppliers for certain users by:

  • Using User Permissions to allow only certain suppliers for specific users.
  • Combine this with Role Permission Manager if needed, to further restrict access based on user roles.

This ensures users see only the suppliers they are allowed to work with.

@DakshKothari18
Do you have some experience with Server Script/ Client Script?
using script you can add a validation on Purchase Order, Receipt, Invoice

https://docs.frappe.io/framework/user/en/desk/scripting/client-script