summaryrefslogtreecommitdiff
path: root/addons/web_editor/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web_editor/controllers')
-rw-r--r--addons/web_editor/controllers/main.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py
index 603509480f0..907b86e57f0 100644
--- a/addons/web_editor/controllers/main.py
+++ b/addons/web_editor/controllers/main.py
@@ -173,7 +173,16 @@ class Web_Editor(http.Controller):
if attachment.type == 'url':
raise UserError(_("You cannot change the quality, the width or the name of an URL attachment."))
if copy:
+ original = attachment
attachment = attachment.copy()
+ attachment.original_id = original
+ # Uniquify url by adding a path segment with the id before the name
+ if attachment.url:
+ url_fragments = attachment.url.split('/')
+ url_fragments.insert(-1, str(attachment.id))
+ attachment.url = '/'.join(url_fragments)
+ elif attachment.original_id:
+ attachment.datas = attachment.original_id.datas
data = {}
if name:
data['name'] = name