Odoo Help

Welcome!

This community 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.

0

Extend user settings dialog

By
Mark Zeller
on 8/18/14, 11:19 AM 726 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

--Ben Bernard--
1083
| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 8/18/14, 1:33 PM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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