Odoo Help


[V8] Get file size

Dorcy Valérian
on 7/16/15, 8:39 AM 467 views


I have a binary field and I would like get the size of this file for prevent the upload.

How can I do ?


On 7/17/15, 11:27 AM

How about a function in a custom module? Here's the most relevant part you need 

import os

check_size = os.path.getsize("/path/filename")
print check_size # not needed, is just for a quick dev check.

The rest of the logic depends on what you need to do exactly. 

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


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/16/15, 8:39 AM
Seen: 467 times
Last updated: 7/18/15, 9:32 AM