This question has been flagged

Hi members,
How can i restrict creating more than 5 user under a company.Number of users may vary in different companies
Like,

ComapnyA :maximum users=5

CompanyB: maximum users=2

Please help


Avatar
Discard
Best Answer

Hi fasluca,

To restrict the number of users per company,

1) You can create a configuration field in the company (res.company) which stores the maximum number of users allowed in the company.

2) Next, override the create method of Users model (res.users), to check the number of users in a company and if it already the limit is reached then raise a warning.


To learn how to override a create method please refer,

http://odootechnical.com/learn-overriding-create-method-in-odoo-8/


Hope this helps,

Thank You.

Avatar
Discard
Author

can i use ir.rules for this?

No. You cannot use ir.rule. ir.rule is used to create record rules. Your above-mentioned situation cannot be achieved by record rule.