[website] [sitemap] cleanup
This commit is contained in:
parent
be78d05a0b
commit
ebdddf3fb6
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-03 14:11:36",
|
||||
"modified": "2013-11-18 15:16:50",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -179,12 +179,11 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Enter the date by which payments from customer is expected against this invoice.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "due_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Due Date",
|
||||
"label": "Payment Due Date",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "due_date",
|
||||
"oldfieldtype": "Date",
|
||||
@ -821,7 +820,6 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Track this Sales Invoice against any Project",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "project_name",
|
||||
"fieldtype": "Link",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-04-10 11:45:37",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-06 11:27:57",
|
||||
"modified": "2013-11-18 15:12:07",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -73,13 +73,12 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Name of organization from where lead has come",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Company Name",
|
||||
"label": "Organization Name",
|
||||
"oldfieldname": "company_name",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 0,
|
||||
@ -116,7 +115,6 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Source of the lead. If via a campaign, select \"Campaign\"",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "source",
|
||||
"fieldtype": "Select",
|
||||
@ -181,7 +179,6 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"description": "Your sales person who will contact the lead in future",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_by",
|
||||
"fieldtype": "Link",
|
||||
@ -197,7 +194,7 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"description": "Your sales person will get a reminder on this date to contact the lead",
|
||||
"description": "Add to calendar on this date",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_date",
|
||||
"fieldtype": "Date",
|
||||
|
@ -4,46 +4,31 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
|
||||
from webnotes.utils.nestedset import DocTypeNestedSet
|
||||
from webnotes.webutils import WebsiteGenerator
|
||||
|
||||
class DocType(DocTypeNestedSet):
|
||||
class DocType(DocTypeNestedSet, WebsiteGenerator):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.nsm_parent_field = 'parent_item_group'
|
||||
|
||||
def on_update(self):
|
||||
super(DocType, self).on_update()
|
||||
DocTypeNestedSet.on_update(self)
|
||||
WebsiteGenerator.on_update(self)
|
||||
|
||||
self.validate_name_with_item()
|
||||
|
||||
from selling.utils.product import invalidate_cache_for
|
||||
|
||||
if self.doc.show_in_website:
|
||||
from webnotes.webutils import update_page_name
|
||||
# webpage updates
|
||||
page_name = self.doc.name
|
||||
update_page_name(self.doc, page_name)
|
||||
invalidate_cache_for(self.doc.name)
|
||||
|
||||
elif self.doc.page_name:
|
||||
# if unchecked show in website
|
||||
|
||||
from webnotes.webutils 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)
|
||||
|
||||
invalidate_cache_for(self.doc.name)
|
||||
|
||||
self.validate_one_root()
|
||||
|
||||
def validate_name_with_item(self):
|
||||
if webnotes.conn.exists("Item", self.doc.name):
|
||||
webnotes.msgprint("An item exists with same name (%s), please change the \
|
||||
item group name or rename the item" % self.doc.name, raise_exception=1)
|
||||
|
||||
|
||||
def get_context(self):
|
||||
from selling.utils.product import get_product_list_for_group, \
|
||||
get_parent_item_groups, get_group_item_count
|
||||
|
@ -4,9 +4,10 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cint, cstr, filter_strip_join
|
||||
from website.webutils import WebsiteGenerator
|
||||
|
||||
|
||||
class DocType:
|
||||
class DocType(WebsiteGenerator):
|
||||
def __init__(self, doc, doclist=None):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
@ -16,13 +17,8 @@ class DocType:
|
||||
self.doc.partner_website = "http://" + self.doc.partner_website
|
||||
|
||||
def on_update(self):
|
||||
if cint(self.doc.show_in_website):
|
||||
from webnotes.webutils import update_page_name
|
||||
update_page_name(self.doc, self.doc.partner_name)
|
||||
|
||||
WebsiteGenerator.on_update()
|
||||
if self.doc.page_name:
|
||||
from webnotes.webutils import clear_cache
|
||||
clear_cache(self.doc.page_name)
|
||||
clear_cache("partners")
|
||||
|
||||
def get_contacts(self,nm):
|
||||
|
@ -8,12 +8,13 @@ from webnotes.utils import cstr, flt, cint
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.webutils import WebsiteGenerator
|
||||
|
||||
from webnotes.model.controller import DocListController
|
||||
|
||||
class WarehouseNotSet(Exception): pass
|
||||
|
||||
class DocType(DocListController):
|
||||
class DocType(DocListController, WebsiteGenerator):
|
||||
def onload(self):
|
||||
self.doc.fields["__sle_exists"] = self.check_if_sle_exists()
|
||||
|
||||
@ -212,34 +213,21 @@ class DocType(DocListController):
|
||||
self.doc.name, raise_exception=1)
|
||||
|
||||
def update_website(self):
|
||||
def _invalidate_cache():
|
||||
from selling.utils.product import invalidate_cache_for
|
||||
|
||||
invalidate_cache_for(self.doc.item_group)
|
||||
from selling.utils.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"})]
|
||||
|
||||
[invalidate_cache_for(d.item_group) for d in \
|
||||
self.doclist.get({"doctype":"Website Item Group"})]
|
||||
WebsiteGenerator.on_update(self)
|
||||
|
||||
def get_page_title(self):
|
||||
if self.doc.name==self.doc.item_name:
|
||||
page_name_from = self.doc.name
|
||||
else:
|
||||
page_name_from = self.doc.name + " " + self.doc.item_name
|
||||
|
||||
if self.doc.show_in_website:
|
||||
from webnotes.webutils import update_page_name
|
||||
if self.doc.name==self.doc.item_name:
|
||||
page_name_from = self.doc.name
|
||||
else:
|
||||
page_name_from = self.doc.name + " " + self.doc.item_name
|
||||
|
||||
update_page_name(self.doc, page_name_from)
|
||||
|
||||
_invalidate_cache()
|
||||
return page_name_from
|
||||
|
||||
elif self.doc.page_name:
|
||||
# if unchecked show in website
|
||||
from webnotes.webutils import delete_page_cache
|
||||
delete_page_cache(self.doc.page_name)
|
||||
|
||||
_invalidate_cache()
|
||||
|
||||
webnotes.conn.set(self.doc, "page_name", None)
|
||||
|
||||
def get_tax_rate(self, tax_type):
|
||||
return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") }
|
||||
|
||||
@ -263,10 +251,7 @@ class DocType(DocListController):
|
||||
|
||||
def on_trash(self):
|
||||
webnotes.conn.sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
|
||||
|
||||
if self.doc.page_name:
|
||||
from webnotes.webutils import clear_cache
|
||||
clear_cache(self.doc.page_name)
|
||||
WebsiteGenerator.on_trash(self)
|
||||
|
||||
def on_rename(self, newdn, olddn, merge=False):
|
||||
webnotes.conn.sql("update tabItem set item_code = %s where name = %s", (newdn, olddn))
|
||||
|
Loading…
x
Reference in New Issue
Block a user