how to display image in form view and also in tree view?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
For List view:
<field name='image_256' string="Product Image" optional="show" widget="image"/>
On version 13.
Define Image field
image = fields.Binary()
<field name="image" widget="image"/>
If you want to show this on tree view, download web_tree_image for your version.
Define in tree view and set widget="image"
Watch on YouTube to see how to implement this.
in xml file use <img> tag like this,
<form string='Class'>
<sheet>
<group>
<field name='name'/>
<img src='/module_name/static/image/myimage.png'/>
</group>
</sheet>
</form>
you can try this
in .py file
image = fields.Binary(string="Image")
<group>
<field name='image' widget="image" class="oe_avatar" />
</group>
Display image in tree view odoo10
<record id="personal_info_tree_view" model="ir.ui.view">
<field name="name">Personal Information</field>
<field name="model">personal.info</field>
<field name="arch" type="xml">
<tree string="Personal Info"> <field name="full_name"/>
<field name="image" nolabel="1" widget="image" class="oe_right oe_avatar"/>
</tree>
</field>
</record>
You have to import the module which you need.
In view file, give <field name="image_small"/> in field tag.
In python file add the column as 'image_small' : fields.binary('Product Image'), Here the image will be binary type. Give the name you need for the image should be in ().
res['value'].update({'image_small': product_obj.image_small or False}) this will updates the products in product_object with the image_small.
res['image_small'] = line.image_small This will helps to display image in tree view.
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar