mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-14 18:51:21 +00:00
moved directory structure
This commit is contained in:
24
patches/mar_2012/is_submittable_patch.py
Normal file
24
patches/mar_2012/is_submittable_patch.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# dont run this patch
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
import webnotes
|
||||
import webnotes.model.doctype
|
||||
from webnotes.utils import cint
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes.model.code import get_obj
|
||||
doctype_list = webnotes.conn.sql("SELECT name FROM `tabDocType`")
|
||||
for dt in doctype_list:
|
||||
doclist = webnotes.model.doctype.get(dt[0], form=0)
|
||||
is_submittable = 0
|
||||
for d in doclist:
|
||||
if d.doctype == 'DocPerm' and d.fields.get('permlevel') == 0 \
|
||||
and cint(d.fields.get('submit')) == 1:
|
||||
is_submittable = 1
|
||||
break
|
||||
if is_submittable:
|
||||
dt_doc = Document('DocType', doclist[0].name)
|
||||
dt_doc.is_submittable = 1
|
||||
dt_doc.save()
|
||||
obj = get_obj(doc=dt_doc)
|
||||
obj.make_amendable()
|
||||
obj.on_update()
|
||||
Reference in New Issue
Block a user