Skip to content
Snippets Groups Projects
Commit 4b583427 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] utm: record creation


Make sure `is_website` is an existing field of the model at creation.

opw-2192139

closes odoo/odoo#44870

X-original-commit: 5daf25f2
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent bfad367a
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,10 @@ class UtmMixin(models.AbstractModel):
Model = self.env[field.comodel_name]
records = Model.search([('name', '=', value)], limit=1)
if not records:
records = Model.create({'name': value, 'is_website': True})
if 'is_website' in records._fields:
records = Model.create({'name': value, 'is_website': True})
else:
records = Model.create({'name': value})
value = records.id
if value:
values[field_name] = value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment