Odoo Help

2

0
2 Answers
2
Avatar
--deep--

Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

deep India
10/16/14, 1:21 AM

Hi ya, thanks for sending link, it was really tough to find out in Mail, for which question to answer back...

Well coming to your question, I agree with Piyush...

Q1: you want to hide a field "blood_group" for certain users and show to other users, but since both the users belonging to same group, you cannot achieve it...

Alternate solution: add a new group say "group_blood_details" on the column "blood_group", and then this group will be a Additional group for the user you want to give access ..

 

Q2: Is a interesting requirement, but i believe this you cant achieve neither using groups nor security rules..

Alternate solution: add a functional field [store is False] which evalutes and returns whether the user has to see it or not, say it returns True or False [boolean value].. then in xml for the tab [Family Details] using attrs set invisible property based on the functional field...

Hope this helps you...

5 Comments
dirtyHandsPHP India
10/17/14, 2:23 AM

Hi Deep, thank you so much for replying back. Solution 1: Again both user will be related to same group so I think it will create the same situation Solution 2 : This one looks good. Let me work on that and will surely inform you as proceed.

deep India
10/17/14, 3:06 AM
deep India
10/17/14, 3:08 AM

Solution1 : you should one more additional group for only one user...

deep India
10/17/14, 3:10 AM

Say you would have had a group say "xxx" which you would have assigned to both user 1 & user 2..... now create one more new group say "YYY" and now you have to assign this group only one user who wants to see it, say user 1...

dirtyHandsPHP India
10/17/14, 5:14 AM

Hi Deep, thank you so much for replying back. Solution 1: Again both user will be related to same group so I think it will create the same situation Solution 2 : Much thanks Deep....Second solution really works..Thanks again.

2
Piyush Suva India
10/13/14, 6:53 AM

you have to create record rule for this.

you can inherit and override def fields_view_get method. in that you can add attribute 'invisible' on conditional basis.

10 Comments
dirtyHandsPHP India
10/13/14, 6:59 AM

Thanks!!!!...which one?

Piyush Suva India
10/13/14, 7:10 AM

[('m2o of user of your object' )','=',user.id)] so that user can access only his related record .

dirtyHandsPHP India
10/13/14, 7:47 AM

I want user to access their subordinate details as well and for that record rules are already written...They are working fine but the concern is i want to hide one tab out of 4 tabs on condition basis....

Piyush Suva India
10/13/14, 8:15 AM

ohk bro.. i got your point. then you can inherit and override def fields_view_get method. in that you can add attribute 'invisible' on conditional basis.

dirtyHandsPHP India
10/13/14, 8:28 AM

I don't wanna set invisible on field basis, but on tab basis....

Piyush Suva India
10/13/14, 8:45 AM

yes bro You can on Tab also. just refer fields_view_get method

Piyush Suva India
10/13/14, 8:45 AM

I give you sample code for you. def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): if context is None:context = {} res = super(YOUR_MAIN_OBJECT_CLASS, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) if context.get('TEST_UID', False) == uid: doc = etree.XML(res['arch']) nodes = doc.xpath("//page[@name='family_details']") for node in nodes: node.set('invisible', '1') res['arch'] = etree.tostring(doc) return res

dirtyHandsPHP India
10/14/14, 4:58 AM

Much thanks Piyush....Your solution is good but not what i want....I am already hacing groups so want to set just groups = "group_name" attribute and it should behave as expected....You can check hr module this functionality is already working I just want to check why it's not working for group_users....

Piyush Suva India
10/14/14, 5:18 AM

i think group_users group for all employee, its basic group for employee, if person is employee then he have a 'group_user' rights. so, logged In user can see all record's 'Family Details' Tab. because he have a rights of group ' group_user',

Piyush Suva India
10/14/14, 5:27 AM

You can add one more group and assign this group to 'Family Details' tab.

Ask a Question
Writer
Keep Informed
1 follower(s)
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