summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2014-03-03 15:24:01 +0100
committerXavier Morel <xmo@openerp.com>2014-03-03 15:24:01 +0100
commitec68d3d8bd13e84cd742e849c4ac602805a5d4c3 (patch)
treeaef5c6a5b31d091c926c9cf07e4e8495d0968304 /addons
parent9d00835b2c7ea32441097318bf9c78ef48373118 (diff)
[IMP] don't duplicate website_url function field of attachments
bzr revid: xmo@openerp.com-20140303142401-2jaxc3m31tmqw9qa
Diffstat (limited to 'addons')
-rw-r--r--addons/website/controllers/main.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py
index 605315050c6..856ab6ecffc 100644
--- a/addons/website/controllers/main.py
+++ b/addons/website/controllers/main.py
@@ -259,20 +259,18 @@ class Website(openerp.addons.web.controllers.main.Home):
u"Image size excessive, uploaded images must be smaller "
u"than 42 million pixel")
- attachment_id = request.registry['ir.attachment'].create(request.cr, request.uid, {
+ Attachments = request.registry['ir.attachment']
+ attachment_id = Attachments.create(request.cr, request.uid, {
'name': upload.filename,
'datas': image_data.encode('base64'),
'datas_fname': upload.filename,
'res_model': 'ir.ui.view',
}, request.context)
- url = website.urlplus('/website/image', {
- 'model': 'ir.attachment',
- 'id': attachment_id,
- 'field': 'datas',
- 'max_height': MAX_IMAGE_HEIGHT,
- 'max_width': MAX_IMAGE_WIDTH,
- })
+ [attachment] = Attachments.read(
+ request.cr, request.uid, [attachment_id], ['website_url'],
+ context=request.context)
+ url = attachment['website_url']
except Exception, e:
logger.exception("Failed to upload image to attachment")
message = unicode(e)