[route] refactor, wip

This commit is contained in:
Rushabh Mehta 2014-08-19 16:20:04 +05:30
parent 74bc2baa1d
commit cb067aa579
7 changed files with 744 additions and 739 deletions

View File

@ -65,9 +65,11 @@ class StatusUpdater(Document):
self.validate_qty() self.validate_qty()
def set_status(self, update=False): def set_status(self, update=False):
if self.get("__islocal"): if self.is_new():
return return
_status = self.status
if self.doctype in status_map: if self.doctype in status_map:
sl = status_map[self.doctype][:] sl = status_map[self.doctype][:]
sl.reverse() sl.reverse()
@ -83,9 +85,11 @@ class StatusUpdater(Document):
self.status = s[0] self.status = s[0]
break break
if self.status != _status:
self.add_comment("Label", self.status)
if update: if update:
frappe.db.set_value(self.doctype, self.name, "status", self.status) frappe.db.set_value(self.doctype, self.name, "status", self.status)
self.add_comment("Label", self.status)
def on_communication(self): def on_communication(self):
if not self.get("communications"): return if not self.get("communications"): return

View File

@ -18,7 +18,7 @@
<span class="label label-warning filterable" <span class="label label-warning filterable"
data-filter="per_delivered,<,100|status,!=,Stopped" data-filter="per_delivered,<,100|status,!=,Stopped"
title="{%= __("Pending") %}"> title="{%= __("Pending") %}">
{%= doc.get_formatted("delivery_date")%}</span> {%= doc.get_formatted("delivery_date") || "Pending" %}</span>
{% } %} {% } %}
{% } %} {% } %}
{% if(doc.per_delivered == 100 && doc.status!=="Stopped") { %} {% if(doc.per_delivered == 100 && doc.status!=="Stopped") { %}

View File

@ -83,10 +83,11 @@
{ {
"depends_on": "show_in_website", "depends_on": "show_in_website",
"fieldname": "parent_website_route", "fieldname": "parent_website_route",
"fieldtype": "Link", "fieldtype": "Read Only",
"label": "Parent Website Page", "label": "Parent Website Route",
"options": "Website Route", "options": "",
"permlevel": 0 "permlevel": 0,
"read_only": 1
}, },
{ {
"depends_on": "show_in_website", "depends_on": "show_in_website",
@ -163,7 +164,7 @@
"in_create": 1, "in_create": 1,
"issingle": 0, "issingle": 0,
"max_attachments": 3, "max_attachments": 3,
"modified": "2014-06-10 05:37:03.763185", "modified": "2014-08-19 06:42:03.262273",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Setup", "module": "Setup",
"name": "Item Group", "name": "Item Group",

View File

@ -103,6 +103,6 @@ def invalidate_cache_for(doc, item_group=None):
item_group = doc.name item_group = doc.name
for i in get_parent_item_groups(item_group): for i in get_parent_item_groups(item_group):
route = frappe.db.get_value("Website Route", {"ref_doctype":"Item Group", "docname": i.name}) route = doc.get_route()
if route: if route:
clear_cache(route) clear_cache(route)

View File

@ -190,16 +190,16 @@
{ {
"default": "partners", "default": "partners",
"fieldname": "parent_website_route", "fieldname": "parent_website_route",
"fieldtype": "Link", "fieldtype": "Read Only",
"label": "Parent Website Route", "label": "Parent Website Route",
"options": "Website Route", "options": "",
"permlevel": 0 "permlevel": 0
} }
], ],
"icon": "icon-user", "icon": "icon-user",
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"modified": "2014-06-27 09:21:33.687012", "modified": "2014-08-19 06:42:33.103060",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Setup", "module": "Setup",
"name": "Sales Partner", "name": "Sales Partner",

View File

@ -59,7 +59,7 @@ class website_maker(object):
website_settings.append("top_bar_items", { website_settings.append("top_bar_items", {
"doctype": "Top Bar Item", "doctype": "Top Bar Item",
"label": _("Products"), "label": _("Products"),
"url": frappe.db.get_value("Website Route", {"ref_doctype":"Item Group"}) "url": "products"
}) })
website_settings.save() website_settings.save()

View File

@ -814,18 +814,18 @@
}, },
{ {
"fieldname": "parent_website_route", "fieldname": "parent_website_route",
"fieldtype": "Link", "fieldtype": "Read Only",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Parent Website Route", "label": "Parent Website Route",
"no_copy": 1, "no_copy": 1,
"options": "Website Route", "options": "",
"permlevel": 0 "permlevel": 0
} }
], ],
"icon": "icon-tag", "icon": "icon-tag",
"idx": 1, "idx": 1,
"max_attachments": 1, "max_attachments": 1,
"modified": "2014-08-18 09:32:57.268763", "modified": "2014-08-19 06:41:28.565607",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item", "name": "Item",