瀏覽代碼

fix to sitemap

version-14
Rushabh Mehta 11 年之前
父節點
當前提交
893d026a8a
共有 1 個檔案被更改,包括 9 行新增3 行删除
  1. +9
    -3
      frappe/website/doctype/website_sitemap/website_sitemap.py

+ 9
- 3
frappe/website/doctype/website_sitemap/website_sitemap.py 查看文件

@@ -35,12 +35,18 @@ class DocType(DocTypeNestedSet):
self.set_idx()

def renumber_if_moved(self):
if self.doc.old_parent != self.doc.parent_website_sitemap:
current_parent = frappe.conn.get_value("Website Sitemap", self.doc.name, "parent_website_sitemap")
if current_parent and current_parent != self.doc.parent_website_sitemap:
# move-up
# sitemap
frappe.conn.sql("""update `tabWebsite Sitemap` set idx=idx-1
where parent_website_sitemap=%s and idx>%s""", (self.doc.old_parent, self.doc.idx))
where parent_website_sitemap=%s and idx>%s""", (current_parent, self.doc.idx))
# source table
frappe.conn.sql("""update `tab{0}` set idx=idx-1
where parent_website_sitemap=%s and idx>%s""".format(self.doc.ref_doctype),
(self.doc.old_parent, self.doc.idx))
(current_parent, self.doc.idx))
self.doc.idx = None
def set_idx(self):


Loading…
取消
儲存