|
|
@ -3,8 +3,10 @@ import frappe, json |
|
|
|
import json |
|
|
|
from frappe.utils import cstr, flt, cint |
|
|
|
def validate(doc=None,method=None): |
|
|
|
f = doc.file_name |
|
|
|
file_split = f.split('.') |
|
|
|
file_length = len(file_split) |
|
|
|
if file_length > 2: |
|
|
|
frappe.throw("Double Extension file not allowed") |
|
|
|
data = ['.jpg', '.png','.mp4', '.docx','.xls', '.pdf','.tiff','.ppt','.m4v','.doc','.pps','.pptx'] |
|
|
|
file_name = doc.file_name |
|
|
|
total_count = 0 |
|
|
|
for i in data: |
|
|
|
total_count += file_name.count(i) |
|
|
|
if total_count > 1: |
|
|
|
frappe.throw('Double Extension file not allowed') |