From 3f51705ba4d649b8f6986d72584631d40f8e2025 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 21 Apr 2014 22:10:15 +0530 Subject: [PATCH] website cleanups --- .../setup/doctype/item_group/item_group.py | 5 +- .../page/setup_wizard/default_website.py | 5 ++ .../page/setup_wizard/install_fixtures.py | 19 +++--- erpnext/templates/generators/item.html | 13 ++-- erpnext/templates/generators/item_group.html | 21 +------ erpnext/templates/generators/item_group.py | 19 +++--- .../templates/includes/product_in_grid.html | 4 +- .../templates/includes/product_in_list.html | 4 +- .../includes/product_search_box.html | 59 ++++++++++--------- erpnext/templates/pages/product_search.py | 13 ++-- 10 files changed, 77 insertions(+), 85 deletions(-) diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index e29297c6dd..63bf3b481c 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -16,8 +16,9 @@ class ItemGroup(NestedSet, WebsiteGenerator): def validate(self): if not self.parent_website_route: - self.parent_website_route = frappe.get_website_route("Item Group", - self.parent_item_group) + if frappe.db.get_value("Item Group", self.parent_item_group, "show_in_website"): + self.parent_website_route = frappe.get_website_route("Item Group", + self.parent_item_group) def on_update(self): NestedSet.on_update(self) diff --git a/erpnext/setup/page/setup_wizard/default_website.py b/erpnext/setup/page/setup_wizard/default_website.py index 1667d878c5..3f1d8e1af9 100644 --- a/erpnext/setup/page/setup_wizard/default_website.py +++ b/erpnext/setup/page/setup_wizard/default_website.py @@ -55,6 +55,11 @@ class website_maker(object): "label":"Blog", "url": "blog" }) + website_settings.append("top_bar_items", { + "doctype": "Top Bar Item", + "label": _("Products"), + "url": frappe.db.get_value("Website Route", {"ref_doctype":"Item Group"}) + }) website_settings.save() def make_blog(self): diff --git a/erpnext/setup/page/setup_wizard/install_fixtures.py b/erpnext/setup/page/setup_wizard/install_fixtures.py index 8eaa1c024d..67e83502cc 100644 --- a/erpnext/setup/page/setup_wizard/install_fixtures.py +++ b/erpnext/setup/page/setup_wizard/install_fixtures.py @@ -11,13 +11,18 @@ def install(): records = [ # item group - {'doctype': 'Item Group', 'item_group_name': _('All Item Groups'), 'is_group': 'Yes', 'parent_item_group': ''}, - {'doctype': 'Item Group', 'item_group_name': _('Products'), 'is_group': 'No', - 'parent_item_group': _('All Item Groups'), "show_in_website": 1 }, - {'doctype': 'Item Group', 'item_group_name': _('Raw Material'), 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, - {'doctype': 'Item Group', 'item_group_name': _('Services'), 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, - {'doctype': 'Item Group', 'item_group_name': _('Sub Assemblies'), 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, - {'doctype': 'Item Group', 'item_group_name': _('Consumable'), 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, + {'doctype': 'Item Group', 'item_group_name': _('All Item Groups'), + 'is_group': 'Yes', 'parent_item_group': ''}, + {'doctype': 'Item Group', 'item_group_name': _('Products'), + 'is_group': 'No', 'parent_item_group': _('All Item Groups'), "show_in_website": 1 }, + {'doctype': 'Item Group', 'item_group_name': _('Raw Material'), + 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, + {'doctype': 'Item Group', 'item_group_name': _('Services'), + 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, + {'doctype': 'Item Group', 'item_group_name': _('Sub Assemblies'), + 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, + {'doctype': 'Item Group', 'item_group_name': _('Consumable'), + 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, # deduction type {'doctype': 'Deduction Type', 'name': _('Income Tax'), 'description': _('Income Tax'), 'deduction_name': _('Income Tax')}, diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html index d560b80d00..8db39a3e3b 100644 --- a/erpnext/templates/generators/item.html +++ b/erpnext/templates/generators/item.html @@ -22,19 +22,20 @@ {% endif %}
-

{{ item_name }}

-

Item Code: {{ name }}

-

Product Description

+
- {{ web_long_description or description or "[No description given]" }} + {{ web_long_description or description or _("No description given") }}
+

+ {{ _("Item Code") }}: {{ name }}

+