Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
5860 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
iun. 25
2535
0
aug. 19
2428
0
ian. 25
573
2
aug. 24
5247
0
apr. 24
1232