Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Record permission

By
moh
on 11/2/16, 6:06 AM 107 views

I want to define number of user can admin create 
ex: admin can create only 5 users 


if its impossible i want to define rule to create number of records in any table 

please i neeeed help

0
shameem@aχoncoms
On 11/2/16, 7:31 AM

Same question asked by Ahmad safi

I answered him following 

You create a model having 2 fields user_id(Many2one, unique) and user_creation_limit(integer).

That may have tree view and form view.

Then override the create method of res.users

@api.model
def create(self, vals):
    # Calculate this user is eligible to create
    # using self._uid
    # by fetching list of all users and their created user id(create_uid )
    if eligible:
        return super(ModelName, self).create(vals)
    else:
        raise UserError(_('Your limit is exceed'))


 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/2/16, 6:06 AM
Seen: 107 times
Last updated: 11/2/16, 7:31 AM