Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
5840 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
čvn 25
2511
0
srp 19
2416
0
led 25
558
2
srp 24
5226
0
dub 24
1222