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

I'm trying to set a couple of automated actions in Odoo 8. 

What i want to do is:

  • Automatically add the customer assigned to a project to the portal group when project begins.

  • Automatically delete the customer assigned to a project from the portal group when project ends.

The objetive of that is to automate the management of the portal access, so only customers who have an active project have permission access to portal.

Currently I'm trying to do that with Automated Actions /  Server Actions, so i created a Server Action named "Add user to portal group" wich "Base Model" is Partner that execute the following python code:

"Add user to portal group" Server Action: 

flag = self.pool.get('res.users').has_group(cr, model.id, 'base.group_portal')
if not flag:
 res_groups = self.pool['res.groups']
 users = self.pool['res.users'].search(cr, uid, [('id', '=', model.id)], context)
 group_id = self.pool['ir.model.data'].get_object(cr, uid, 'base', 'group_portal')
 res_groups.write(cr, uid, [group_id], {'users': [(4, user) for user in users]}, context=context)

Then i created an Automated Action named "Enable access to portal based on project duration", with this  parameters:

  • Related Document Model: "Project"

  • When to Run: "Based on Timed Condition"

  • Trigger Date: "Expiration Date"

  • Delay After Trigger Date: 0 Days.

The  first problem i have is that Automated Action Related Model  is "Project" and the Server Action Base Model is  Partner so I can't associate the Server Action  to the Automated Action.

I'm a bit confused and I do not know how to approach this issue in the simplest way possible :-)

I think that adding / removing membership to a group automatically can be of interest to many users, so any help?

Best regards,

Mario Pino

아바타
취소
관련 게시물 답글 화면 활동
0
11월 23
1693
2
12월 17
4213
0
10월 24
1562
0
12월 23
2701
1
12월 16
4710