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
- Księgowość
- Zapasy
- PoS
- Projekt
- MRP
To pytanie dostało ostrzeżenie
2
Odpowiedzi
5880
Widoki
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się| Powiązane posty | Odpowiedzi | Widoki | Czynność | |
|---|---|---|---|---|
|
count number of records based on condition
Rozwiązane
|
|
1
lis 24
|
21245 | |
|
How to install odoo 10 in ubuntu 20.04?
Rozwiązane
|
|
1
wrz 23
|
4027 | |
|
|
3
maj 23
|
6609 | ||
|
|
7
kwi 23
|
50115 | ||
|
Barcode scanner from mobile
Rozwiązane
|
|
1
gru 22
|
8673 |
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')