Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

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

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
many2onerefreshbooleanrelated_fieldsinherit_res.partner
4 Risposte
7707 Visualizzazioni
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
Abbandona
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
Autore

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
Autore

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

Avatar
bernardo.knackfuss@gmail.com
Autore Risposta migliore

Still need an answer

0
Avatar
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
Write to Record in Related Field of Many2One Relationship
many2one related_fields
Avatar
0
mag 15
7392
Send a value from context one2many
many2one related_fields odoo15
Avatar
0
mag 24
1935
Related field not found while trying to set up a One2many field. Risolto
many2one one2many related_fields
Avatar
Avatar
Avatar
2
ott 23
3288
Refresh a view form with many2one relation. How to achieve that?
many2one refresh odoo12.0
Avatar
Avatar
1
set 21
6358
Product variant is also product (odoo 14) Risolto
product many2one related_fields
Avatar
Avatar
1
mar 21
2873
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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