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
- Comptabilitat
- Inventari
- PoS
- Projectes
- MRP
This question has been flagged
2
Respostes
5867
Vistes
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrar-se| Related Posts | Respostes | Vistes | Activitat | |
|---|---|---|---|---|
|
|
1
de nov. 24
|
21235 | ||
|
|
1
de set. 23
|
4016 | ||
|
|
3
de maig 23
|
6602 | ||
|
|
7
d’abr. 23
|
50101 | ||
|
Barcode scanner from mobile
Solved
|
|
1
de des. 22
|
8667 |
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')