[Odoo 10] List all records of another module in a view (or just copy it over)
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.
Add a boolean field associated with my ecommerce users that will dictate if they are 'authorized' or not.
The backend user should have access to a list of all users and should be able to authorize or deauthorize them easily.
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:
_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="arch" type="xml">
How can i list every res.user's login automatically in my tree view and attach a boolean to them?