Skip to Content
Menu
This question has been flagged

Hi, 

I have the module 'Task from Lead' which works greatly and I want to use all it's features as they are. On top, I want to automate the task generation for a certain stage via an automated action.

here is the full module code: https://drive.google.com/drive/folders/15-VdWbhx_SO_cJZU2c4-2T3vMQsyX5yM?usp=sharing

the function is called create_task(self), however it is not part of the crm.lead model. It is part of the newly added crm.task.wizard model. How do I call the function in the automated action via executing python code? I've tried stuff like:

action = {self.env['crm.task.wizard'].create_task()}

-> error: name 'self' is not defined" while evaluating


self = env['crm.lead'].sudo().search([])

env['crm.task.wizard'].create_task(self)

-> error: crm_task_wizard.create_task() takes 1 positional argument but 2 were given" while evaluating


or NOT-NULL-violation, when not referring to 'self'


Can someone please help with the syntax? (I needs to be an automated action that can be changed from the frontend quickly)



button i want to automate

(button i want to automate, but task-creation wizard is different module)


Thanks a ton in advance!

Best,

Friedrich


Avatar
Discard
Author

Hey all,
this is breaking my head, please send help! :)

Hi, am not a familiar with syntax, however from your screenshot the object is crm.lead, maybe you need to execute action create_task in crm.lead environment rather than crm.task.wizard.

Apologies if am way off the mark, just trying to help.

Author

Hi Jaideep,

thanks for your answer. Unfortunately the method is part of the custom module crm.task.wizard, so calling it in the crm.lead env does not work.
How do I call a method from another module properly when being in an Automated action based on another module?
Best,
Friedrich

Related Posts Replies Views Activity
2
Sep 23
2235
0
Sep 23
1671
1
Oct 24
669
1
Jun 23
2026
0
Oct 24
547