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

[Odoo 10] List all records of another module in a view (or just copy it over)

Subscribe

Get notified when there's activity on this post

This question has been flagged
many2onerefreshbooleanrelated_fieldsinherit_res.partner
4 Replies
7695 Views
Avatar
bernardo.knackfuss@gmail.com

Hello,


I'm having a little trouble on how to display a list of all my ecommerce users inside a tree view in my custom module.

Objectives:

  1. Add a boolean field associated with my ecommerce users that will dictate if they are 'authorized' or not.

  2. The backend user should have access to a list of all users and should be able to authorize or deauthorize them easily.

  3. I will later modify my website templates to check wether the current user has 'authorized' set to True or not.

                

I thought about inheriting the 'res_users' model and start from there, but i'm not sure it would work (or be the best solution).

An even worse solution would be to copy all users records to my custom module and display the copies in the backend control panel view (to modify the authorization boolean), and then in the templates check for the custom module boolean field instead of a res_users boolean directly.

What i think would be cleaner would be to 'link' all user records to my module through a related field and then display them all in the module form view to serve as the control pannel.

What i can't manage to do is to make the view display all the records automatically (when the user clicks in the control panel i want a full list of users to be displayed)

This is what i got so far:


class AuthorizedUsers(models.Model):
_name = "auth_users"

user_id = fields.Many2one('res.users')
login = fields.Char(related='user_id.login')
is_authorized = fields.Boolean(String="Usuário Autorizado", default=False)


and this is the tree view:

<record model="ir.ui.view" id="user_auth_panel_tree">
<field name="name">user_auth_panel.tree</field>
<field name="model">auth_users</field>
<field name="view_type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="login"/>
<field name="is_authorized"/>
</tree>
</field>
</record>


How can i list every res.user's login automatically in my tree view and attach a boolean to them?

Thanks.


0
Avatar
Discard
Ray Carnes

Are you trying to hide pages for certain users? Did you consider putting them into groups and configuring certain pages to only be visible to a specific group? <t groups="xxx.yyy" ... />

bernardo.knackfuss@gmail.com
Author

Ray, thats exactly what i want to do. Using the Qweb groups tag did not worked for me tough. I wanted to use a solution like this so the backend user can manage the portal users permissions more easily and also so i can learn more about the API

bernardo.knackfuss@gmail.com
Author

Also, i'm trying to hide content within the pages, and not necessarily whole pages

Avatar
bernardo.knackfuss@gmail.com
Author Best Answer

Still need an answer

0
Avatar
Discard
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
Related Posts Replies Views Activity
Write to Record in Related Field of Many2One Relationship
many2one related_fields
Avatar
0
May 15
7387
Send a value from context one2many
many2one related_fields odoo15
Avatar
0
May 24
1926
Related field not found while trying to set up a One2many field. Solved
many2one one2many related_fields
Avatar
Avatar
Avatar
2
Oct 23
3285
Refresh a view form with many2one relation. How to achieve that?
many2one refresh odoo12.0
Avatar
Avatar
1
Sep 21
6357
Product variant is also product (odoo 14) Solved
product many2one related_fields
Avatar
Avatar
1
Mar 21
2873
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