Skip to content

Instantly share code, notes, and snippets.

@akhmadkresna
Last active July 4, 2018 08:14
Show Gist options
  • Save akhmadkresna/49d451d10ec616a99556d4a194868aa6 to your computer and use it in GitHub Desktop.
Save akhmadkresna/49d451d10ec616a99556d4a194868aa6 to your computer and use it in GitHub Desktop.
get file name of binary file
<!-- 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"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment