Skip to content

Commit

Permalink
[IMP] dms: allow to pass the name value in copy
Browse files Browse the repository at this point in the history
If the right context key is passed down, then the function
can assume the name was correctly set and not overwrite it.
  • Loading branch information
len-foss committed Dec 16, 2023
1 parent 1099458 commit 77c4efa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dms/models/dms_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,8 @@ def copy(self, default=None):
names = directory.sudo().file_ids.mapped("name")
else:
names = self.sudo().directory_id.file_ids.mapped("name")
default.update({"name": file.unique_name(self.name, names, self.extension)})
if not self.env.context.get("force_dms_file_name"):
default.update({"name": file.unique_name(self.name, names, self.extension)})
return super(File, self).copy(default)

@api.model_create_multi
Expand Down

0 comments on commit 77c4efa

Please sign in to comment.