Odoo Help


How to add extra field in users (like notify_email) and show in User Preferences then make it WRITEABLE_FIELDS for all user??

Amit Kumar
on 5/30/16, 6:34 AM 970 views

Here is my code :

I have added to two fields in res.users and shown in User Preferences view but still these fields are readonly. How to make these fields WRITEABLE_FIELDS for all users??

#####Python Code#######

class res_users(models.Model):

    _inherit = 'res.users'

    notify_sms = fields.Boolean(string='Receive Notification by SMS')

    mob_number = fields.Char(string="Mobile Number")

     def __init__(self, pool, cr):

            """ Override of __init__ to add access rights on notification_email_send and alias fields. Access rights are disabled by                      default, but allowed  on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS."""

            init_res = super(res_users, self).__init__(pool, cr)



            return init_res


<?xml version="1.0" encoding="utf-8"?>



<record id="add_to_user_preferences" model="ir.ui.view">

<field name="name">Inhetitance In Preference</field>

<field name="model">res.users</field>

<field name="inherit_id" ref="base.view_users_form"/>

<field name="arch" type="xml">

<xpath expr="//page/group/field[@name='signature']" position="before">

<field name="notify_sms"/>

<field name="mob_number" class="oe_inline" placeholder="e.g. +919898989898" attrs="{'invisible': [('notify_sms', '=', False)]}"/>




<record id="add_to_user_preferences2" model="ir.ui.view">

<field name="name">Inhetitance In Preference2</field>

<field name="model">res.users</field>

<field name="inherit_id" ref="base.view_users_form_simple_modif"/>

<field name="arch" type="xml">

<xpath expr="/form/group[@name='preferences']" position="after">

<group string="SMS Preferences" col='4'>

<field name="notify_sms"/>

<field name="mob_number" placeholder="e.g. +919898989898" attrs="{'invisible': [('notify_sms', '=', False)]}"/>







Please suggest me the solution.

Thanks in advance 

On 11/9/16, 10:00 AM


Just include readonly="0" for the new fields in user preference xml file

Like <field name="notify_sms" readonly="0"/>

In my case it worked. Hope this would help u :)

thanks sarga

Amit Kumar
on 11/17/16, 12:29 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 5/30/16, 6:34 AM
Seen: 970 times
Last updated: 4/11/17, 4:03 AM