|
|
@@ -21,13 +21,16 @@ |
|
|
|
# |
|
|
|
|
|
|
|
from __future__ import unicode_literals |
|
|
|
import webnotes |
|
|
|
import webnotes, conf |
|
|
|
|
|
|
|
class DocType: |
|
|
|
def __init__(self, d, dl): |
|
|
|
self.doc, self.doclist = d,dl |
|
|
|
|
|
|
|
def validate(self): |
|
|
|
if self.doc.standard=="Yes" and webnotes.session.user != "Administrator": |
|
|
|
webnotes.msgprint("Standard Print Format cannot be updated.", raise_exception=1) |
|
|
|
|
|
|
|
# old_doc_type is required for clearing item cache |
|
|
|
self.old_doc_type = webnotes.conn.get_value('Print Format', |
|
|
|
self.doc.name, 'doc_type') |
|
|
@@ -37,6 +40,15 @@ class DocType: |
|
|
|
webnotes.clear_cache(doctype=self.old_doc_type) |
|
|
|
if self.doc.doc_type: |
|
|
|
webnotes.clear_cache(doctype=self.doc.doc_type) |
|
|
|
|
|
|
|
self.export_doc() |
|
|
|
|
|
|
|
def export_doc(self): |
|
|
|
# export |
|
|
|
if self.doc.standard == 'Yes' and getattr(conf, 'developer_mode', 0) == 1: |
|
|
|
from webnotes.modules.export_file import export_to_files |
|
|
|
export_to_files(record_list=[['Print Format', self.doc.name]], |
|
|
|
record_module=self.doc.module) |
|
|
|
|
|
|
|
def on_trash(self): |
|
|
|
if self.doc.doc_type: |
|
|
|