Can we set limit for a doctype


I need to know if we can set limit for doctype or not. I tried to set limit for company in site_config.json but its not working.
Kindly help, thanks!

1 Like

@Jenisha Limit in respect to what exactly you want ?

@Jenisha try this custom app:

Hi @Mohammed_Redha

What does this custom app do?

Its for limiting a site, for example to have only two companies.

Thank you! will try this.


What are the possible limitations once can apply?

You can limit users, company etc. Will try and confirm.

I tried installing that app in my bench , got the below error,

I gave the below command, not sure what went wrong

bench get-app Restriction/restriction at master Β· maisonarmani/Restriction Β· GitHub

Gotta include the app name when installing :slight_smile:

@Jenisha Try this:

bench get-app

I tried the same command, still got the below error,

INFO:bench.utils:./env/bin/pip install -q -U -e ./apps/restriction
ERROR: Command errored out with exit status 1:
command: /home/frappe/frappe-bench/env/bin/python3 -c β€˜import sys, setuptools, tokenize; sys.argv[0] = β€˜"’"’/home/frappe/frappe-bench/apps/restriction/setup.pyβ€™β€œ'β€β€˜; file=β€™β€œ'β€β€˜/home/frappe/frappe-bench/apps/restriction/setup.pyβ€™β€œ'β€β€˜;f=getattr(tokenize, β€˜"β€™β€œβ€˜openβ€™β€β€™β€œβ€˜, open)(file);β€™β€β€˜"’\r\nβ€™β€œ'β€β€˜, β€˜"’"’\nβ€™β€œ'β€β€˜);f.close();exec(compile(code, file, β€˜"β€™β€œβ€˜exec’”’"β€˜))’ egg_info
cwd: /home/frappe/frappe-bench/apps/restriction/
Complete output (5 lines):
Traceback (most recent call last):
File β€œβ€, line 1, in
File β€œ/home/frappe/frappe-bench/apps/restriction/”, line 3, in
from pip.req import parse_requirements
ImportError: No module named β€˜pip.req’
ERROR: Command errored out with exit status 1: python egg_info Check the logs for full command output.

Hello @Jenisha, Any progress in this, did you find the way to limit the company in one site?

Nope, u can see the error above. I am using frappe docker for local site, not sure why i am getting this error. I will try and update.

@Jenisha What ERPNext version are you using?

Its 12.3.1