How to display a default image (saved in /my_module/static/img/car1.png) in a form ?
I have a binary field like this:
car_image =field.Binary(string="car1",default=??)
in xml, i gave like this:
<field name="car_image1" widget="image"/>
Please help
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
2
Replies
4868
Views
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Nov 24
|
18021 | ||
|
1
Sep 23
|
1206 | ||
|
3
May 23
|
4095 | ||
|
7
Apr 23
|
47100 | ||
Barcode scanner from mobile
Solved
|
|
1
Dec 22
|
6438 |
I added a default function like this:
But it says "Image cannot be displayed"
@api.model
def _get_default_image(self):
f = open('static/description/car1.png','rb')
self.car_image1 = base64.b64encode(f.read())
f.close()
car_image1 = fields.Binary(string="CAR Image", default='_get_default_image')