Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait
2012-12-25 18:17:16 +05:30
20 changed files with 197 additions and 89 deletions

View File

@@ -27,6 +27,7 @@ class DocType(DocTypeNestedSet):
self.nsm_parent_field = 'parent_item_group';
def on_update(self):
super(DocType, self).on_update()
if self.doc.show_in_website:
# webpage updates
from website.utils import update_page_name
@@ -38,6 +39,16 @@ class DocType(DocTypeNestedSet):
update_page_name(self.doc, self.doc.name)
def prepare_template_args(self):
from website.helpers.product import get_product_list_for_group, \
get_parent_item_groups, get_group_item_count
self.doc.sub_groups = webnotes.conn.sql("""select name, page_name
from `tabItem Group` where parent_item_group=%s
and ifnull(show_in_website,0)=1""", self.doc.name, as_dict=1)
and ifnull(show_in_website,0)=1""", self.doc.name, as_dict=1)
for d in self.doc.sub_groups:
d.count = get_group_item_count(d.name)
self.doc.items = get_product_list_for_group(product_group = self.doc.name, limit=20)
self.parent_groups = get_parent_item_groups(self.doc.name)