How to check whether admin or user is logged in odoo

AKHIL MATHEW

Currently i am developing a module in odoo. In my module users can edit there own data only, but admin can do anything. But with my code admin also can't edit. If i know admin is logged in, then i can bypass admin account. So how to know when admin is logged in?

def write(self, vals):
    //if admin is logged in i need to bypass the below code//
    if self.create_uid != self.env.user:
        raise Warning('You can not able to edit this document as this is not your record')
    return super(request_room, self).write(vals)
JordyRitzen

You'd want to use the super_user (admin) id. Probably the id = 1 The code below would do the trick.

from openerp import SUPERUSER_ID
def write(self, vals):
    //if admin is logged in i need to bypass the below code//
    if self.create_uid != self.env.user and self.create_uid != SUPERUSER_ID:
        raise Warning('You can not able to edit this document as this is not your record')
    return super(request_room, self).write(vals)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

how to check whether user is logged in or not

From Dev

how to check whether user is logged in or not

From Dev

How to check if currently logged in user is admin or not

From Dev

laravel 4.2 How to check whether any user is logged in multi auth

From Dev

How to apply check in jsp whether current user is logged in or not

From Dev

How to check whether the logged-in user is interactive or idle in wpf application

From Dev

In a theme, how can you check if a user is logged in or is "admin"?

From Dev

In a theme, how can you check if a user is logged in or is "admin"?

From Dev

Laravel 5 check whether a user is logged in

From Dev

Proper Filter implementation to check whether user is logged in or not

From Dev

How to check if a user is logged in

From Dev

Joomla: How to check if admin is logged in

From Dev

PHP function to check whether a user is admin or not

From Dev

How to check if user is logged on, Not Member?

From Dev

Magento how to check if Admin is logged in (Frontend)

From Dev

Check whether the user is already logged in using Auth.GoogleSignInApi?

From Dev

How to keep the user logged in or check if the user is logged in or not in Shopify?

From Dev

In C# how to stop/start/check whether registered or not if the Log On As account is of non-admin user?

From Dev

C# Check if Current Logged on user is Admin (Remote Machine)

From Dev

How I check if the user is an ADMIN

From Dev

How to check logged user in liferay velocity?

From Dev

How to check if current user is logged in android

From Dev

How to check a list of user either it is logged in or not?

From Dev

CakePHP 3: How to properly check if a user is logged in

From Dev

How to check if user is already logged into instagram

From Dev

How can I check if a user is logged in in Symfony?

From Dev

How to check if user is logged in at custom page in Opencart

From Dev

How to check if current user is logged in android

From Dev

How to check if a user is logged in and if not redirect to the login screen

Related Related

  1. 1

    how to check whether user is logged in or not

  2. 2

    how to check whether user is logged in or not

  3. 3

    How to check if currently logged in user is admin or not

  4. 4

    laravel 4.2 How to check whether any user is logged in multi auth

  5. 5

    How to apply check in jsp whether current user is logged in or not

  6. 6

    How to check whether the logged-in user is interactive or idle in wpf application

  7. 7

    In a theme, how can you check if a user is logged in or is "admin"?

  8. 8

    In a theme, how can you check if a user is logged in or is "admin"?

  9. 9

    Laravel 5 check whether a user is logged in

  10. 10

    Proper Filter implementation to check whether user is logged in or not

  11. 11

    How to check if a user is logged in

  12. 12

    Joomla: How to check if admin is logged in

  13. 13

    PHP function to check whether a user is admin or not

  14. 14

    How to check if user is logged on, Not Member?

  15. 15

    Magento how to check if Admin is logged in (Frontend)

  16. 16

    Check whether the user is already logged in using Auth.GoogleSignInApi?

  17. 17

    How to keep the user logged in or check if the user is logged in or not in Shopify?

  18. 18

    In C# how to stop/start/check whether registered or not if the Log On As account is of non-admin user?

  19. 19

    C# Check if Current Logged on user is Admin (Remote Machine)

  20. 20

    How I check if the user is an ADMIN

  21. 21

    How to check logged user in liferay velocity?

  22. 22

    How to check if current user is logged in android

  23. 23

    How to check a list of user either it is logged in or not?

  24. 24

    CakePHP 3: How to properly check if a user is logged in

  25. 25

    How to check if user is already logged into instagram

  26. 26

    How can I check if a user is logged in in Symfony?

  27. 27

    How to check if user is logged in at custom page in Opencart

  28. 28

    How to check if current user is logged in android

  29. 29

    How to check if a user is logged in and if not redirect to the login screen

HotTag

Archive