[REF] bi_sql_editor : Make test independant

[FIX] bi_sql_editor : allow to pass default values in copy() function
This commit is contained in:
Sylvain LE GAL
2023-12-05 21:22:52 +01:00
parent 4aa882a492
commit 382c7a0ba1
2 changed files with 31 additions and 23 deletions

View File

@@ -269,12 +269,10 @@ class BiSQLView(models.Model):
def copy(self, default=None):
self.ensure_one()
default = dict(default or {})
default.update(
{
"name": _("%s (Copy)") % self.name,
"technical_name": "%s_copy" % self.technical_name,
}
)
if "name" not in default:
default["name"] = _("%s (Copy)") % self.name
if "technical_name" not in default:
default["technical_name"] = f"{self.technical_name}_copy"
return super().copy(default=default)
# Action Section