Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Where in JS are attachments encoded to base64?

By
mike
on 7/9/13, 11:40 AM 1,139 views

I am trying to replicate the file uploading functionality on a custom client interface. It would save alot of work if I could reuse the functions OpenERP employs for base64 encoding file data and wrapping it within a JSON object. I have been searching through the javascript files to locate the methods involved with this but cannot find them. Does anybody know which OpenERP .js file is responsible for this?

0
mike
On 7/9/13, 12:15 PM

I think I found what I need! view_form.js line 4880. Now I just need to tinker with it and learn how to employ it myself.

Ok just figured this out. The file is sent as normal multipart form data to web/binary/upload where it gets encoded to base64 in Python. Then it is wrapped in JSON and sent back in Response to client as a javascript object and from there javascript adds additional values such as field and object associations, performs validation and resubmits it back to the server. Why not just do it the right way the 1st time and avoid the round-trip? I guess they had their reasons....

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 7/9/13, 11:40 AM
Seen: 1139 times
Last updated: 3/16/15, 8:10 AM