User how to restrict specific file extension to upload on the odoo online ticketing system attachement form ?
* we are using odoo online.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
please show me on how i can do it with the below code.
To restrict specific file extensions as attachment on the helpdesk.ticket model, you can override the create and write methods of this object.
class HelpdeskTicket(models.Model):
_inherit = 'helpdesk.ticket'
@api.model
def create(self, values):
attachments = values.get('attachment_ids', [])
for attachment in attachments:
datas_fname = attachment[2].get('datas_fname', '')
if datas_fname.endswith(('.exe', '.bat')):
raise ValidationError('You cannot upload files with .exe or .bat extensions.')
return super(HelpdeskTicket, self).create(values)
I've used '.exe' and '.bat' as an example, you can add the extensions you want and then in the same manner define a write method and I hope this should solve your problem.
I think that this is not possible with Odoo Online
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 4 17
|
3703 | ||
|
0
thg 3 25
|
1417 | ||
|
0
thg 10 24
|
1383 | ||
|
1
thg 9 24
|
1535 | ||
|
1
thg 8 24
|
1638 |