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.

1

How to make readonly field if user_id != current_user_id?

By
Darek
on 2/22/14, 1:59 PM 1,499 views

In calendar.view_calendar_event_form I want to make partner_ids field readonly if user_id != current_user_id. but name 'current_user_id' is not defined

I try this way, but it doesn't work.

        <xpath expr="//field[@name='partner_ids']" position="attributes">
            <attribute name="attrs">{'readonly':[('user_id','not in',uid)]}</attribute>
        </xpath>

How to check if current user is the event owner (user_id)?

1
Mariusz Mizgier
On 2/23/14, 8:41 AM

As far as I remember user must see a field for readonly field attrs to work. Whenever a user with default set of access rights logs in and checks the calendar, he is not able to see that, as the code states:

  <field name="user_id" groups="base.group_no_one"/>

Try changing that group to base.group_user or similiar and then try that.

user_id is already on calendar.view_calendar_event_form with label Owner. There's no need to change it. How to get current logged user id? I want to make Owner of the event the only user able to edit Attendees list (partner_ids). Or maybe there is better way to do it?

Darek
on 2/24/14, 7:14 AM

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

0 follower(s)

Stats

Asked: 2/22/14, 1:59 PM
Seen: 1499 times
Last updated: 3/16/15, 8:10 AM