예제 #1
0
파일: item.py 프로젝트: rajatkapoor/erpnext
	def update_website(self):
		def _invalidate_cache():
			from selling.utils.product import invalidate_cache_for
			
			invalidate_cache_for(self.doc.item_group)

			[invalidate_cache_for(d.item_group) for d in \
				self.doclist.get({"doctype":"Website Item Group"})]
		
		if self.doc.show_in_website:
			from webnotes.webutils import update_page_name
			if self.doc.name==self.doc.item_name:
				page_name_from = self.doc.name
			else:
				page_name_from = self.doc.name + " " + self.doc.item_name

			update_page_name(self.doc, page_name_from)
			
			_invalidate_cache()
		
		elif self.doc.page_name:
			# if unchecked show in website
			from webnotes.webutils import delete_page_cache
			delete_page_cache(self.doc.page_name)
			
			_invalidate_cache()
			
			webnotes.conn.set(self.doc, "page_name", None)
예제 #2
0
	def on_update(self):
		super(DocType, self).on_update()
		
		self.validate_name_with_item()
		
		from website.helpers.product import invalidate_cache_for
		
		if self.doc.show_in_website:
			from webnotes.webutils import update_page_name
			# webpage updates
			page_name = self.doc.name
			update_page_name(self.doc, page_name)
			invalidate_cache_for(self.doc.name)

		elif self.doc.page_name:
			# if unchecked show in website
			
			from webnotes.webutils import delete_page_cache
			delete_page_cache(self.doc.page_name)
			
			invalidate_cache_for(self.doc.name)
			
			webnotes.conn.set(self.doc, "page_name", None)
		
		self.validate_one_root()
예제 #3
0
파일: item.py 프로젝트: shygoly/erpnext
    def update_website(self):
        def _invalidate_cache():
            from website.helpers.product import invalidate_cache_for

            invalidate_cache_for(self.doc.item_group)

            [invalidate_cache_for(d.item_group) for d in \
             self.doclist.get({"doctype":"Website Item Group"})]

        if self.doc.show_in_website:
            from webnotes.webutils import update_page_name
            if self.doc.name == self.doc.item_name:
                page_name_from = self.doc.name
            else:
                page_name_from = self.doc.name + " " + self.doc.item_name

            update_page_name(self.doc, page_name_from)

            _invalidate_cache()

        elif self.doc.page_name:
            # if unchecked show in website
            from webnotes.webutils import delete_page_cache
            delete_page_cache(self.doc.page_name)

            _invalidate_cache()

            webnotes.conn.set(self.doc, "page_name", None)
예제 #4
0
파일: item_group.py 프로젝트: poses/erpnext
    def on_update(self):
        super(DocType, self).on_update()

        self.validate_name_with_item()

        from selling.utils.product import invalidate_cache_for

        if self.doc.show_in_website:
            from webnotes.webutils import update_page_name
            # webpage updates
            page_name = self.doc.name
            update_page_name(self.doc, page_name)
            invalidate_cache_for(self.doc.name)

        elif self.doc.page_name:
            # if unchecked show in website

            from webnotes.webutils import delete_page_cache
            delete_page_cache(self.doc.page_name)

            invalidate_cache_for(self.doc.name)

            webnotes.conn.set(self.doc, "page_name", None)

        self.validate_one_root()
예제 #5
0
    def on_update(self):
        super(DocType, self).on_update()

        self.validate_name_with_item()

        from website.helpers.product import invalidate_cache_for

        if self.doc.show_in_website:
            from webnotes.webutils import update_page_name
            # webpage updates
            page_name = self.doc.name
            if webnotes.conn.get_value(
                    "Product Settings", None,
                    "default_product_category") == self.doc.name:
                page_name = "products"
                from webnotes.webutils import clear_cache
                clear_cache()

            update_page_name(self.doc, page_name)

            invalidate_cache_for(self.doc.name)

        elif self.doc.page_name:
            # if unchecked show in website

            from webnotes.webutils import delete_page_cache
            delete_page_cache(self.doc.page_name)

            invalidate_cache_for(self.doc.name)

            webnotes.conn.set(self.doc, "page_name", None)
예제 #6
0
	def on_update(self):
		super(DocType, self).on_update()
		
		self.validate_name_with_item()
		
		from website.helpers.product import invalidate_cache_for
		
		
		if self.doc.show_in_website:
			from webnotes.webutils import update_page_name
			# webpage updates
			page_name = self.doc.name
			if webnotes.conn.get_value("Product Settings", None, 
				"default_product_category")==self.doc.name:
				page_name = "products"
				from webnotes.webutils import clear_cache
				clear_cache()
				
			update_page_name(self.doc, page_name)
			
			invalidate_cache_for(self.doc.name)

		elif self.doc.page_name:
			# if unchecked show in website
			
			from webnotes.webutils import delete_page_cache
			delete_page_cache(self.doc.page_name)
			
			invalidate_cache_for(self.doc.name)
			
			webnotes.conn.set(self.doc, "page_name", None)
예제 #7
0
def invalidate_cache_for(item_group):
	for i in get_parent_item_groups(item_group):
		if i.page_name:
			delete_page_cache(i.page_name)