Im trying to make an Automated Action, when I create a user also grand access to portal.
My code so far is bind on button Apply to All
(see image below):
for rec in records:
for user in rec.user_ids:
user['in_portal'] = True
rec.action_apply()
Apply to All
Button Code: <button name="563" type="action" string="Apply to All"/>
How can i modify the code so it run, when I create a user and also grand access to portal?
There are some options, to implement what you need.
Override create()
of model res.users
and just add users to your desired group(s) after super call.
Create an automated action (Settings/Technical/Automation/Automated Actions)
Data to Write: add one line
Value: [(4,env.ref('external id of group
').id)]
Substitute external id of group
with base.group_portal
so in your case it should be [(4,env.ref('base.group_portal').id)]