fixed patches for new sync

This commit is contained in:
Rushabh Mehta 2013-03-06 11:30:08 +05:30
parent 2da3d879e3
commit 8911a1daa8
3 changed files with 9 additions and 2 deletions

View file

@ -35,6 +35,7 @@ CREATE TABLE `tabDocField` (
`depends_on` varchar(180) DEFAULT NULL,
`permlevel` int(11) DEFAULT '0',
`width` varchar(180) DEFAULT NULL,
`print_width` varchar(180) DEFAULT NULL,
`default` text,
`description` text,
`in_filter` int(1) DEFAULT NULL,
@ -120,6 +121,7 @@ CREATE TABLE `tabDocType` (
`allow_email` int(1) DEFAULT NULL,
`allow_copy` int(1) DEFAULT NULL,
`allow_rename` int(1) DEFAULT NULL,
`allow_import` int(1) DEFAULT NULL,
`hide_toolbar` int(1) DEFAULT NULL,
`hide_heading` int(1) DEFAULT NULL,
`allow_attach` int(1) DEFAULT NULL,

View file

@ -46,6 +46,7 @@ class Bean:
self.ignore_children_type = []
self.ignore_check_links = False
self.ignore_validate = False
self.ignore_fields = False
if isinstance(dt, basestring) and not dn:
dn = dt
@ -216,7 +217,7 @@ class Bean:
def save_main(self):
try:
self.doc.save(check_links = False)
self.doc.save(check_links = False, ignore_fields = self.ignore_fields)
except NameError, e:
webnotes.msgprint('%s "%s" already exists' % (self.doc.doctype, self.doc.name))
@ -233,7 +234,7 @@ class Bean:
d.parent = self.doc.name # rename if reqd
d.parenttype = self.doc.doctype
d.save(check_links=False)
d.save(check_links=False, ignore_fields = self.ignore_fields)
child_map.setdefault(d.doctype, []).append(d.name)

View file

@ -103,6 +103,10 @@ def import_doclist(doclist):
new_bean.ignore_children_type = ignore
new_bean.ignore_check_links = True
new_bean.ignore_validate = True
if doctype=="DocType" and name in ["DocField", "DocType"]:
new_bean.ignore_fields = True
new_bean.insert()
def remove_ignored_docs_if_they_already_exist(doclist, ignore, name):