Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to debug access permissions

Subscribe

Get notified when there's activity on this post

This question has been flagged
4 Replies
7538 Views
Avatar
Hunter Pavers

Created a sale order

A user with Inventory Manager and Sale Manager access levels tries to confirm sale order quotation.

An error message appears:

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: stock.location, Operation: read)


Why? Where? How?
Which model? Which group?
How can I find which access permission is missing? How can I debug it?
Thanks in advance.

0
Avatar
Discard
Avatar
Hunter Pavers
Author Best Answer

So here is how I debugged the problem, what was the problem and the way I solved it.
When Odoo nags about access permission it is very cold! There is just a dialog saying that you cannot access a model and that you have to contact the Administrator and if you're the administrator, you gonna' have hard times once your colleagues come to you just to find you clueless about source of the problem.
This is how I debugged it:
I modified the file ./models.py in root folder of Odoo to add traceback and variable dump functionality to it. As I was using official docker image of Odoo I had to modify my docker file to make odoo installation folder writable:

RUN chmod a+rwx -R /usr/lib/python2.7/dist-packages/odoo \

    && apt-get update && apt-get -y install vim

And to add the vim. Later I modified:
     /usr/lib/python2.7/dist-packages/odoo/models.py
And here is the diff:
29d28

< import traceback

3172,3175d3170

< _logger.info('HERE!')

< _logger.info(vars(self))

< for line in traceback.format_stack():

< _logger.info(line.strip())
Looking into traceback and vars output told me that the issue is happening due to trying to access a location with some ID.
What was the probem?
Looking into database I found the root cause. Some incompetent personnel of us couldn't do something easy in Odoo so desparately went to warehouse configuration and tried to change anything he could find by random, including changing parent location of locations, etc. so messed with our whole inventory system. In our case an old and archived location was set as parent location of 'Physical Location' therefore rendering all physical locations useless!
How I solved the issue?
Pretty much reverted his changes through database tables.


Conclusion

The access permission error message is pretty useless and just sends employees to administrators. The log output of server doesn't help either. Adding a traceback and vars output to log output helps a lot. I grep'ed the whole source tree for the error message to find that the error is happening in two places within models.py and added traceback and vars output to one of them so I was able to solve the issue.
Thanks.

1
Avatar
Discard
Avatar
Niyas Raphy (Walnut Software Solutions)
Best Answer

Hi Aario,

First of all you have to check which user group is currently logged in, ie whether user in sales or manager in sales like that.

Then here in the warning message it is shown that there is no access permission for the model 'stock.location' . So what you have to do is,

Activate the developer mode, then go to Settings -> Users -> Groups , then select the corresponding group and add the model in the access right tab(if it is not there ), with required permission such as read, write, delete and create.


Thanks

1
Avatar
Discard
Hunter Pavers
Author

Thanks for the reply. I checked the user is member of both Sales Manager and Inventory / Manager and for both groups read permission was already granted for stock.location model. I granted all permissions for this model yet it's not possible to confirm a sale order and same error happens. Any idea is highly appreciated.

Hunter Pavers
Author

Actually no user other than administrator itself can confirm a sale. Even users with all the permissions granted even administration settings.

Niyas Raphy (Walnut Software Solutions)

on clicking the confirm button you getting the above warning message ?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now