I've encountered a bug when using a binary field for storing a pdf, which I am not sure how to resolve.
Steps to reproduce:
- Upload a file
- Save
- Use the edit button to upload another file over it
- Save
- Upload the edit button to upload again
- Save and refresh the page
- Observe
Expected result:
The third file is displayed/stored in the sale's order
Actual result:
The second file persists. Even deleting it, saving and then uploading a new file, still shows the second one on refresh.
Additional information
In my model, i've defined the field as follows
scanned_contract = fields.Binary(copy=False, help="Attach here the signed hard copy of the contract")
Then, in my view I display it like this, using pdf_viewer widget:
xpath expr="//field[@name='signature']" position="after"
field widget="pdf_viewer" name="scanned_contract"/
/xpath
Am I defining something wrong, or is this a bug with odoo/pdf_viewer itself?