Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2197 มุมมอง

Hi, 

I installed the OCA module 'Lead to Task' (https://odoo-community.org/shop/lead-to-task-8918#attr=14623) and I want to run it automatically if a lead enters a certain stage in the crm pipeline. How do I do this in python code in the automated action?


This image shows the button I want to automate, after that the fields are supposed to be filled out automatically, too: 



Do I need to use the python code:

action = {"type": "ir.actions.server", "id": 523} to execute it? And how do I add the fields?


Thanks you in advance!!

Friedrich



อวตาร
ละทิ้ง
ผู้เขียน

Hi Jaideep, thank you but I want to have the option to create tasks manually too - so the addon is necessary.

คำตอบที่ดีที่สุด

If you are trying to automate the creation of the task, why even have the module. You can directly create an automated action something on these line (this hasn't been tested and only an outline to illustrate)

Settings > Technical > Automated actions

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

def action_generate_task(self):

for rec in self:

stage = self.env['crm'lead'].search([('stage_id', '=', //add your required stage value],limit=1)

values = {

'name': rec.name',

'user_ids' : rec.user_id.ids,

}

self.env['project.task'].sudo().create(values)


xml:


<record id="action_task_generation" model="ir.cron">
    <field name="name">Auto Task Generation</field>
    <field name="model_id" ref="model_crm_lead"/>
    <field name="state">code</field>
    <field name="code">model.action_generate_task()</field>
    <field name="interval_number">1</field>
    <field name="interval_type">days</field>
    <field name="numbercall">-1</field>
    <field name="active" eval="True"/>
    <field name="doall" eval="True"/>
</record>


Hope it helps

อวตาร
ละทิ้ง
ผู้เขียน

Hello,
is this with respect to the existing addon I have installed?
thanks,
Friedrich

ผู้เขียน

Hi Cybrosys,
I already have code that creates the task - I only want toi access the exisiting button from my screenshot using an automated action. How do I call it in the frontend interface? Thanks!
Friedrich

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ย. 23
1999
0
ก.ย. 23
1669
Project or Task for Service Business แก้ไขแล้ว
1
มิ.ย. 23
1993
1
ต.ค. 23
1183
0
ก.ค. 23
1187