I upload the image in this i need to allow only the png image others will not be allowed?How to do that
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- 회계
- 재고 관리
- PoS
- Project
- MRP
신고된 질문입니다
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
관련 게시물 | 답글 | 화면 | 활동 | |
---|---|---|---|---|
|
0
6월 25
|
2685 | ||
|
0
8월 19
|
2589 | ||
|
2
7월 25
|
521 | ||
|
0
1월 25
|
741 | ||
|
2
8월 24
|
5444 |
Hope this idea will solve your problem: http://learnopenerp.blogspot.com/2020/07/how-to-resize-image-on-saving-records-in-odoo.html