Hello every one here i am again, Does anyone knows how to display filename of a binary file? I tried to make it downloadable but upon the execution of the wizzard it shows only the "Download" without its filename and upon downloading it's filename become the name of my class plus there is no file extension. The downloaded file is something like this: custom_report_1 (i want to bear it's filename base on how i set it and it's extension). How can i resolve this? Pls help.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
From Odoo 16 You need to add widget="binary" as well :
<field name="odometer_image" filename="odometer_image_name" widget="binary"/>
<field name="odometer_image_name" invisible="1"/>
Hello,
Does not work if you ese pdf_viewer widget instead
You have to create a char field and then link it with binary field in xml file using filename attribute.
Ex:
# create a char field
file_data = fields.Binary('File')
file_name = fields.Char('File Name')
# Go to xml and
<field name="file_data" filename="file_name"/>
<field name="file_name" invisible="1"/>
but this solution cant effect when file_data show in tree view.
it just show capacity of file
You have a file_name field that stores the name of the file. So just add file_name field in a tree view instead of file_data field if you just want to show the file name in the tree view.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
How you solved this problem?