Odoo Help

0

Extend user settings dialog

By
Mark Zeller
on 8/18/14, 11:19 AM 976 views

Hi.

I want to add a new attribute (like the email-address for example) to res.users making it possible for every user to update this attribute in his user settings dialog (upper right corner).

To make it short, everythings works as expected with the exception that only the administrator is able to edit this attribute in the user settings screen. For every one else it is read only.

Basically I added the new attribute to res.users

class res_users(osv.osv):
    _inherit = 'res.users
    _columns = {
        'color': fields.char('Color (hex)', size=6),
    }

And extended the view like this

<record id="view_user_my_settings_form" model="ir.ui.view">
    <field name="name">res.users.preferences.form.inherit</field>
    <field name="model">res.users</field>
    <field name="inherit_id" ref="base.view_users_form_simple_modif" />
    <field name="arch" type="xml">
        <data>
            <xpath expr="//group[@name='preferences']" position="inside">
                <field name="color"/>
            </xpath>
        </data>
    </field>
</record>

Any idea what I missed?

Regards

Mark

Update:

Thanks to Ben Bernard I discovered my mistake. After forcing the field to writeable mode I got an error that the user is not allowed to change res.users. So my solution is to move the attribute from res.users to res.partner.

0
Ben Bernard
On 8/18/14, 1:33 PM

<field name="color" readonly="0"/>

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.

Register

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

1 follower(s)

Stats

Asked: 8/18/14, 11:19 AM
Seen: 976 times
Last updated: 3/16/15, 8:10 AM