I upload the image in this i need to allow only the png image others will not be allowed?How to do that
Esta pregunta ha sido marcada
if attachment_line.file_name and attachment_line.file_name.lower (). endswith (('. png' )):
self.env ['ir.attachment']. create ({
'name': attachment_line.file_name,
'attachment_type': attachment_line.type,
'datas': attachment_line.attachment,
'status': 'to_approve',
'datas_fname': attachment_line.file_name,
'res_id': active_rec.sale_line_id.id,
'res_model': 'sale.order.line'
})
else:
raise UserError (_ ("Sorry! Only .png is the Supported Format.") )
accept and upvote if useful
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Inscribirse| Publicaciones relacionadas | Respuestas | Vistas | Actividad | |
|---|---|---|---|---|
|
|
1
abr 26
|
4627 | ||
|
|
0
ago 19
|
4154 | ||
|
|
2
jul 25
|
2169 | ||
|
|
0
ene 25
|
2126 | ||
|
|
2
ago 24
|
7447 |
Hope this idea will solve your problem: http://learnopenerp.blogspot.com/2020/07/how-to-resize-image-on-saving-records-in-odoo.html