Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5970 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มิ.ย. 25
2632
0
ส.ค. 19
2531
2
ก.ค. 25
363
0
ม.ค. 25
691
2
ส.ค. 24
5372