# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt 
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr

from frappe.model.document import Document

class CustomScript(Document):
		
	def autoname(self):
		self.name = self.dt + "-" + self.script_type

	def on_update(self):
		frappe.clear_cache(doctype=self.dt)
	
	def on_trash(self):
		frappe.clear_cache(doctype=self.dt)


@@ -96,10 +96,9 @@
 .txt
- 
 %0A
+
 from
@@ -150,38 +150,8 @@
 appe
-%0Afrom frappe.utils import cstr
 %0A%0Afr
@@ -226,11 +226,8 @@
 t):%0A
-%09%09%0A
 %09def
@@ -243,16 +243,74 @@
 (self):%0A
+%09%09if not self.script_type:%0A%09%09%09self.script_type = 'Client'%0A
 %09%09self.n
@@ -409,17 +409,16 @@
 elf.dt)%0A
-%09
 %0A%09def on

set default script_type for Custom Script