[cleanup] homepage

This commit is contained in:
Rushabh Mehta
2016-05-12 15:22:59 +05:30
parent 825070e504
commit 4b9238a03b
24 changed files with 172 additions and 157 deletions

View File

@@ -135,7 +135,7 @@
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
@@ -151,7 +151,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2016-05-02 18:03:13.165280",
"modified": "2016-05-12 14:19:41.689519",
"modified_by": "Administrator",
"module": "Portal",
"name": "Homepage",

View File

@@ -7,4 +7,19 @@ import frappe
from frappe.model.document import Document
class Homepage(Document):
pass
def validate(self):
if not self.products:
self.setup_items()
if not self.description:
self.description = frappe._("This is an example website auto-generated from ERPNext")
def setup_items(self):
for d in frappe.get_all('Item', fields=['name', 'item_name', 'description', 'image'],
filters={'show_in_website': 1}, limit=3):
# set missing routes (?)
doc = frappe.get_doc('Item', d.name)
doc.save()
self.append('products', dict(item_code=d.name,
item_name=d.item_name, description=d.description, image=d.image))