Example #1
0
	def validate(self):
		"""make custom css"""
		from jinja2 import Template
		from website.utils import get_hex_shade
		import os
		
		self.validate_colors()
		
		with open(os.path.join(
				os.path.dirname(os.path.abspath(__file__)), 
				'custom_template.css'), 'r') as f:
			temp = Template(f.read())
		
		self.prepare()
		
		self.doc.custom_css = temp.render(doc = self.doc, get_hex_shade=get_hex_shade)
		if self.doc.add_css:
			self.doc.custom_css += '\n\n/* User CSS */\n\n' + self.doc.add_css
		
		from webnotes.sessions import clear_cache
		clear_cache('Guest')

		from website.utils import clear_cache
		clear_cache()
		
		for f in ["small_font_size", "at_import", "heading_text_style"]:
			if f in self.doc.fields:
				del self.doc.fields[f]
Example #2
0
    def validate(self):
        """make custom css"""
        from jinja2 import Template
        from webnotes.webutils import get_hex_shade
        import os

        self.validate_colors()

        with open(
                os.path.join(os.path.dirname(os.path.abspath(__file__)),
                             'custom_template.css'), 'r') as f:
            temp = Template(f.read())

        self.prepare()

        self.doc.custom_css = temp.render(doc=self.doc,
                                          get_hex_shade=get_hex_shade)
        if self.doc.add_css:
            self.doc.custom_css += '\n\n/* User CSS */\n\n' + self.doc.add_css

        from webnotes.sessions import clear_cache
        clear_cache('Guest')

        from webnotes.webutils import clear_cache
        clear_cache()

        for f in ["small_font_size", "at_import", "heading_text_style"]:
            if f in self.doc.fields:
                del self.doc.fields[f]
Example #3
0
    def on_update(self):
        """clear cache"""
        from webnotes.sessions import clear_cache
        clear_cache('Guest')

        from webnotes.webutils import clear_cache
        clear_cache()
	def on_update(self):
		"""clear cache"""
		from webnotes.sessions import clear_cache
		clear_cache('Guest')

		from webnotes.webutils import clear_cache
		clear_cache()
Example #5
0
	def if_home_clear_cache(self):
		"""if home page, clear cache"""
		if webnotes.conn.get_value("Website Settings", None, "home_page")==self.doc.name:
			from webnotes.sessions import clear_cache
			clear_cache('Guest')
			import website.web_cache
			website.web_cache.clear_cache(self.doc.page_name)
			website.web_cache.clear_cache('index')
Example #6
0
	def __init__(self):
		if webnotes.form_dict.get('cmd')=='login':
			# clear cache
			from webnotes.sessions import clear_cache
			clear_cache(webnotes.form_dict.get('usr'))				

			self.authenticate()
			self.post_login()
			webnotes.response['message'] = 'Logged In'
Example #7
0
	def __init__(self):
		if webnotes.form_dict.get('cmd')=='login':
			# clear cache
			from webnotes.sessions import clear_cache
			clear_cache(webnotes.form_dict.get('usr'))				

			self.authenticate()
			self.post_login()
			webnotes.response['message'] = 'Logged In'
Example #8
0
 def if_home_clear_cache(self):
     """if home page, clear cache"""
     if webnotes.conn.get_value("Website Settings", None,
                                "home_page") == self.doc.name:
         from webnotes.sessions import clear_cache
         clear_cache('Guest')
         import website.web_cache
         website.web_cache.clear_cache(self.doc.page_name)
         website.web_cache.clear_cache('index')
Example #9
0
    def on_update(self):
        # make js and css
        from webnotes.cms.make import make_web_core
        make_web_core()

        # clear web cache
        import website.web_cache
        #website.web_cache.refresh_cache(build=['Blog'])
        website.web_cache.refresh_cache()

        from webnotes.sessions import clear_cache
        clear_cache('Guest')
Example #10
0
	def on_update(self):
		# make js and css
		from webnotes.cms.make import make_web_core
		make_web_core()
		
		# clear web cache
		import website.web_cache
		#website.web_cache.refresh_cache(build=['Blog'])
		website.web_cache.refresh_cache()

		from webnotes.sessions import clear_cache
		clear_cache('Guest')
Example #11
0
def execute():
	import webnotes
	from webnotes.model.code import get_obj
	from webnotes.modules import reload_doc
	sql = webnotes.conn.sql

	reload_doc('hr', 'doctype', 'appraisal')

	sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'")
	sql("update tabDocPerm set amend = 0 where parent = 'Salary Structure'")
	sql("update tabDocPerm set cancel = 1 where parent = 'Company' and role = 'System Manager'")
	
	if sql("select count(name) from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
		sql("delete from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
	if sql("select count(name) from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
		sql("delete from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
			
		
	if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'Quality Inspection' and fieldtype = 'Button'")[0][0] > 1:
		sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'Quality Inspection' and fieldtype = 'Button' limit 1")
	
	reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
		
	reload_doc('accounts', 'doctype', 'cost_center')
	sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'")

	# Patch for adding packing related columns (packed by, checked by, shipping mark etc)
	reload_doc('stock','doctype','delivery_note')
	sql("update `tabDocField` set allow_on_submit = 1 where fieldname = 'page_break'")
	sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('indent_details', 'po_details', 'purchase_receipt_details', 'entries', 'sales_order_details', 'delivery_note_details', 'quotation_details') and fieldtype = 'Table'")
		
	from webnotes.sessions import clear_cache
	clear_cache(webnotes.session['user'])

	# FEATURES SETUP
	#----------------
	reload_doc('setup', 'doctype','features_setup')
	flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos']
	st = "'"+"', '".join(flds)+"'"
	sql("delete from `tabSingles` where field in (%s) and doctype = 'Features Setup'" % st)
	sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st)
	sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st)

	if not sql("select * from `tabDefaultValue` where defkey like 'fs_%' and parent = 'Control Panel'"):
		rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null")
		fs = get_obj('Features Setup', 'Features Setup')
		for d in rs:
			fs.doc.fields[d[0]] = 1
		fs.doc.save()
		fs.validate()
Example #12
0
	def __init__(self):
		if webnotes.form_dict.get('cmd')=='login':
			# clear cache
			from webnotes.sessions import clear_cache
			clear_cache(webnotes.form_dict.get('usr'))

			self.authenticate()
			self.post_login()
			info = webnotes.conn.get_value("Profile", self.user, ["user_type", "first_name", "last_name"], as_dict=1)
			if info.user_type=="Partner":
				webnotes.response["message"] = "No App"
				full_name = " ".join(filter(None, [info.first_name, info.last_name]))
				webnotes.response["full_name"] = full_name
				webnotes.add_cookies["full_name"] = full_name
			else:
				webnotes.response['message'] = 'Logged In'
Example #13
0
	def __init__(self):
		if webnotes.form_dict.get('cmd')=='login':
			# clear cache
			from webnotes.sessions import clear_cache
			clear_cache(webnotes.form_dict.get('usr'))

			self.authenticate()
			self.post_login()
			info = webnotes.conn.get_value("Profile", self.user, ["user_type", "first_name", "last_name"], as_dict=1)
			if info.user_type=="Website User":
				webnotes.response["message"] = "No App"
			else:
				webnotes.response['message'] = 'Logged In'

			full_name = " ".join(filter(None, [info.first_name, info.last_name]))
			webnotes.response["full_name"] = full_name
			webnotes.add_cookies["full_name"] = full_name
    def validate(self):
        """make custom css"""
        from jinja2 import Template
        from webnotes.webutils import get_hex_shade
        import os

        default_colours = {
            "background_color": "FFFFFF",
            "page_background": "FFFFFF",
            "top_bar_background": "FFFFFF",
            "top_bar_foreground": "444444",
            "page_headings": "222222",
            "page_text": "000000"
        }

        for d in default_colours:
            if not self.doc.fields.get(d):
                self.doc.fields[d] = default_colours[d]

        self.validate_colors()

        with open(
                os.path.join(os.path.dirname(os.path.abspath(__file__)),
                             'custom_template.css'), 'r') as f:
            temp = Template(f.read())

        self.prepare()

        self.doc.custom_css = temp.render(doc=self.doc,
                                          get_hex_shade=get_hex_shade)
        if self.doc.add_css:
            self.doc.custom_css += '\n\n/* User CSS */\n\n' + self.doc.add_css

        from webnotes.sessions import clear_cache
        clear_cache('Guest')

        from webnotes.webutils import clear_cache
        clear_cache()

        for f in ["small_font_size", "at_import", "heading_text_style"]:
            if f in self.doc.fields:
                del self.doc.fields[f]
Example #15
0
	def validate(self):
		"""make custom css"""
		from jinja2 import Template
		from webnotes.webutils import get_hex_shade
		import os
		
		default_colours = {
			"background_color": "FFFFFF",
			"page_background": "FFFFFF",
			"top_bar_background": "FFFFFF",
			"top_bar_foreground": "444444",
			"page_headings": "222222",
			"page_text": "000000"
		}
		
		for d in default_colours:
			if not self.doc.fields.get(d):
				self.doc.fields[d] = default_colours[d]
		
		self.validate_colors()
		
		with open(os.path.join(
				os.path.dirname(os.path.abspath(__file__)), 
				'custom_template.css'), 'r') as f:
			temp = Template(f.read())
		
		self.prepare()
		
		self.doc.custom_css = temp.render(doc = self.doc, get_hex_shade=get_hex_shade)
		if self.doc.add_css:
			self.doc.custom_css += '\n\n/* User CSS */\n\n' + self.doc.add_css
		
		from webnotes.sessions import clear_cache
		clear_cache('Guest')

		from webnotes.webutils import clear_cache
		clear_cache()
		
		for f in ["small_font_size", "at_import", "heading_text_style"]:
			if f in self.doc.fields:
				del self.doc.fields[f]
Example #16
0
	def validate(self):
		"""make custom css"""
		from jinja2 import Template
		import os
		
		with open(os.path.join(
				os.path.dirname(os.path.abspath(__file__)), 
				'custom_template.css'), 'r') as f:
			temp = Template(f.read())
		
		if not self.doc.font_size:
			self.doc.font_size = '13px'
			
		self.doc.small_font_size = str(int(self.doc.font_size[:-2])-2) + 'px'
		
		self.doc.custom_css = temp.render(doc = self.doc)
		if self.doc.add_css:
			self.doc.custom_css += '\n\n/* User CSS */\n\n' + self.doc.add_css
		
		from webnotes.sessions import clear_cache
		clear_cache('Guest')
		
		del self.doc.fields['small_font_size']
Example #17
0
    def if_home_clear_cache(self):
        """if home page, clear cache"""
        if webnotes.conn.get_value("Website Settings", None, "home_page") == self.doc.name:
            from webnotes.sessions import clear_cache

            clear_cache("Guest")

            from webnotes.webutils import clear_cache

            clear_cache(self.doc.page_name)
            clear_cache("index")