trying to create new/next activity through automated action - execute python code. please check the code below, when this code executes, its throwing error
ValueError: [class 'psycopg2.ProgrammingError']: "can't adapt type 'ir.model'" while evaluating
the python code in automated action on update of mail.activity which should execute on Save button:
Python Code:
activity = record
new_activity_name = "Follow-up: {} 123"
new_activity_summary = "Follow-up on activity {} 123"
new_mail_activity = env['mail.activity'].create({
'activity_type_id' : 2,
'note' : "Follow-up note for activity {} 123",
'display_name': new_activity_name,
'summary': new_activity_summary,
'user_id': activity.user_id.id,
'date_deadline': activity.date_deadline,
'res_id': activity.res_id,
'res_model_id': activity.res_model_id
})
env['log'].create({'message': "New follow-up activity scheduled for activity {} 123"})
regards