Skip to Content
Menu
This question has been flagged
1 Odpoveď
1634 Zobrazenia

Hi,


I have set “create an opportunity” in the contact form action, so the contact information can be stored in the CRM app. However, once the opportunity is won, I would like to create a customer, so I can see it in contacts app. I tried to do that manually by creating a customer name from the opportunity card, but an "Individual" contact is created instead of a Company contact. It also replaces the name of the contact person with the name of the customer I provided. I want to create only company contacts. Can I solve this in some way? Better if I can do it with an automated action: if won, create the "company" type customer with all the information in the CRM card (company name, contact person, etc).


Avatar
Zrušiť

Wouldn't you be able to solve this using automation rules? Triggers > actions.

Wouldn't you always create a new contact, even when it would fall under a company. I assume all your leads are companies. Switching from "individual" to "Company" in the contacts app should be easily done so as well?

Best Answer

This is how you can create a company contact if a opportunity created from website is won through automated action
go to setting->Technical->Automation Rules 
click on new button 
give name to your automation rule select model as Lead/Opportunity
Apply on filter set to 'Stage', '=', 'won'
set When Updating to Stage
Action to do set as Execute Code
#python code below
for rec in record:

    env['res.partner'].create({

        'is_company': True,

        'name': rec.partner_name,

        'email': rec.email_from,

        'phone': rec.phone,

​#add if more information needed

    })

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
2
jún 25
1267
1
sep 24
3325
1
aug 24
1862
0
aug 24
252
0
máj 21
3299