콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
5 답글
6985 화면

I wanted to set the domain criteria dynamically on the window action (ir.actions.act_window) for specific user.


Note: I don't want to use any Security Rules on the object, though it gives the result what am looking for,  but it is a hindrance in couple of places wherein it fails to perform my internal functionality.

In other words, User should not have visual access to couple of records, but should be available to perform the internal actions.


Best Example, I can take is Partners:

Under "Contacts" menu, Both Supplier & Customer contacts are been shown.

Now I want to filter the contacts which are shown in that Contact menu according to the User.

Say User A (belonging to SalesGroup) should access to view Customer Contacts in that menu, User B (belonging to PurchaseGroup) should be able to see only Suppliers in that menu.


But this should not affect Sale/Purchase Contacts w.r.t Sale/Purchase orders.


Any help appreciated.


아바타
취소

please post code , you have done so far

작성자 베스트 답변

 Made the contacts menu itself invisible to serve the purpose, thanks anyways to all who tried to help me,

However I already migrated to Odoo 10, where in by Contacts menu is not present any more, hence Search_default does the much need activity.

아바타
취소
베스트 답변

Hi Deep,

You can use "uid" variable in right hand side of domain to manage dynamic domain inside any window action. Please have a look inside below example.

<record model="ir.actions.act_window" id="action_note_stage">
<field name="name">Stages</field>
<field name="res_model">note.stage</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('user_id','=',uid)]</field>
</record>

Another one.

<record id="expense_all" model="ir.actions.act_window">
<field name="name">My Expenses</field>
<field name="res_model">hr.expense</field>
<field name="view_mode">tree,kanban,form,graph,pivot</field>
<field name="search_view_id" ref="view_hr_expense_filter"/>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
</record>

I hope you will get dynamic domain as you want from above examples.

Note : You can use some predefined variables in domain like : uid, active_id, active_ids, time etc.

 

아바타
취소
작성자

@ Empiro, Thanks for the reply, but no, as I told you earlier, it is based on the UserGroup and not uid. For Instance: users belonging to Sales Group should be able to access only Customer(i.e Contacts set as customer) similarly Purchase Group should be able to access only Supplier Contacts.

작성자

Sorry: I had missed to mention, it is w.r.t to UserGroups not on User.

관련 게시물 답글 화면 활동
1
4월 18
8100
0
7월 15
5546
naked domain set up 해결 완료
3
7월 25
4315
0
5월 25
883
2
3월 24
2157