[FIX] crm: added a hook to be sure the website is correctly formated.

Step to reproduce:
- Go to CRM app
- Create a new opportunity and edit it
- Alter the website field under "Contact Information" tab
  with "www.anywebsite.com"
- Save and click on the website field value.

Without this fix, the field redirect as it's local:
"http://www.myodoo.com/www.anywebsite.com"

porting 726fad8

opw-2247853

closes odoo/odoo#50942

X-original-commit: 072400ad12ea17438a0175d94eb887f51172e461
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nasreddin (bon)
2020-05-10 18:12:22 +00:00
parent 0cecb056d4
commit 29f45ec23c
+7 -2
View File
@@ -376,13 +376,18 @@ class Lead(models.Model):
@api.model_create_multi
def create(self, vals_list):
leads = super().create(vals_list)
for vals in vals_list:
if vals.get('website'):
vals['website'] = self.env['res.partner']._clean_website(vals['website'])
leads = super(Lead, self).create(vals_list)
# Compute new probability for each lead separately
leads._update_probability()
return leads
def write(self, vals):
# stage change:
if vals.get('website'):
vals['website'] = self.env['res.partner']._clean_website(vals['website'])
# stage change: update date_last_stage_update
if 'stage_id' in vals:
stage_id = self.env['crm.stage'].browse(vals['stage_id'])
if stage_id.is_won: