This commit is contained in:
Rushabh Mehta 2014-03-27 16:12:32 +05:30
parent 57acf4e9cb
commit e69de80cfc
67 changed files with 231 additions and 243 deletions

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class BulkEmail(Document):
pass

View file

@ -5,9 +5,9 @@ from __future__ import unicode_literals
import frappe, json
from frappe.website.render import clear_cache
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Comment(Document):
def validate(self):
if frappe.db.sql("""select count(*) from tabComment where comment_doctype=%s

View file

@ -12,11 +12,9 @@ from frappe.utils.email_lib.email_body import get_email
from frappe.utils.email_lib.smtp import send
from frappe.utils import scrub_urls
class DocType():
def __init__(self, doc, doclist=None):
self.doc = doc
self.doclist = doclist
from frappe.model.document import Document
class Communication(Document):
def get_parent_bean(self):
return frappe.bean(self.doc.parenttype, self.doc.parent)

View file

@ -7,10 +7,9 @@ import frappe
from frappe import form, msgprint
import frappe.defaults
class DocType:
def __init__(self, doc, doclist):
self.doc = doc
self.doclist = doclist
from frappe.model.document import Document
class ControlPanel(Document):
def on_update(self):
# clear cache on save

View file

@ -6,9 +6,9 @@ import frappe
from frappe.utils import cint, cstr
from frappe import _
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class CustomField(Document):
def autoname(self):
self.set_fieldname()

View file

@ -4,9 +4,9 @@ from __future__ import unicode_literals
import frappe
from frappe.utils import cstr
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class CustomScript(Document):
def autoname(self):
self.doc.name = self.doc.dt + "-" + self.doc.script_type

View file

@ -9,7 +9,9 @@ from __future__ import unicode_literals
import frappe, json
from frappe.utils import cstr
class DocType:
from frappe.model.document import Document
class CustomizeForm(Document):
def __init__(self, doc, doclist=[]):
self.doc, self.doclist = doc, doclist
self.doctype_properties = [
@ -57,12 +59,10 @@ class DocType:
self.clear()
if self.doc.doc_type:
from frappe.model.doc import addchild
for d in self.get_ref_doclist():
if d.doctype=='DocField':
new = addchild(self.doc, 'fields', 'Customize Form Field',
self.doclist)
new = self.doc.append('fields', {})
self.set(
{
'list': self.docfield_properties,
@ -94,7 +94,7 @@ class DocType:
Clear fields in the doc
"""
# Clear table before adding new doctype's fields
self.doclist = self.doc.clear_table(self.doclist, 'fields')
self.set('fields', [])
self.set({ 'list': self.doctype_properties, 'value': None })

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class CustomizeFormField(Document):
pass

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class DefaultHomePage(Document):
pass

View file

@ -4,9 +4,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Defaultvalue(Document):
def on_doctype_update():
if not frappe.db.sql("""show index from `tabDefaultValue`

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class DocField(Document):
pass

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class DocPerm(Document):
pass

View file

@ -134,7 +134,7 @@ class DocType(Document):
with open(pypath, 'w') as pyfile:
with open(os.path.join(get_module_path("core"), "doctype", "doctype",
"doctype_template.py"), 'r') as srcfile:
pyfile.write(srcfile.read().format(app_publisher=app_publisher))
pyfile.write(srcfile.read().format(app_publisher=app_publisher, classname=self.name.replace(" ", "")))
def make_amendable(self):
"""

View file

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
class {classname}(Document):
pass

View file

@ -14,14 +14,6 @@ class Event(Document):
def validate(self):
if self.starts_on and self.ends_on and self.starts_on > self.ends_on:
frappe.msgprint(frappe._("Event End must be after Start"), raise_exception=True)
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def validate(self):
if self.doc.starts_on and self.doc.ends_on and self.doc.starts_on > self.doc.ends_on:
frappe.msgprint(frappe._("Event End must be after Start"), raise_exception=True)
def get_permission_query_conditions():
return """(tabEvent.event_type='Public' or tabEvent.owner='%(user)s'

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class EventRole(Document):
pass

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class EventUser(Document):
pass

View file

@ -10,11 +10,9 @@ naming for same name files: file.gif, file-1.gif, file-2.gif etc
import frappe, frappe.utils, os
from frappe import conf
from frappe.model.document import Document
class DocType():
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
class FileData(Document):
def before_insert(self):
frappe.local.rollback_observers.append(self)

View file

@ -5,10 +5,9 @@ from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
from frappe.model.document import Document
class LetterHead(Document):
def validate(self):
self.set_as_default()

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class ModuleDef(Document):
pass

View file

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class NotificationCount(Document):
@frappe.whitelist()
def get_notifications():

View file

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class OutgoingEmailSettings(Document):
def validate(self):
self.doc.encode()

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class PageRole(Document):
pass

View file

@ -6,6 +6,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class PatchLog(Document):
pass

View file

@ -8,7 +8,9 @@ from frappe.modules import get_doc_path
standard_format = "templates/print_formats/standard.html"
class DocType:
from frappe.model.document import Document
class PrintFormat(Document):
def __init__(self, d, dl):
self.doc, self.doclist = d,dl

View file

@ -4,9 +4,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class PropertySetter(Document):
def autoname(self):
self.doc.name = self.doc.doc_type + "-" \

View file

@ -5,7 +5,9 @@ from __future__ import unicode_literals
import frappe
from frappe import conf, _
class DocType:
from frappe.model.document import Document
class Report(Document):
def __init__(self, doc, doclist):
self.doc, self.doclist = doc, doclist

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Role(Document):
pass

View file

@ -6,6 +6,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class SchedulerLog(Document):
pass

View file

@ -6,6 +6,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class SocialLoginKeys(Document):
pass

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Tag(Document):
pass

View file

@ -4,9 +4,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Todo(Document):
def validate(self):
if self.doc.is_new():

View file

@ -9,10 +9,9 @@ from frappe.auth import _update_password
STANDARD_USERS = ("Guest", "Administrator")
class DocType:
def __init__(self, doc, doclist):
self.doc = doc
self.doclist = doclist
from frappe.model.document import Document
class User(Document):
def autoname(self):
"""set name as email id"""
@ -49,7 +48,7 @@ class DocType:
def add_system_manager_role(self):
# if adding system manager, do nothing
if not cint(self.doc.enabled) or ("System Manager" in [user_role.role for user_role in
self.doclist.get({"parentfield": "user_roles"})]):
self.get("user_roles")]):
return
if self.doc.user_type == "System User" and not self.get_other_system_managers():

View file

@ -5,9 +5,9 @@ from __future__ import unicode_literals
import frappe
from frappe.utils import cint
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Userrole(Document):
def validate(self):
if cint(self.doc.fields.get("__islocal")) and frappe.db.exists("UserRole", {

View file

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe, json
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Version(Document):
@frappe.whitelist()
def restore(version):

View file

@ -4,9 +4,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Workflow(Document):
def validate(self):
self.set_active()

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WorkflowAction(Document):
pass

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WorkflowDocumentState(Document):
pass

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WorkflowState(Document):
pass

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WorkflowTransition(Document):
pass

View file

@ -34,9 +34,9 @@ def copytables(srctype, src, srcfield, tartype, tar, tarfield, srcfields, tarfie
if not tarfields:
tarfields = srcfields
l = []
data = frappe.model.doc.getchildren(src.name, srctype, srcfield)
data = src.get(srcfield)
for d in data:
newrow = frappe.model.doc.addchild(tar, tarfield, tartype)
newrow = tar.append(tarfield)
newrow.idx = d.idx
for i in range(len(srcfields)):

View file

@ -33,9 +33,15 @@ class BaseDocument(object):
def get(self, key=None, filters=None, limit=None, default=None):
if key:
if filters:
return _filter(self.__dict__.get(key), filters, limit=limit)
value = _filter(self.__dict__.get(key), filters, limit=limit)
else:
return self.__dict__.get(key, default)
value = self.__dict__.get(key, default)
if value is None and key in self.get_table_fields():
self.set(key, [])
value = self.__dict__.get(key)
return value
else:
return self.__dict__
@ -48,11 +54,15 @@ class BaseDocument(object):
self.__dict__[key] = value
def append(self, key, value):
def append(self, key, value=None):
if value==None:
value={}
if isinstance(value, dict):
if not self.get(key):
self.__dict__[key] = []
self.get(key).append(self._init_child(value, key))
value = self._init_child(value, key)
self.get(key).append(value)
return value
else:
raise ValueError

View file

@ -51,7 +51,6 @@ class Bean:
"""
Load doclist from dt
"""
from frappe.model.doc import getchildren
if not dt: dt = self.doc.doctype
if not dn: dn = self.doc.name
@ -63,8 +62,6 @@ class Bean:
# load chilren
doclist = frappe.doclist([doc,])
for t in tablefields:
doclist += getchildren(doc.name, t[0], t[1], dt)
self.set_doclist(doclist)
@ -432,7 +429,7 @@ class Bean:
if df.doctype=="DocField" and df.reqd and df.parent==doc.doctype and df.fieldname!="naming_series":
msg = ""
if df.fieldtype == "Table":
if not self.doclist.get({"parentfield": df.fieldname}):
if not self.get(df.fieldname):
msg = _("Error") + ": " + _("Data missing in table") + ": " + _(df.label)
elif doc.fields.get(df.fieldname) is None:

View file

@ -56,7 +56,7 @@ class DocListController(Document):
msgprint(msg, raise_exception=raise_exception or True)
def validate_table_has_rows(self, parentfield, raise_exception=None):
if not self.doclist.get({"parentfield": parentfield}):
if not self.get(parentfield):
label = self.meta.get_label(parentfield)
msgprint(_("Error") + ": " + _(label) + " " + _("cannot be empty"),
raise_exception=raise_exception or EmptyTableError)

View file

@ -545,29 +545,6 @@ class Document:
self.fields['__unsaved'] = 1
return frappe.doclist(doclist)
def addchild(self, fieldname, childtype = '', doclist=None):
"""
Returns a child record of the give `childtype`.
* if local is set, it does not save the record
* if doclist is passed, it append the record to the doclist
"""
from frappe.model.doc import Document
d = Document()
d.parent = self.name
d.parenttype = self.doctype
d.parentfield = fieldname
d.doctype = childtype
d.docstatus = 0;
d.name = ''
d.owner = frappe.session['user']
d.fields['__islocal'] = 1 # for Client to identify unsaved doc
if doclist != None:
doclist.append(d)
return d
def get_values(self):
"""get non-null fields dict withouth standard fields"""
@ -581,21 +558,7 @@ class Document:
def get_db_value(self, key):
return frappe.db.get_value(self.doctype, self.name, key)
def addchild(parent, fieldname, childtype = '', doclist=None):
"""
Create a child record to the parent doc.
Example::
c = Document('Contact','ABC')
d = addchild(c, 'contact_updates', 'Contact Update')
d.last_updated = 'Phone call'
d.save(1)
"""
return parent.addchild(fieldname, childtype, doclist)
def make_autoname(key, doctype=''):
"""
Creates an autoname from the given key:

View file

@ -132,12 +132,26 @@ class Document(BaseDocument):
self.db_update()
# children
child_map = {}
ignore_children_type = self.get("_ignore_children_type", [])
for d in self.get_all_children():
if d.doctype not in _ignore_children_type:
d.parent = self.name
d.db_update()
d.parent = self.name # rename if reqd
d.parenttype = self.doctype
d.db_update()
child_map.setdefault(d.doctype, []).append(d.name)
for df in self.get_table_fields():
if df.options not in ignore_children_type:
cnames = child_map.get(df.options) or []
if cnames:
frappe.db.sql("""delete from `tab%s` where parent=%s and parenttype=%s and
name not in (%s)""" % (df.options, '%s', '%s', ','.join(['%s'] * len(cnames))),
tuple([self.name, self.doctype] + cnames))
else:
frappe.db.sql("""delete from `tab%s` where parent=%s and parenttype=%s""" \
% (df.options, '%s', '%s'), (self.name, self.doctype))
self.run_post_save_methods()
def update_single(self, d):

View file

@ -14,6 +14,7 @@ from __future__ import unicode_literals
import frappe
from frappe import msgprint, _
from frappe.model.document import Document
class NestedSetRecursionError(frappe.ValidationError): pass
class NestedSetMultipleRootsError(frappe.ValidationError): pass
@ -188,7 +189,7 @@ def validate_loop(doctype, name, lft, rgt):
"%s", "%s"), (lft, rgt)):
frappe.throw("""Item cannot be added to its own descendents.""", NestedSetRecursionError)
class DocTypeNestedSet(object):
class DocTypeNestedSet(Document):
def on_update(self):
update_nsm(self)
self.validate_ledger()

View file

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class AboutUsSettings(Document):
def on_update(self):
from frappe.website.render import clear_cache

View file

@ -6,6 +6,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class AboutUsTeamMember(Document):
pass

View file

@ -6,9 +6,7 @@ import frappe
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
class DocType(WebsiteGenerator):
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
class BlogCategory(WebsiteGenerator):
def autoname(self):
# to override autoname of WebsiteGenerator

View file

@ -10,9 +10,7 @@ from frappe.website.render import clear_cache
from frappe import _
from frappe.utils import today
class DocType(WebsiteGenerator):
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
class BlogPost(WebsiteGenerator):
self.save_versions = True
def get_page_title(self):

View file

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class BlogSettings(Document):
def on_update(self):
from frappe.website.render import clear_cache

View file

@ -7,9 +7,9 @@ from __future__ import unicode_literals
import frappe
from frappe import _
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Blogger(Document):
def on_update(self):
"if user is set, then update all older blogs"

View file

@ -6,6 +6,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class CompanyHistory(Document):
pass

View file

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class ContactUsSettings(Document):
def on_update(self):
from frappe.website.render import clear_cache

View file

@ -10,9 +10,9 @@ from frappe.utils import get_fullname
from frappe.utils.email_lib.bulk import send
from frappe.utils.email_lib import sendmail
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class Post(Document):
def validate(self):
if not self.doc.parent_post and not self.doc.title:

View file

@ -7,9 +7,9 @@ import frappe
from frappe.utils import cint, cstr
from frappe import _
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class StyleSettings(Document):
def validate(self):
"""make custom css"""

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class TopBarItem(Document):
pass

View file

@ -5,9 +5,9 @@ from __future__ import unicode_literals
import frappe
from frappe.website.permissions import get_access
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class UserVote(Document):
def validate(self):
# if new

View file

@ -7,9 +7,7 @@ from frappe.website.website_generator import WebsiteGenerator
from frappe.templates.generators.website_group import clear_cache
from frappe.model.doc import make_autoname
class DocType(WebsiteGenerator):
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
class WebsiteGroup(WebsiteGenerator):
def get_page_title(self):
return self.doc.group_title

View file

@ -10,9 +10,7 @@ from frappe.utils.nestedset import DocTypeNestedSet
sitemap_fields = ("page_name", "ref_doctype", "docname", "page_or_generator", "idx",
"lastmod", "parent_website_route", "public_read", "public_write", "page_title")
class DocType(DocTypeNestedSet):
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
class WebsiteRoute(DocTypeNestedSet):
self.nsm_parent_field = "parent_website_route"
def autoname(self):

View file

@ -6,9 +6,9 @@ import frappe
from frappe.website.permissions import remove_empty_permissions, clear_permissions
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WebsiteRoutePermission(Document):
def on_update(self):
remove_empty_permissions()

View file

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WebsiteScript(Document):
def on_update(self):
"""clear cache"""

View file

@ -8,7 +8,7 @@ from frappe.utils import get_request_site_address, encode
from frappe.model.controller import DocListController
from urllib import quote
class DocType(DocListController):
class WebsiteSettings(DocListController):
def validate(self):
self.validate_top_bar_items()
self.validate_footer_items()
@ -21,7 +21,7 @@ class DocType(DocListController):
def validate_top_bar_items(self):
"""validate url in top bar items"""
for top_bar_item in self.doclist.get({"parentfield": "top_bar_items"}):
for top_bar_item in self.get("top_bar_items"):
if top_bar_item.parent_label:
parent_label_item = self.doclist.get({"parentfield": "top_bar_items",
"label": top_bar_item.parent_label})
@ -38,7 +38,7 @@ class DocType(DocListController):
def validate_footer_items(self):
"""clear parent label in footer"""
for footer_item in self.doclist.get({"parentfield": "footer_items"}):
for footer_item in self.get("footer_items"):
footer_item.parent_label = None
def on_update(self):

View file

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WebsiteSlideshow(Document):
def on_update(self):
# a slide show can be in use and any change in it should get reflected

View file

@ -6,6 +6,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WebsiteSlideshowItem(Document):
pass

View file

@ -11,9 +11,9 @@ from frappe import _
from frappe.website.doctype.website_route.website_route import add_to_sitemap, update_sitemap, cleanup_sitemap
from frappe.utils.nestedset import rebuild_tree
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class WebsiteTemplate(Document):
def after_insert(self):
if self.doc.page_or_generator == "Page":