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()
|
self.validate_name_with_item()
|
||||||
|
|
||||||
|
from website.helpers.product import invalidate_cache_for
|
||||||
|
|
||||||
|
|
||||||
if self.doc.show_in_website:
|
if self.doc.show_in_website:
|
||||||
# webpage updates
|
|
||||||
from website.utils import update_page_name
|
from website.utils import update_page_name
|
||||||
|
# webpage updates
|
||||||
page_name = self.doc.name
|
page_name = self.doc.name
|
||||||
if webnotes.conn.get_value("Product Settings", None,
|
if webnotes.conn.get_value("Product Settings", None,
|
||||||
"default_product_category")==self.doc.name:
|
"default_product_category")==self.doc.name:
|
||||||
@ -43,9 +46,18 @@ class DocType(DocTypeNestedSet):
|
|||||||
|
|
||||||
update_page_name(self.doc, page_name)
|
update_page_name(self.doc, page_name)
|
||||||
|
|
||||||
from website.helpers.product import invalidate_cache_for
|
|
||||||
invalidate_cache_for(self.doc.name)
|
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):
|
def validate_name_with_item(self):
|
||||||
if webnotes.conn.exists("Item", self.doc.name):
|
if webnotes.conn.exists("Item", self.doc.name):
|
||||||
webnotes.msgprint("An item exists with same name (%s), please change the \
|
webnotes.msgprint("An item exists with same name (%s), please change the \
|
||||||
|
@ -39,7 +39,6 @@ class DocType:
|
|||||||
def on_update(self):
|
def on_update(self):
|
||||||
self.validate_name_with_item_group()
|
self.validate_name_with_item_group()
|
||||||
|
|
||||||
if self.doc.show_in_website:
|
|
||||||
# webpage updates
|
# webpage updates
|
||||||
self.update_website()
|
self.update_website()
|
||||||
|
|
||||||
@ -81,6 +80,15 @@ class DocType:
|
|||||||
self.doc.name, raise_exception=1)
|
self.doc.name, raise_exception=1)
|
||||||
|
|
||||||
def update_website(self):
|
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
|
from website.utils import update_page_name
|
||||||
if self.doc.name==self.doc.item_name:
|
if self.doc.name==self.doc.item_name:
|
||||||
page_name_from = self.doc.name
|
page_name_from = self.doc.name
|
||||||
@ -89,11 +97,16 @@ class DocType:
|
|||||||
|
|
||||||
update_page_name(self.doc, page_name_from)
|
update_page_name(self.doc, page_name_from)
|
||||||
|
|
||||||
from website.helpers.product import invalidate_cache_for
|
_invalidate_cache()
|
||||||
invalidate_cache_for(self.doc.item_group)
|
|
||||||
|
|
||||||
[invalidate_cache_for(d.item_group) for d in \
|
elif self.doc.page_name:
|
||||||
self.doclist.get({"doctype":"Website Item Group"})]
|
# 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)
|
# 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):
|
def on_trash(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user