Restrict Items, Customers, and Suppliers to companies
Version 17
This feature is in ERPNext version 17, which is in development. ERPNext version 16 does not have it.
On a site with many companies, Items, Customers, and Suppliers are shared by all companies. A company restriction limits one of these records to the companies that you list. ERPNext blocks the record in every other company. Use it, for example, for a product that only one company sells, or a supplier that only one company buys from.
Prerequisites
The Company Restrictions section is at permission level 1. Only these roles can see and change it:
| Document | Role |
|---|---|
| Item | Item Manager |
| Customer | Sales Master Manager |
| Supplier | Purchase Master Manager |
Other users do not see the section. When they save the record, ERPNext keeps the restriction as it was.
Restrict a record
- Open the Item, the Customer, or the Supplier.
- Go to the Company Restrictions section.
- Select Restrict to Companies.
- In Allowed Companies, add one or more companies.
- Save.
Allowed Companies shows only the companies that you can access. If you have a user permission on Company, you cannot add or remove a company outside it.
If you clear Restrict to Companies, ERPNext empties Allowed Companies.
What the restriction does
| Where | Effect |
|---|---|
| Saving a transaction | ERPNext checks every Item, Customer, and Supplier in the document and its tables. If one is restricted and the company of the document is not allowed, the save fails. This covers all documents with a company field, such as Sales Order, Purchase Invoice, Stock Entry, Material Request, BOM, and Pricing Rule. |
| Selecting a party | When you select a restricted Customer or Supplier in a transaction, ERPNext shows the error at once. |
| Searching in a transaction | Item, Customer, and Supplier searches in sales and purchase documents hide the records that the company cannot use. Other searches show all records, but the save check still applies. |
| Lists and reports | Only users with a user permission on Company see filtered lists. They see a restricted record only if one of their companies is allowed, and cannot open it otherwise. Users without that user permission see all records. |
Limits
- The check runs when you save. A submitted document stays valid after you change the restriction, and you can still cancel it.
- An amended document is checked again. The amendment fails if the restriction now blocks its company.
- The restriction does not disable the record. It stays active in its allowed companies.
Troubleshooting
| Message | Cause | Fix |
|---|---|---|
| Allowed Companies is required when Restrict to Companies is checked | The check box is selected and the list is empty. | Add a company, or clear the check box. |
<document> <name> cannot be used with Company <company> because of Company Restrictions | The document uses a restricted record in a company that is not allowed. | Remove the record from the document, or add the company to Allowed Companies. |
You are not permitted to add or remove Company <company> in Allowed Companies | Your user permission on Company does not include that company. | Ask an administrator to change the list. |