show filename of binary files odoo


Pyhton Code

class MyModel(models.Model):
    _name = 'my.model'

    image = fields.Binary('Image', required=True)
    image_filename = fields.Char("Image Filename")

XML File

<record id="view_form_my_model" model="ir.ui.view">
  <field name="name">My Model Form</field>
  <field name="model">my.model</field>
  <field name="arch" type="xml">
    <form>
      <sheet>
        <group name="group_top">
          <group name="group_left">
            <field name="image_filename" invisible="0"/>
            <field widget="binary" height="64" name="image" filename="image_filename" />
          </group>
          <group name="group_right">
          </group>
        </group>
      </sheet>
    </form>
  </field>
</record>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s