Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
ac46aac46e
@ -31,9 +31,12 @@ class DocType(DocTypeNestedSet):
|
||||
|
||||
self.validate_name_with_item()
|
||||
|
||||
from website.helpers.product import invalidate_cache_for
|
||||
|
||||
|
||||
if self.doc.show_in_website:
|
||||
# webpage updates
|
||||
from website.utils 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:
|
||||
@ -43,9 +46,18 @@ class DocType(DocTypeNestedSet):
|
||||
|
||||
update_page_name(self.doc, page_name)
|
||||
|
||||
from website.helpers.product import invalidate_cache_for
|
||||
invalidate_cache_for(self.doc.name)
|
||||
|
||||
elif self.doc.page_name:
|
||||
# if unchecked show in website
|
||||
|
||||
from website.utils 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 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 \
|
||||
|
@ -39,7 +39,6 @@ class DocType:
|
||||
def on_update(self):
|
||||
self.validate_name_with_item_group()
|
||||
|
||||
if self.doc.show_in_website:
|
||||
# webpage updates
|
||||
self.update_website()
|
||||
|
||||
@ -81,6 +80,15 @@ class DocType:
|
||||
self.doc.name, raise_exception=1)
|
||||
|
||||
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 website.utils import update_page_name
|
||||
if self.doc.name==self.doc.item_name:
|
||||
page_name_from = self.doc.name
|
||||
@ -89,11 +97,16 @@ class DocType:
|
||||
|
||||
update_page_name(self.doc, page_name_from)
|
||||
|
||||
from website.helpers.product import invalidate_cache_for
|
||||
invalidate_cache_for(self.doc.item_group)
|
||||
_invalidate_cache()
|
||||
|
||||
[invalidate_cache_for(d.item_group) for d in \
|
||||
self.doclist.get({"doctype":"Website Item Group"})]
|
||||
elif self.doc.page_name:
|
||||
# if unchecked show in website
|
||||
from website.utils import delete_page_cache
|
||||
delete_page_cache(self.doc.page_name)
|
||||
|
||||
_invalidate_cache()
|
||||
|
||||
webnotes.conn.set(self.doc, "page_name", None)
|
||||
|
||||
# On delete 1. Delete BIN (if none of the corrosponding transactions present, it gets deleted. if present, rolled back due to exception)
|
||||
def on_trash(self):
|
||||
|
Loading…
Reference in New Issue
Block a user