Browse files

[IMP] website_slides: new modal to upload a document

With new slide type, it was required to change the
upload modaL. Now, the use select first the type
of document he wants to upload, then the correct
form appears. When filled, user can sumbit it to
be redirect to the slide he just create.

  • Loading branch information...
qmo-odoo authored and jem-odoo committed Feb 8, 2019
1 parent 7d54872 commit e5e92eff89c8c665f9a179df0f89eef663847211
@@ -296,13 +296,14 @@ def dialog_preview(self, **data):
def create_slide(self, *args, **post):
# check the size only when we upload a file.
if post.get('datas'):
file_size = len(post['datas']) * 3 / 4 # base64
file_size = len(post['datas']) * 3 / 4 # base64
if (file_size / 1024.0 / 1024.0) > 25:
return {'error': _('File is too big. File size cannot exceed 25MB')}

values = dict((fname, post[fname]) for fname in [
'name', 'url', 'tag_ids', 'slide_type', 'channel_id',
'mime_type', 'datas', 'description', 'image', 'index_content', 'website_published'] if post.get(fname))

if post.get('category_id'):
if post['category_id'][0] == 0:
values['category_id'] = request.env['slide.category'].create({
@@ -334,7 +335,11 @@ def create_slide(self, *args, **post):
except Exception as e:
return {'error': _('Internal server error, please try again later or contact administrator.\nHere is the error message: %s') % e}
return {'url': "/slides/slide/%s" % (}

redirect_url = "/slides/slide/%s" % (
if slide.slide_type == 'webpage':
redirect_url = "/slides/slide/%s?enable_editor=1" % (
return {'url': redirect_url}

@http.route(['/slides/tag/search_read'], type='json', auth='user', methods=['POST'], website=True)
def slide_tag_search_read(self, fields, domain):
Oops, something went wrong.

0 comments on commit e5e92ef

Please sign in to comment.