Skip to Content
Menu
This question has been flagged

I have inherited 'res.users' and added some custom fields.

class ResUsers(models.Model):
_inherit = 'res.users'

start_date = fields.Date(string='Start Date')
renew_date = fields.Date(string='Renew Date')

I want to create a new tree view under a new menu with these custom fields(start_date, renew_date, login, name) without modifying the existing view. My current code tree view.


        users.view.inherit
        res.users
        primary
       
           
               
               
               
               
           
       
   

Using the above xml still overrides the existing view, more specifically the 'users' - many2many field in res.groups and it's corresponding view with ID view_groups_form in base.action_res_groups action.


Is there anyway to not override the above view_groups_form users many2many view?


Thanks for the help

Avatar
Discard
Author

here's the xml code:
<record id="users_view_inherits" model="ir.ui.view">
<field name="name">users.view.inherit</field>
<field name="model">res.users</field>
<field name="mode">primary</field>
<field name="arch" type="xml">
<tree delete="0">
<field name="login"/>
<field name="name"/>
<field name="start_date"/>
<field name="renew_date"/>
</tree>
</field>
</record>

Best Answer

Hello @Rithik Sandron


To create new tree view without making changes in original tree view, you can use this code.

Please find code in comment. 

Thanks & Regards,
Email:  odoo@aktivsoftware.com   

Skype: kalpeshmaheshwari

Avatar
Discard

Please find code here :-

<record model="ir.ui.view" id="view_tree_res_users">
<field name="name">res.users.tree.</field>
<field name="model">res.users</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="login"/>
<field name="name"/>
<field name="start_date"/>
<field name="renew_date"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="res_users_configure">
<field name="name">Users Tree View</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.users</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_tree_res_users"/>
</record>

Author

Thank you for the response @Jainesh Shah. I tried the code you provided. It unfortunately did not work. The view still gets overridden.

Related Posts Replies Views Activity
1
May 23
3541
0
Dec 23
1359
2
Aug 23
3688
3
Nov 24
3937
2
Jul 23
3100