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
- Comptabilité
- Inventaire
- PoS
- Projet
- MRP
Cette question a été signalée
2
Réponses
5870
Vues
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire| Publications associées | Réponses | Vues | Activité | |
|---|---|---|---|---|
|
|
1
nov. 24
|
21238 | ||
|
|
1
sept. 23
|
4019 | ||
|
|
3
mai 23
|
6606 | ||
|
|
7
avr. 23
|
50104 | ||
|
Barcode scanner from mobile
Résolu
|
|
1
déc. 22
|
8671 |
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')