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

Admin excluded from domain- is it possible?

By
Andrija Burlic
on 2/19/15, 8:02 AM 429 views

I have this piece of code:

 

    <record id="request_tree" model="ir.ui.view" >
    <field name="domain">[('responsible_user_referent','=',uid)]</field>
      <field name="name">request.tree</field>
      <field name="model">pio.request</field>
      <field name="arch" type="xml">
        <tree .................... </tree>

 

Obviously, I want to filter this view, to show only requests where responsible_user_referent is current user-> currently logged user can only see his own requests. This domain works fine, but I want to allow admin to see all requests in system. Is this possible and how? Currently admin can only see his own requests, like every other user...

 

Thanks in advance!

0

Temur

--Temur--
2896
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 2/19/15, 10:12 AM

Try this way: [('responsible_user_referent','=',uid),('superuser_id','=',uid)]

I tried that, but w/o success. I used workaround- I created new menu item for admin- menu that shows all requests and it's visible only for admin... Anyway, thank you for answer!

Andrija Burlic
on 2/20/15, 4:21 AM

It's pseudo code, not complete code, I just gave you direction. In order to get worked above code, you could add computed(functional) integer field, named as 'superuser_id', and it's computing function should return always SUPERUSER_ID (i.e. 'superuser_id' field should be computed to SUPERUSER_ID). In openerp/odoo you can import SUPERUSER_ID as follows: from openerp import SUPERUSER_ID. Separated menu that you've done also good workaround, cheers

Temur
on 2/23/15, 4:16 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

2 follower(s)

Stats

Asked: 2/19/15, 8:02 AM
Seen: 429 times
Last updated: 3/16/15, 8:10 AM