瀏覽代碼

Changes in print format

version-14
Anand Doshi 13 年之前
父節點
當前提交
3f35951012
共有 2 個文件被更改,包括 59 次插入18 次删除
  1. +35
    -0
      py/core/doctype/print_format/print_format.py
  2. +24
    -18
      py/core/doctype/print_format/print_format.txt

+ 35
- 0
py/core/doctype/print_format/print_format.py 查看文件

@@ -0,0 +1,35 @@
import webnotes

class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d,dl
def on_update(self):
"""
On update, create/update a DocFormat record corresponding to DocType and Print Format Name
"""
if self.doc.doc_type:
from webnotes.model.doc import Document
res = webnotes.conn.sql("""
SELECT * FROM `tabDocFormat`
WHERE format=%s""", self.doc.name)
if res and res[0]:
d = Document('DocFormat', res[0][0])
d.parent = self.doc.doc_type
d.parenttype = 'DocType'
d.parentfield = 'formats'
d.format = self.doc.name
d.save()
else:
max_idx = webnotes.conn.sql("""
SELECT MAX(idx) FROM `tabDocFormat`
WHERE parent=%s
AND parenttype='DocType'
AND parentfield='formats'""", self.doc.doc_type)[0][0]
d = Document('DocFormat')
d.parent = self.doc.doc_type
d.parenttype = 'DocType'
d.parentfield = 'formats'
d.format = self.doc.name
d.idx = max_idx + 1
d.save(1)

+ 24
- 18
py/core/doctype/print_format/print_format.txt 查看文件

@@ -5,14 +5,14 @@
{
'creation': '2009-05-12 11:19:11',
'docstatus': 0,
'modified': '2010-12-20 22:42:13',
'modified_by': 'yogesh@webnotestech.com',
'modified': '2011-11-14 16:51:20',
'modified_by': 'Administrator',
'owner': 'Administrator'
},

# These values are common for all DocType
{
'_last_update': '1307624201',
'_last_update': '1321269659',
'allow_copy': 0,
'allow_email': 0,
'allow_print': 0,
@@ -21,7 +21,6 @@
'doctype': 'DocType',
'hide_heading': 0,
'hide_toolbar': 0,
'idx': 0,
'issingle': 0,
'istable': 0,
'module': 'Core',
@@ -30,7 +29,7 @@
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 3
'version': 8
},

# These values are common for all DocField
@@ -45,18 +44,18 @@

# These values are common for all DocPerm
{
'amend': 0,
'cancel': 0,
'create': 1,
'doctype': 'DocPerm',
'execute': 0,
'idx': 1,
'name': '__common__',
'parent': 'Print Format',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Administrator',
'role': 'System Manager',
'submit': 0,
'write': 1
},
@@ -77,7 +76,6 @@
'doctype': 'DocField',
'fieldname': 'module',
'fieldtype': 'Select',
'idx': 1,
'label': 'Module',
'oldfieldname': 'module',
'oldfieldtype': 'Select',
@@ -88,15 +86,11 @@
# DocField
{
'doctype': 'DocField',
'fieldname': 'html',
'fieldtype': 'Code',
'hidden': 0,
'idx': 2,
'label': 'HTML',
'oldfieldname': 'html',
'oldfieldtype': 'Text Editor',
'reqd': 0,
'search_index': 0
'fieldname': 'doc_type',
'fieldtype': 'Select',
'label': 'DocType',
'options': 'link:DocType',
'reqd': 0
},

# DocField
@@ -104,12 +98,24 @@
'doctype': 'DocField',
'fieldname': 'standard',
'fieldtype': 'Select',
'idx': 3,
'label': 'Standard',
'oldfieldname': 'standard',
'oldfieldtype': 'Select',
'options': '\nYes\nNo',
'reqd': 1,
'search_index': 1
},

# DocField
{
'doctype': 'DocField',
'fieldname': 'html',
'fieldtype': 'Code',
'hidden': 0,
'label': 'HTML',
'oldfieldname': 'html',
'oldfieldtype': 'Text Editor',
'reqd': 0,
'search_index': 0
}
]

Loading…
取消
儲存