[FIX] crm: fix res.partner creation from Leads
- Go to CRM > Settings and activate Leads - Go to CRM > Leads and create 2 Leads with a different phone number - Select the 2 created Leads and in Action menu, select Send email - Make sure that "Lead/Opportunity: Mass Mail" is selected as template - Send it - Go to Contacts 2 Contacts have been created from the Leads, but both have the same phone number. The issue comes from the override `default_get` of `res.partner` in crm module. It is using `active_id` from context to fetch the Lead to populate Partner data. This cannot work when several Leads are selected as the same `active_id` is used for all of them. opw-2333819 closes odoo/odoo#57638 X-original-commit: a84dcfb9475051082c6103f81bfa231ea50ed157 Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
This commit is contained in:
@@ -18,7 +18,7 @@ class Partner(models.Model):
|
||||
def default_get(self, fields):
|
||||
rec = super(Partner, self).default_get(fields)
|
||||
active_model = self.env.context.get('active_model')
|
||||
if active_model == 'crm.lead':
|
||||
if active_model == 'crm.lead' and len(self.env.context.get('active_ids', [])) <= 1:
|
||||
lead = self.env[active_model].browse(self.env.context.get('active_id')).exists()
|
||||
if lead:
|
||||
rec.update(
|
||||
|
||||
Reference in New Issue
Block a user