Rushabh Mehta 11 лет назад
Родитель
Сommit
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() self.set_idx()


def renumber_if_moved(self): 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 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 frappe.conn.sql("""update `tab{0}` set idx=idx-1
where parent_website_sitemap=%s and idx>%s""".format(self.doc.ref_doctype), 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 self.doc.idx = None
def set_idx(self): def set_idx(self):


Загрузка…
Отмена
Сохранить