Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
5651 Widoki

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?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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....

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
mar 15
3858
1
lip 23
6435
0
lip 25
297
1
lip 25
5077
0
lip 25
643