Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
5988 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
cze 25
2639
0
sie 19
2545
2
lip 25
415
0
sty 25
698
2
sie 24
5380