diff --git a/frappe/client.py b/frappe/client.py index d16c63cb01..34a44648a6 100644 --- a/frappe/client.py +++ b/frappe/client.py @@ -27,7 +27,7 @@ def get_value(doctype, fieldname, filters=None, as_dict=True, debug=False): @frappe.whitelist() def set_value(doctype, name, fieldname, value): - if fieldname in frappe.model.default_fields: + if fieldname!="idx" and fieldname in frappe.model.default_fields: frappe.throw(_("Cannot edit standard fields")) doc = frappe.db.get_value(doctype, name, ["parenttype", "parent"], as_dict=True) diff --git a/frappe/public/js/frappe/model/create_new.js b/frappe/public/js/frappe/model/create_new.js index 6637cf26fb..823126a689 100644 --- a/frappe/public/js/frappe/model/create_new.js +++ b/frappe/public/js/frappe/model/create_new.js @@ -123,7 +123,7 @@ $.extend(frappe.model, { }, copy_doc: function(dt, dn, from_amend) { - var no_copy_list = ['name','amended_from','amendment_date','cancel_reason']; + var no_copy_list = ['name','amended_from','amendment_date','cancel_reason','idx']; var newdoc = frappe.model.get_new_doc(dt); for(var key in locals[dt][dn]) { diff --git a/frappe/public/js/frappe/views/reportview.js b/frappe/public/js/frappe/views/reportview.js index ebde6ec209..de6e6f2c33 100644 --- a/frappe/public/js/frappe/views/reportview.js +++ b/frappe/public/js/frappe/views/reportview.js @@ -313,7 +313,8 @@ frappe.views.ReportView = frappe.ui.Listing.extend({ }, edit_cell: function(row, docfield) { - if(frappe.model.std_fields_list.indexOf(docfield.fieldname)!==-1) { + if(docfield.fieldname !== "idx" && + frappe.model.std_fields_list.indexOf(docfield.fieldname)!==-1) { frappe.throw(frappe._("Cannot edit standard fields")); } else if(frappe.boot.profile.can_write.indexOf(this.doctype)===-1) { frappe.throw(frappe._("No permission to edit")); diff --git a/frappe/public/js/legacy/form.js b/frappe/public/js/legacy/form.js index 5a42f523bf..7a99b51438 100644 --- a/frappe/public/js/legacy/form.js +++ b/frappe/public/js/legacy/form.js @@ -580,6 +580,7 @@ _f.Frm.prototype.copy_doc = function(onload, from_amend) { var dn = this.docname; // copy parent var newdoc = frappe.model.copy_doc(this.doctype, dn, from_amend); + newdoc.idx = null; // copy chidren var dl = make_doclist(this.doctype, dn); diff --git a/frappe/website/doctype/website_group/website_group.py b/frappe/website/doctype/website_group/website_group.py index c85f60c105..c31c8b1ab6 100644 --- a/frappe/website/doctype/website_group/website_group.py +++ b/frappe/website/doctype/website_group/website_group.py @@ -10,9 +10,6 @@ from frappe.model.doc import make_autoname class DocType(WebsiteGenerator): def __init__(self, d, dl): self.doc, self.doclist = d, dl - - def autoname(self): - self.doc.name = make_autoname("Website-Group-.######") def get_page_title(self): return self.doc.group_title diff --git a/frappe/website/doctype/website_group/website_group.txt b/frappe/website/doctype/website_group/website_group.txt index 8a2e91cd92..4f1a16e450 100644 --- a/frappe/website/doctype/website_group/website_group.txt +++ b/frappe/website/doctype/website_group/website_group.txt @@ -2,7 +2,7 @@ { "creation": "2014-01-29 15:57:42", "docstatus": 0, - "modified": "2014-02-10 14:38:13", + "modified": "2014-02-27 12:51:53", "modified_by": "Administrator", "owner": "Administrator" }, @@ -21,6 +21,7 @@ "permlevel": 0 }, { + "cancel": 0, "create": 1, "delete": 1, "doctype": "DocPerm", diff --git a/frappe/website/doctype/website_route/website_route.py b/frappe/website/doctype/website_route/website_route.py index 29e04d5984..abad0b42ee 100644 --- a/frappe/website/doctype/website_route/website_route.py +++ b/frappe/website/doctype/website_route/website_route.py @@ -55,11 +55,11 @@ class DocType(DocTypeNestedSet): def set_idx(self): if self.doc.parent_website_route: - if self.doc.idx == None: + if not self.doc.idx == None: self.set_idx_as_last() else: self.validate_previous_idx_exists() - + def set_idx_as_last(self): # new, append self.doc.idx = int(frappe.db.sql("""select ifnull(max(ifnull(idx, -1)), -1) diff --git a/frappe/website/statics.py b/frappe/website/statics.py index 7649c59eb7..bae9bca873 100644 --- a/frappe/website/statics.py +++ b/frappe/website/statics.py @@ -41,7 +41,7 @@ class sync(object): self.get_index_txt(basepath, files) self.sync_index_page(basepath, files) - if not frappe.db.exists("Website Route", folder_route): + if not frappe.db.exists("Website Route", folder_route) and basepath!=self.statics_path: # not synced either by generator or by index.html return diff --git a/frappe/website/website_generator.py b/frappe/website/website_generator.py index 5584a85752..742c77a7b1 100644 --- a/frappe/website/website_generator.py +++ b/frappe/website/website_generator.py @@ -14,6 +14,7 @@ def call_website_generator(bean, method, *args, **kwargs): class WebsiteGenerator(DocListController): def autoname(self): self.doc.name = cleanup_page_name(self.get_page_title()) + self.doc.append_number_if_name_exists() def set_page_name(self): """set page name based on parent page_name and title"""