Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5914 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhấ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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 6 25
2590
0
thg 8 19
2495
0
thg 1 25
662
2
thg 8 24
5320
0
thg 4 24
1290