Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1496 Zobrazení

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šit

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?

Nejlepší odpověď

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šit
Related Posts Odpovědi Zobrazení Aktivita
2
čvn 25
1112
1
zář 24
3111
1
srp 24
1687
0
srp 24
252
0
kvě 21
3195