mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-24 00:58:29 +00:00
[website] [sitemap] cleanup
This commit is contained in:
@@ -4,46 +4,31 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
|
||||
from webnotes.utils.nestedset import DocTypeNestedSet
|
||||
from webnotes.webutils import WebsiteGenerator
|
||||
|
||||
class DocType(DocTypeNestedSet):
|
||||
class DocType(DocTypeNestedSet, WebsiteGenerator):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.nsm_parent_field = 'parent_item_group'
|
||||
|
||||
def on_update(self):
|
||||
super(DocType, self).on_update()
|
||||
DocTypeNestedSet.on_update(self)
|
||||
WebsiteGenerator.on_update(self)
|
||||
|
||||
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)
|
||||
|
||||
invalidate_cache_for(self.doc.name)
|
||||
|
||||
self.validate_one_root()
|
||||
|
||||
def validate_name_with_item(self):
|
||||
if webnotes.conn.exists("Item", self.doc.name):
|
||||
webnotes.msgprint("An item exists with same name (%s), please change the \
|
||||
item group name or rename the item" % self.doc.name, raise_exception=1)
|
||||
|
||||
|
||||
def get_context(self):
|
||||
from selling.utils.product import get_product_list_for_group, \
|
||||
get_parent_item_groups, get_group_item_count
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cint, cstr, filter_strip_join
|
||||
from website.webutils import WebsiteGenerator
|
||||
|
||||
|
||||
class DocType:
|
||||
class DocType(WebsiteGenerator):
|
||||
def __init__(self, doc, doclist=None):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
@@ -16,13 +17,8 @@ class DocType:
|
||||
self.doc.partner_website = "http://" + self.doc.partner_website
|
||||
|
||||
def on_update(self):
|
||||
if cint(self.doc.show_in_website):
|
||||
from webnotes.webutils import update_page_name
|
||||
update_page_name(self.doc, self.doc.partner_name)
|
||||
|
||||
WebsiteGenerator.on_update()
|
||||
if self.doc.page_name:
|
||||
from webnotes.webutils import clear_cache
|
||||
clear_cache(self.doc.page_name)
|
||||
clear_cache("partners")
|
||||
|
||||
def get_contacts(self,nm):
|
||||
|
||||
Reference in New Issue
Block a user