Reputation: 430
When I upload the attachment file, I want to display with custom name ,not with default filename.
Upvotes: 1
Views: 901
Reputation: 2454
Python Code
class MyModel(models.Model):
_name = 'your.model'
image = fields.Binary('Image', required=True)
image_filename = fields.Char("Image Filename")
XML View
<record id="view_form_your_model" model="ir.ui.view">
<field name="name">Your Model Form</field>
<field name="model">your.model</field>
<field name="arch" type="XML">
<form>
<sheet>
<group>
<field name="image_filename" invisible="0" />
<field widget="binary" name="image" filename="image_filename" />
</group>
</sheet>
</form>
</field>
</record>
Thanks
Upvotes: 2