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