When uploading a file binary on odoo sometimeS we need to store the original file name for informative purpose. So thats why this tutorial will come in handy.
well that was ridiculously fast !!!
Things that need to take into account is make sure you add those xml on your formview because most of uploading file operation happen in formview. And then ypu can use the field file name in treeview.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- IN PYTHON, ADD ANOTHER FIELD DECLARATION TO STORE FILE NAME (CHAR)--> | |
file = fields.Binary("Attachment") | |
file_name = fields.Char("File Name") | |
<!-- IN XML VIEW, SET THE 'FILENAME' ATTRIBUTE OF THE BINARY FIELD WITH THE CHAR FIELD (FIELD_NAME)--> | |
<field name="file" filename="file_name"/> | |
<field name="file_name" invisible="1"/> |
Things that need to take into account is make sure you add those xml on your formview because most of uploading file operation happen in formview. And then ypu can use the field file name in treeview.
Comments
Post a Comment