İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
5982 Görünümler

I upload the image in this i need to allow only the png image others will not be allowed?How to do that

Avatar
Vazgeç
En İyi Yanıt

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

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Haz 25
2634
0
Ağu 19
2535
2
Tem 25
380
0
Oca 25
694
2
Ağu 24
5374