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)
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()
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)
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()
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)
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)
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)