I want to set default product image, if we create a product but we dont upload image, there's no Camera with cross image? but another image, yesterday i was look a module for set it, but it's for Odoo 10 only, i installed but cant.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
1
Responder
7242
Vistas
import base64
from odoo import models, fields
from odoo import modules
def get_default_img():
with open(modules.get_module_resource('my_module', 'static/img', 'my_image.png'),
'rb') as f:
return base64.b64encode(f.read())
class MyModel(models.Model):
_name = 'my.model'
field_binary = fields.Binary(default=get_default_img())
This is the answer, thread will be closed, thanks
src : https://www.iwesabe.com/blog/how-to-set-default-image-for-binary-field-odoo
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
5
abr 20
|
4255 | ||
|
1
mar 16
|
2002 | ||
Contact image via url
Resuelto
|
|
2
sept 21
|
8079 | |
|
1
may 18
|
12426 | ||
|
2
jun 24
|
7344 |