[FIX] utm: consider default argument's name in copy method

Before this commit, in the copy method override of `utm.source.mixin`, the name
of the default, argument was not considered while `_get_unique_names`  to get a
unique name for the record.

After this commit, the name parameter of the default argument will be considered
for the same.

taskID-2713198

Part-of: odoo/odoo#88997
This commit is contained in:
Pratik Raval (PRRA)
2023-07-17 12:05:48 +02:00
parent ee31690988
commit f64ca1c73c
+2 -1
View File
@@ -82,5 +82,6 @@ class UtmSourceMixin(models.AbstractModel):
def copy(self, default=None):
"""Increment the counter when duplicating the source."""
default = default or {}
default['name'] = self.env['utm.mixin']._get_unique_names(self._name, [self.name])[0]
default_name = default.get('name')
default['name'] = self.env['utm.mixin']._get_unique_names(self._name, [default_name or self.name])[0]
return super().copy(default)