mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
Sourced wnframework-modules from Google Code as erpnext
This commit is contained in:
0
tools/doctype/__init__.py
Normal file
0
tools/doctype/__init__.py
Normal file
@@ -0,0 +1,95 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
|
||||
# get dashboard counts
|
||||
# --------------------
|
||||
def get_dashboard_counts(self, dt):
|
||||
dtl = eval(dt)
|
||||
dt = {}
|
||||
|
||||
for d in dtl:
|
||||
# if Lead
|
||||
if d=='Lead':
|
||||
dt[d] = {'To follow up':sql("select count(name) from tabLead where status!='Converted' and docstatus=1")[0][0] or 0}
|
||||
|
||||
# if Enquiry
|
||||
elif d=='Enquiries':
|
||||
args = {}
|
||||
args['Quotations to be sent'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabEnquiry`t2 where t1.enq_no!=t2.name and t2.docstatus=1")[0][0] or 0
|
||||
args['To follow up'] = sql("select count(name) from `tabQuotation` where docstatus=0")[0][0] or 0 #Draft
|
||||
dt[d] = args
|
||||
|
||||
# if Sales Order
|
||||
elif d=='Sales Order':
|
||||
args = {}
|
||||
args['To be delivered'] = sql("select count(name) from `tabSales Order` where per_delivered<100 and delivery_date>now() and docstatus=1")[0][0] or 0
|
||||
args['To be billed'] = sql("select count(name) from `tabSales Order` where per_billed<100 and docstatus=1")[0][0] or 0
|
||||
args['Overdue'] = sql("select count(name) from `tabSales Order` where per_delivered<100 and delivery_date<now() and docstatus=1")[0][0] or 0
|
||||
args['To be submitted'] = sql("select count(name) from `tabSales Order` where status='Draft'")[0][0] or 0 #Draft
|
||||
dt[d] = args
|
||||
|
||||
# if Invoice
|
||||
elif d=='Invoices':
|
||||
args = {}
|
||||
args['To receive payment'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date>now() and outstanding_amount!=0")[0][0] or 0
|
||||
args['Overdue'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date<now() and outstanding_amount!=0")[0][0] or 0
|
||||
args['To be submitted'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=0")[0][0] or 0 #Draft
|
||||
dt[d] = args
|
||||
|
||||
# if Indent
|
||||
elif d=='Indent':
|
||||
args = {}
|
||||
args['Purchase Order to be made'] = sql("select count(name) from `tabIndent` where per_ordered<100 and docstatus=1")[0][0] or 0
|
||||
args['To be submitted'] = sql("select count(name) from `tabIndent` where status='Draft'")[0][0] or 0 #Draft
|
||||
dt[d] = args
|
||||
|
||||
# if Purchase Order
|
||||
elif d=='Purchase Order':
|
||||
args = {}
|
||||
args['To receive items'] = sql("select count(name) from `tabPurchase Order` where per_received<100 and docstatus=1")[0][0] or 0
|
||||
args['To be billed'] = sql("select count(name) from `tabPurchase Order` where per_billed<100 and docstatus=1")[0][0] or 0
|
||||
args['To be submitted'] = sql("select count(name) from `tabPurchase Order` where status='Draft'")[0][0] or 0 #Draft
|
||||
dt[d] = args
|
||||
|
||||
# if Bills
|
||||
elif d=='Bills':
|
||||
args = {}
|
||||
args['To be payed'] = sql("select count(name) from `tabPayable Voucher` where docstatus=1 and outstanding_amount!=0")[0][0] or 0
|
||||
args['To be submitted'] = sql("select count(name) from `tabPayable Voucher` where docstatus=0")[0][0] or 0 #Draft
|
||||
dt[d] = args
|
||||
|
||||
# if Tasks
|
||||
elif d=='Tasks':
|
||||
dt[d] = {'Open': sql("select count(name) from `tabTicket` where status='Open'")[0][0] or 0}
|
||||
|
||||
# if Maintenance
|
||||
elif d=='Serial No':
|
||||
args = {}
|
||||
args['AMC to expire this month'] = sql("select count(name) from `tabSerial No` where docstatus=1 and month(getdate()) = month(amc_expiry_date) and year(getdate()) = year(amc_expiry_date)")[0][0] or 0
|
||||
args['Warranty to expire this month'] = ql("select count(name) from `tabSerial No` where docstatus=1 and month(getdate()) = month(warranty_expiry_date) and year(getdate())=year(warranty_expiry_date)")[0][0] or 0
|
||||
dt[d] = args
|
||||
|
||||
msgprint(dt)
|
||||
return dt
|
||||
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-29 14:44:17', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 43, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'Activity Dashboard Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
|
||||
0
tools/doctype/address/__init__.py
Normal file
0
tools/doctype/address/__init__.py
Normal file
2
tools/doctype/address/address.comp.js
Normal file
2
tools/doctype/address/address.comp.js
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
cur_frm.cscript.onload=function(doc,cdt,cdn){if(doc.customer)cur_frm.add_fetch('customer','customer_name','customer_name');if(doc.supplier)cur_frm.add_fetch('supplier','supplier_name','supplier_name');}
|
||||
5
tools/doctype/address/address.js
Normal file
5
tools/doctype/address/address.js
Normal file
@@ -0,0 +1,5 @@
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
|
||||
if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
|
||||
}
|
||||
|
||||
56
tools/doctype/address/address.py
Normal file
56
tools/doctype/address/address.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes import session, form, msgprint, errprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def autoname(self):
|
||||
if self.doc.customer:
|
||||
self.doc.name = self.doc.customer + '-' + self.doc.address_type
|
||||
elif self.doc.supplier:
|
||||
self.doc.name = self.doc.supplier + '-' + self.doc.address_type
|
||||
elif self.doc.sales_partner:
|
||||
self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
|
||||
|
||||
# filter out bad characters in name
|
||||
self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
|
||||
|
||||
#----------------------
|
||||
# Call to Validate
|
||||
#----------------------
|
||||
def validate(self):
|
||||
self.validate_primary_address()
|
||||
self.validate_shipping_address()
|
||||
|
||||
#----------------------
|
||||
# Validate that there can only be one primary address for particular customer, supplier
|
||||
#----------------------
|
||||
def validate_primary_address(self):
|
||||
if self.doc.is_primary_address == 1:
|
||||
if self.doc.customer:
|
||||
sql("update tabAddress set is_primary_address=0 where customer = '%s'" % (self.doc.customer))
|
||||
elif self.doc.supplier:
|
||||
sql("update tabAddress set is_primary_address=0 where supplier = '%s'" % (self.doc.supplier))
|
||||
elif self.doc.sales_partner:
|
||||
sql("update tabAddress set is_primary_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
|
||||
|
||||
#----------------------
|
||||
# Validate that there can only be one shipping address for particular customer, supplier
|
||||
#----------------------
|
||||
def validate_shipping_address(self):
|
||||
if self.doc.is_shipping_address == 1:
|
||||
if self.doc.customer:
|
||||
sql("update tabAddress set is_shipping_address=0 where customer = '%s'" % (self.doc.customer))
|
||||
elif self.doc.supplier:
|
||||
sql("update tabAddress set is_shipping_address=0 where supplier = '%s'" % (self.doc.supplier))
|
||||
elif self.doc.sales_partner:
|
||||
sql("update tabAddress set is_shipping_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
|
||||
802
tools/doctype/address/address.txt
Normal file
802
tools/doctype/address/address.txt
Normal file
@@ -0,0 +1,802 @@
|
||||
[
|
||||
{
|
||||
'_last_update': '1306307668',
|
||||
'_user_tags': None,
|
||||
'allow_attach': None,
|
||||
'allow_copy': None,
|
||||
'allow_email': None,
|
||||
'allow_print': None,
|
||||
'allow_rename': None,
|
||||
'allow_trash': 1,
|
||||
'autoname': None,
|
||||
'change_log': None,
|
||||
'client_script': None,
|
||||
'client_script_core': None,
|
||||
'client_string': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'dt_template': None,
|
||||
'hide_heading': None,
|
||||
'hide_toolbar': None,
|
||||
'idx': None,
|
||||
'in_create': None,
|
||||
'in_dialog': 1,
|
||||
'is_transaction_doc': None,
|
||||
'issingle': None,
|
||||
'istable': None,
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Tools',
|
||||
'name': 'Address',
|
||||
'name_case': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'print_outline': None,
|
||||
'read_only': None,
|
||||
'read_only_onload': None,
|
||||
'search_fields': None,
|
||||
'section_style': 'Simple',
|
||||
'server_code': None,
|
||||
'server_code_compiled': None,
|
||||
'server_code_core': None,
|
||||
'server_code_error': None,
|
||||
'show_in_menu': 0,
|
||||
'smallicon': None,
|
||||
'subject': None,
|
||||
'tag_fields': None,
|
||||
'use_template': None,
|
||||
'version': 41
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 1,
|
||||
'match': None,
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00884',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'All',
|
||||
'submit': None,
|
||||
'write': 1
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Section Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'in_filter': None,
|
||||
'label': 'Address Details',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05072',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': '<em>e.g. Office, Billing, Shipping</em>',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'address_type',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'in_filter': None,
|
||||
'label': 'Address Type',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05073',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'address_line1',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'in_filter': None,
|
||||
'label': 'Address Line1',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05074',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'address_line2',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'in_filter': None,
|
||||
'label': 'Address Line2',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05075',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'city',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'in_filter': 1,
|
||||
'label': 'City/Town',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05076',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Suggest',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'pincode',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'in_filter': 1,
|
||||
'label': 'Pincode',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05077',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': 1,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'country',
|
||||
'fieldtype': 'Select',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Country',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05078',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'link:Country',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client',
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'state',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'State',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05079',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Suggest',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': 0,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Column Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 9,
|
||||
'in_filter': None,
|
||||
'label': None,
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05080',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': '50%'
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'phone',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 10,
|
||||
'in_filter': None,
|
||||
'label': 'Phone',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05081',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'email_id',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 11,
|
||||
'in_filter': None,
|
||||
'label': 'Email Id',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05082',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fax',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 12,
|
||||
'in_filter': None,
|
||||
'label': 'Fax',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05083',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:30',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 13,
|
||||
'in_filter': None,
|
||||
'label': 'Customer',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05084',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Customer',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:31',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 14,
|
||||
'in_filter': None,
|
||||
'label': 'Customer Name',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05085',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 1,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:31',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.customer && !doc.sales_partner',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 15,
|
||||
'in_filter': None,
|
||||
'label': 'Supplier',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05086',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Supplier',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:31',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.customer && !doc.sales_partner',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 16,
|
||||
'in_filter': None,
|
||||
'label': 'Supplier Name',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05087',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 1,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:31',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.customer && !doc.supplier',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_partner',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 17,
|
||||
'in_filter': None,
|
||||
'label': 'Sales Partner',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05088',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Sales Partner',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:31',
|
||||
'default': '0',
|
||||
'depends_on': None,
|
||||
'description': 'Check to make primary address',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_primary_address',
|
||||
'fieldtype': 'Check',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 18,
|
||||
'in_filter': None,
|
||||
'label': 'Is Primary Address',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05089',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-25 12:59:31',
|
||||
'default': '0',
|
||||
'depends_on': None,
|
||||
'description': 'Check to make Shipping Address',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_shipping_address',
|
||||
'fieldtype': 'Check',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 19,
|
||||
'in_filter': None,
|
||||
'label': 'Is Shipping Address',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05090',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 12:59:31',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 20,
|
||||
'in_filter': None,
|
||||
'label': 'Trash Reason',
|
||||
'modified': '2011-05-26 17:45:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05091',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
}
|
||||
]
|
||||
0
tools/doctype/business_letter/__init__.py
Normal file
0
tools/doctype/business_letter/__init__.py
Normal file
38
tools/doctype/business_letter/business_letter.js
Normal file
38
tools/doctype/business_letter/business_letter.js
Normal file
@@ -0,0 +1,38 @@
|
||||
$import(Tips Common)
|
||||
|
||||
cur_frm.fields_dict['template'].get_query=function(doc,cdt,cdn){
|
||||
return "SELECT `tabBusiness Letter Template`.name FROM `tabBusiness Letter Template` WHERE `tabBusiness Letter Template`.letter_type='"+doc.letter_type+"' AND `tabBusiness Letter Template`.name like '%s' LIMIT 50"
|
||||
}
|
||||
|
||||
cur_frm.cscript.template = function(doc,cdt,cdn){
|
||||
//set title as like template
|
||||
doc.title = doc.template;
|
||||
refresh_field('title');
|
||||
|
||||
//set print heading as title
|
||||
cur_frm.pformat.print_heading=doc.title;
|
||||
cur_frm.pformat.print_subheading = ' ';
|
||||
|
||||
//call set_content function to pull content as per template selected
|
||||
$c_obj([doc], 'set_content', '',function(r, rt) { refresh_field('content');});
|
||||
}
|
||||
|
||||
cur_frm.cscript.title= function(doc,cdt,cdn){
|
||||
//set print heading on title change
|
||||
cur_frm.pformat.print_heading=doc.title;
|
||||
cur_frm.pformat.print_subheading = ' ';
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh= function(doc,cdt,cdn){
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
//set print heading on refresh
|
||||
cur_frm.pformat.print_heading=doc.title;
|
||||
cur_frm.pformat.print_subheading = ' ';
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload= function(doc,cdt,cdn){
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
//set print heading
|
||||
cur_frm.pformat.print_heading=doc.title;
|
||||
cur_frm.pformat.print_subheading = ' ';
|
||||
}
|
||||
29
tools/doctype/business_letter/business_letter.py
Normal file
29
tools/doctype/business_letter/business_letter.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
#init function
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def set_content(self):
|
||||
ret_content = sql("select content from `tabBusiness Letter Template` where name ='%s'"%self.doc.template)
|
||||
if ret_content: self.doc.content = ret_content[0][0]
|
||||
return ''
|
||||
1
tools/doctype/business_letter/business_letter.txt
Normal file
1
tools/doctype/business_letter/business_letter.txt
Normal file
File diff suppressed because one or more lines are too long
0
tools/doctype/business_letter_template/__init__.py
Normal file
0
tools/doctype/business_letter_template/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
$import(Tips Common)
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 11:06:16', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:title', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Business Letter Template', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00840', 'parent': 'Business Letter Template', 'read': 1, 'create': 1, 'creation': '2010-04-20 11:06:16', 'modified': '2010-09-20 09:03:29', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00841', 'parent': 'Business Letter Template', 'read': 1, 'create': None, 'creation': '2010-04-20 11:06:16', 'modified': '2010-09-20 09:03:29', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'All', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-20 11:06:16', 'doctype': 'DocField', 'oldfieldname': 'title', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04792', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:03:29', 'parenttype': 'DocType', 'fieldname': 'title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-20 11:06:16', 'doctype': 'DocField', 'oldfieldname': 'letter_type', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Letter Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04794', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:03:29', 'parenttype': 'DocType', 'fieldname': 'letter_type', 'fieldtype': 'Link', 'options': 'Business Letter Type', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2010-04-20 11:06:16', 'doctype': 'DocField', 'oldfieldname': 'content', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Content', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04793', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:03:29', 'parenttype': 'DocType', 'fieldname': 'content', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/business_letter_type/__init__.py
Normal file
0
tools/doctype/business_letter_type/__init__.py
Normal file
10
tools/doctype/business_letter_type/business_letter_type.js
Normal file
10
tools/doctype/business_letter_type/business_letter_type.js
Normal file
@@ -0,0 +1,10 @@
|
||||
$import(Tips Common)
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 11:03:59', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:letter_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Business Letter Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00839', 'parent': 'Business Letter Type', 'read': 1, 'create': 1, 'creation': '2010-04-20 11:03:59', 'modified': '2010-09-20 09:03:40', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00842', 'parent': 'Business Letter Type', 'read': 1, 'create': None, 'creation': '2010-04-20 11:06:28', 'modified': '2010-09-20 09:03:40', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'All', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-20 11:03:59', 'doctype': 'DocField', 'oldfieldname': 'letter_type', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Letter Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04791', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:03:40', 'parenttype': 'DocType', 'fieldname': 'letter_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/contact/__init__.py
Normal file
0
tools/doctype/contact/__init__.py
Normal file
54
tools/doctype/contact/contact.js
Normal file
54
tools/doctype/contact/contact.js
Normal file
@@ -0,0 +1,54 @@
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
|
||||
if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
|
||||
}
|
||||
/*
|
||||
//---------- on refresh ----------------------
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------- Trigger on customer ---------------------
|
||||
cur_frm.cscript.is_customer = function(doc,cdt,cdn){
|
||||
if(!doc.is_customer){
|
||||
doc.customer = doc.customer_name = doc.customer_address = doc.customer_group = '';
|
||||
refresh_many(['customer','customer_name','customer_address','customer_group']);
|
||||
}
|
||||
}
|
||||
|
||||
//------------- Trigger on supplier -----------------------
|
||||
cur_frm.cscript.is_supplier = function(doc,cdt,cdn){
|
||||
if(!doc.is_supplier){
|
||||
doc.supplier = doc.supplier_name = doc.supplier_address = doc.supplier_type = '';
|
||||
refresh_many(['supplier','supplier_address','supplier_name','supplier_type']);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------- Trigger on sales partner ---------------------
|
||||
cur_frm.cscript.is_sales_partner = function(doc,cdt,cdn){
|
||||
if(!doc.is_sales_partner){
|
||||
doc.sales_partner = doc.sales_partner_address = doc.partner_type = '';
|
||||
refresh_many(['sales_partner','sales_partner_address','partner_type']);
|
||||
}
|
||||
}
|
||||
|
||||
//----------- Trigger on supplier name ------------------------
|
||||
cur_frm.cscript.supplier = function(doc,cdt,cdn){
|
||||
arg = {'dt':'Supplier','dn':doc.supplier,'nm':'supplier_name','fld':'supplier_address','type':'supplier_type'};
|
||||
get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
//------------ Trigger on customer name ------------------------
|
||||
cur_frm.cscript.customer = function(doc,cdt,cdn){
|
||||
arg = {'dt':'Customer','dn':doc.customer,'nm':'customer_name','fld':'customer_address','type':'customer_group'};
|
||||
get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
//------------ Trigger on sales partner ------------------------
|
||||
cur_frm.cscript.sales_partner = function(doc,cdt,cdn){
|
||||
arg = {'dt':'Sales Partner','dn':doc.sales_partner,'nm':'partner_name','fld':'sales_partner_address','type':'partner_type'};
|
||||
get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
|
||||
}
|
||||
*/
|
||||
43
tools/doctype/contact/contact.py
Normal file
43
tools/doctype/contact/contact.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes import session, form, msgprint, errprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def autoname(self):
|
||||
if self.doc.customer:
|
||||
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer
|
||||
elif self.doc.supplier:
|
||||
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.supplier
|
||||
elif self.doc.sales_partner:
|
||||
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.sales_partner
|
||||
|
||||
# filter out bad characters in name
|
||||
self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','')
|
||||
|
||||
#----------------------
|
||||
# Call to Validate
|
||||
#----------------------
|
||||
def validate(self):
|
||||
self.validate_primary_contact()
|
||||
|
||||
#----------------------
|
||||
# Validate that there can only be one primary contact for particular customer, supplier
|
||||
#----------------------
|
||||
def validate_primary_contact(self):
|
||||
if self.doc.is_primary_contact == 1:
|
||||
if self.doc.customer:
|
||||
sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
|
||||
elif self.doc.supplier:
|
||||
sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))
|
||||
elif self.doc.sales_partner:
|
||||
sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
|
||||
786
tools/doctype/contact/contact.txt
Normal file
786
tools/doctype/contact/contact.txt
Normal file
@@ -0,0 +1,786 @@
|
||||
[
|
||||
{
|
||||
'_last_update': '1306748466',
|
||||
'_user_tags': None,
|
||||
'allow_attach': None,
|
||||
'allow_copy': None,
|
||||
'allow_email': None,
|
||||
'allow_print': None,
|
||||
'allow_rename': None,
|
||||
'allow_trash': 1,
|
||||
'autoname': None,
|
||||
'change_log': None,
|
||||
'client_script': None,
|
||||
'client_script_core': None,
|
||||
'client_string': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-08-08 17:08:55',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'dt_template': None,
|
||||
'hide_heading': None,
|
||||
'hide_toolbar': None,
|
||||
'idx': None,
|
||||
'in_create': 0,
|
||||
'in_dialog': 1,
|
||||
'is_transaction_doc': None,
|
||||
'issingle': None,
|
||||
'istable': None,
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Tools',
|
||||
'name': 'Contact',
|
||||
'name_case': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'print_outline': None,
|
||||
'read_only': None,
|
||||
'read_only_onload': None,
|
||||
'search_fields': None,
|
||||
'section_style': 'Simple',
|
||||
'server_code': None,
|
||||
'server_code_compiled': None,
|
||||
'server_code_core': None,
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'smallicon': None,
|
||||
'subject': '%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s',
|
||||
'tag_fields': None,
|
||||
'use_template': None,
|
||||
'version': 245
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': None,
|
||||
'create': None,
|
||||
'creation': '2010-10-27 14:40:07',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 1,
|
||||
'match': None,
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00721',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Sales User',
|
||||
'submit': None,
|
||||
'write': None
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': None,
|
||||
'create': None,
|
||||
'creation': '2010-10-27 14:40:07',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 2,
|
||||
'match': None,
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00722',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Purchase User',
|
||||
'submit': None,
|
||||
'write': None
|
||||
},
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'creation': '2010-08-08 17:08:55',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 3,
|
||||
'match': None,
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00125',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Sales Master Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'creation': '2010-08-08 17:08:55',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 4,
|
||||
'match': None,
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00128',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Purchase Master Manager',
|
||||
'submit': None,
|
||||
'write': 1
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'creation': '2010-08-08 17:08:55',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 5,
|
||||
'match': None,
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00129',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'System Manager',
|
||||
'submit': None,
|
||||
'write': 1
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-27 18:28:50',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Section Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'in_filter': None,
|
||||
'label': 'Contact Details',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04808',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': None,
|
||||
'owner': 'ashwini@webnotestech.com',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-27 18:28:50',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Column Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'in_filter': None,
|
||||
'label': None,
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04809',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': '50%'
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-08-08 17:08:55',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'first_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'in_filter': None,
|
||||
'label': 'First Name',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL00758',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'first_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-08-08 17:08:55',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'in_filter': None,
|
||||
'label': 'Last Name',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL00759',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'last_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-09-01 15:47:57',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'in_filter': None,
|
||||
'label': 'Customer',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03855',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'customer',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': 'Client',
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-17 14:03:55',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'in_filter': None,
|
||||
'label': 'Customer Name',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000001020',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 1,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-04-25 18:42:39',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.customer && !doc.sales_partner',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'in_filter': None,
|
||||
'label': 'Supplier',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000574',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Supplier',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': 'Client',
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-17 14:03:55',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.customer && !doc.sales_partner',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'in_filter': None,
|
||||
'label': 'Supplier Name',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000001021',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 1,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-17 14:43:27',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.customer && !doc.supplier',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_partner',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 9,
|
||||
'in_filter': None,
|
||||
'label': 'Sales Partner',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000001030',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Sales Partner',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-08-08 17:08:56',
|
||||
'default': '0',
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_primary_contact',
|
||||
'fieldtype': 'Check',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 10,
|
||||
'in_filter': None,
|
||||
'label': 'Is Primary Contact',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL00776',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'is_primary_contact',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-27 18:28:50',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Column Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 11,
|
||||
'in_filter': None,
|
||||
'label': None,
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04810',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'options': None,
|
||||
'owner': 'ashwini@webnotestech.com',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': '50%'
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-08-08 17:08:56',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'email_id',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 12,
|
||||
'in_filter': None,
|
||||
'label': 'Email Id',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL00779',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'email_id',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-08-08 17:08:56',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'phone',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 13,
|
||||
'in_filter': None,
|
||||
'label': 'Phone',
|
||||
'modified': '2011-05-30 16:34:29',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL00778',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'contact_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-08-08 17:08:56',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'mobile_no',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 14,
|
||||
'in_filter': None,
|
||||
'label': 'Mobile No',
|
||||
'modified': '2011-05-30 16:34:30',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL00780',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'mobile_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-04-26 12:04:54',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': 'Enter department to which this Contact belongs',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'department',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 15,
|
||||
'in_filter': None,
|
||||
'label': 'Department',
|
||||
'modified': '2011-05-30 16:34:30',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000575',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Suggest',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-04-26 12:04:54',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': 'Enter designation of this Contact',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'designation',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 16,
|
||||
'in_filter': None,
|
||||
'label': 'Designation',
|
||||
'modified': '2011-05-30 16:34:30',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000576',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Suggest',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-08-08 17:08:55',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 17,
|
||||
'in_filter': None,
|
||||
'label': 'Trash Reason',
|
||||
'modified': '2011-05-30 16:34:30',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL00755',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Contact',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 1,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
}
|
||||
]
|
||||
0
tools/doctype/contact_detail/__init__.py
Normal file
0
tools/doctype/contact_detail/__init__.py
Normal file
1
tools/doctype/contact_detail/contact_detail.txt
Normal file
1
tools/doctype/contact_detail/contact_detail.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-30 18:16:41', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'CD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Contact Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-30 18:16:41', 'doctype': 'DocField', 'oldfieldname': 'contact_person', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Contact Person', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01574', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'contact_person', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-30 18:16:41', 'doctype': 'DocField', 'oldfieldname': 'contact_no', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Contact No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01575', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'contact_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-30 18:16:41', 'doctype': 'DocField', 'oldfieldname': 'department', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Department', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01576', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'department', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-06 17:14:06', 'doctype': 'DocField', 'oldfieldname': 'designation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Designation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02006', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'designation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-05-19 10:57:20', 'doctype': 'DocField', 'oldfieldname': 'email_id', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Email Id', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02092', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'email_id', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/file_browser_control/__init__.py
Normal file
0
tools/doctype/file_browser_control/__init__.py
Normal file
198
tools/doctype/file_browser_control/file_browser_control.py
Normal file
198
tools/doctype/file_browser_control/file_browser_control.py
Normal file
@@ -0,0 +1,198 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# All root file groups(where parent_group is null).
|
||||
def get_root_file_grps(self):
|
||||
fl_grp = convert_to_lists(sql("select name,group_name,ifnull(can_edit,''),ifnull(can_view,''),owner from `tabFile Group` where (parent_group='' or parent_group is null)"))
|
||||
return fl_grp
|
||||
|
||||
# Get children of selected file group.
|
||||
def get_children(self,grp):
|
||||
ret = {}
|
||||
ret['parent_grp'] = grp
|
||||
|
||||
fl_grp = convert_to_lists(sql("select name,group_name,ifnull(can_edit,''),ifnull(can_view,''),owner from `tabFile Group` where parent_group=%s",grp))
|
||||
ret['fl_grp'] = fl_grp or ''
|
||||
fl = convert_to_lists(sql("select name,ifnull(file_name,''),ifnull(file_list,''),ifnull(can_edit,''),ifnull(can_view,''),owner from tabFile where file_group=%s and (file_name != '' and file_name is not null)",grp))
|
||||
ret['fl'] = fl or ''
|
||||
|
||||
return ret
|
||||
|
||||
# Create a new file group.
|
||||
def create_new_grp(self,arg):
|
||||
arg = eval(arg)
|
||||
|
||||
grp = Document('File Group')
|
||||
grp.group_name = arg['grp_nm']
|
||||
grp.parent_group = arg['parent_grp']
|
||||
grp.description = arg['desc']
|
||||
grp.name = arg['grp_nm']
|
||||
grp.save(1)
|
||||
msgprint('Created a New Group')
|
||||
return grp.name
|
||||
|
||||
# Create a new file.
|
||||
def create_new_file(self,arg):
|
||||
arg = eval(arg)
|
||||
|
||||
f = Document('File')
|
||||
f.file_name = arg['file_name']
|
||||
f.description = arg['desc']
|
||||
f.type = arg['type']
|
||||
f.file_group = arg['file_grp']
|
||||
f_obj = get_obj(doc=f)
|
||||
f_obj.validate()
|
||||
f_obj.doc.save(1)
|
||||
msgprint('Created a New File')
|
||||
ret = {
|
||||
'name' : f_obj.doc.name,
|
||||
'label' : f_obj.doc.file_name
|
||||
}
|
||||
return cstr(ret)
|
||||
|
||||
# Update changes done to selected file group.
|
||||
def update_grp(self,arg):
|
||||
arg = eval(arg)
|
||||
sql("update `tabFile Group` set group_name=%s, parent_group=%s, description=%s where name=%s",(arg['grp_nm'],arg['parent_grp'],arg['desc'],arg['name']))
|
||||
msgprint("Changes are saved.")
|
||||
return arg['name']
|
||||
|
||||
# Update changes done to selected file.
|
||||
def update_file(self,arg):
|
||||
arg = eval(arg)
|
||||
sql("update `tabFile` set description=%s, file_group=%s where name=%s",(arg['desc'],arg['file_grp'],arg['name']))
|
||||
msgprint("Changes are saved.")
|
||||
return arg['name']
|
||||
|
||||
# Get details of selected file.
|
||||
def get_file_details(self,file_id):
|
||||
file_det = convert_to_lists(sql("select name,file_name, description, file_group, file_list from tabFile where name=%s",file_id))
|
||||
file_det = {
|
||||
'name' : file_det[0][0] or '',
|
||||
'file_name' : file_det[0][1] or '',
|
||||
'description' : file_det[0][2] or '',
|
||||
'file_group' : file_det[0][3] or '',
|
||||
'file_list' : file_det[0][4] or ''
|
||||
}
|
||||
return file_det
|
||||
|
||||
# Delete File Data and File record.
|
||||
def delete(self,arg):
|
||||
arg = eval(arg)
|
||||
if arg['dt'] == 'File Group':
|
||||
sql("delete from `tabFile Group` where name= %s", arg['dn'])
|
||||
elif arg['dt'] == 'File':
|
||||
file_list = sql("select file_list from tabFile where name=%s", arg['dn'])[0][0] or ''
|
||||
f_id = file_list.split(',')[-1]
|
||||
if f_id:
|
||||
sql("delete from `tabFile Data` where name=%s", f_id)
|
||||
sql("delete from tabFile where name = %s", arg['dn'])
|
||||
else:
|
||||
pass
|
||||
|
||||
#Move to another group.
|
||||
def move(self,arg):
|
||||
msgprint('need to write code')
|
||||
|
||||
# Upload Image
|
||||
def upload_many(self,form):
|
||||
import os
|
||||
# from file browser
|
||||
if form.getvalue('form_name') == 'File Browser':
|
||||
if form.getvalue('filedata'):
|
||||
i = form['filedata']
|
||||
|
||||
#creat file data
|
||||
fd = Document('File Data')
|
||||
fd.blob_content = i.file.read()
|
||||
fd.file_name = i.filename
|
||||
|
||||
file_det = form.getvalue('file_det').split('~~')
|
||||
|
||||
if(file_det[0] == 'NIL'):
|
||||
file_desc = ''
|
||||
else:
|
||||
file_desc = file_det[0]
|
||||
|
||||
if(file_det[1] == 'NIL'):
|
||||
file_grp = ''
|
||||
return 'File Group is mandatory.'
|
||||
raise Exception
|
||||
else:
|
||||
file_grp = file_det[1]
|
||||
|
||||
if "" in fd.file_name:
|
||||
fd.file_name = fd.file_name.split("")[-1]
|
||||
if '/' in fd.file_name:
|
||||
fd.file_name = fd.file_name.split('/')[-1]
|
||||
fd.save(1)
|
||||
|
||||
f = Document('File')
|
||||
f.file_list = fd.file_name + ',' + fd.name
|
||||
f.file_name = fd.file_name
|
||||
f.description = file_desc
|
||||
f.file_group = file_grp
|
||||
f.save(1)
|
||||
|
||||
ret = {
|
||||
'name' : f.name,
|
||||
'file_name' : f.file_name
|
||||
}
|
||||
|
||||
return cstr(ret)
|
||||
else:
|
||||
return 'No file found.'
|
||||
else:
|
||||
return 'No file found.'
|
||||
|
||||
# Get all system roles.
|
||||
def get_all_roles(self):
|
||||
roles = convert_to_lists(sql("select name from tabRole"))
|
||||
return roles
|
||||
|
||||
# Get details for selected File Group.
|
||||
def get_fg_details(self,grp):
|
||||
grp_det = convert_to_lists(sql("select name,group_name, ifnull(parent_group,''), ifnull(description,''), ifnull(can_edit,''),ifnull(can_view,''),owner from `tabFile Group` where name=%s",grp))
|
||||
grp_det = {
|
||||
'Name' : grp_det[0][0] or '',
|
||||
'Group Name' : grp_det[0][1] or '',
|
||||
'Parent Group' : grp_det[0][2] or '',
|
||||
'Description' : grp_det[0][3] or '',
|
||||
'Can Edit' : grp_det[0][4] or '',
|
||||
'Can View' : grp_det[0][5] or '',
|
||||
'Owner' : grp_det[0][6] or ''
|
||||
}
|
||||
return grp_det
|
||||
|
||||
# Update Edit/ View privileges to selected File/ File Group.
|
||||
def update_privileges(self,arg):
|
||||
arg = eval(arg)
|
||||
sql("update `tab%s` set can_edit='%s', can_view='%s' where name='%s'" % (arg['type'],arg['edit_roles'], arg['view_roles'], arg['name']))
|
||||
msgprint('Privileges updated.')
|
||||
|
||||
# Get Edit/ View privileges from selected File/ File Group.
|
||||
def get_privileges(self,arg):
|
||||
arg = eval(arg)
|
||||
privilege = convert_to_lists(sql("select ifnull(can_edit,''), ifnull(can_view,''),owner from `tab%s` where name='%s'" % (arg['dt'],arg['dn'])))
|
||||
return privilege
|
||||
55
tools/doctype/file_browser_control/file_browser_control.txt
Normal file
55
tools/doctype/file_browser_control/file_browser_control.txt
Normal file
@@ -0,0 +1,55 @@
|
||||
[
|
||||
{
|
||||
'allow_attach': None,
|
||||
'allow_copy': None,
|
||||
'allow_email': None,
|
||||
'allow_print': None,
|
||||
'allow_rename': None,
|
||||
'allow_trash': None,
|
||||
'autoname': None,
|
||||
'change_log': None,
|
||||
'client_script': None,
|
||||
'client_script_core': None,
|
||||
'client_string': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2009-10-28 10:25:03',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocType',
|
||||
'document_type': None,
|
||||
'dt_template': None,
|
||||
'hide_heading': None,
|
||||
'hide_toolbar': None,
|
||||
'idx': None,
|
||||
'in_create': None,
|
||||
'in_dialog': None,
|
||||
'is_transaction_doc': None,
|
||||
'issingle': 1,
|
||||
'istable': None,
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Tools',
|
||||
'name': 'File Browser Control',
|
||||
'name_case': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'print_outline': None,
|
||||
'read_only': None,
|
||||
'read_only_onload': None,
|
||||
'search_fields': None,
|
||||
'section_style': 'Simple',
|
||||
'server_code': None,
|
||||
'server_code_compiled': None,
|
||||
'server_code_core': None,
|
||||
'server_code_error': None,
|
||||
'show_in_menu': 0,
|
||||
'smallicon': None,
|
||||
'use_template': None,
|
||||
'version': 81
|
||||
}
|
||||
]
|
||||
0
tools/doctype/rating_template/__init__.py
Normal file
0
tools/doctype/rating_template/__init__.py
Normal file
1
tools/doctype/rating_template/rating_template.txt
Normal file
1
tools/doctype/rating_template/rating_template.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-12 18:12:18', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:template_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Rating Template', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00516', 'parent': 'Rating Template', 'read': 1, 'create': 1, 'creation': '2009-11-12 18:12:18', 'modified': '2010-08-06 01:21:20', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:12:18', 'doctype': 'DocField', 'oldfieldname': 'template_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Template Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03336', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:20', 'parenttype': 'DocType', 'fieldname': 'template_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-11-12 18:12:18', 'doctype': 'DocField', 'oldfieldname': 'total_stars', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Total Stars', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03337', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:20', 'parenttype': 'DocType', 'fieldname': 'total_stars', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-11-12 18:12:18', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Template Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03338', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-11-12 18:12:18', 'doctype': 'DocField', 'oldfieldname': 'rating_template_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Template Details1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03339', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:20', 'parenttype': 'DocType', 'fieldname': 'rating_template_details', 'fieldtype': 'Table', 'options': 'Rating Template Detail', 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/rating_template_detail/__init__.py
Normal file
0
tools/doctype/rating_template_detail/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-12 18:13:41', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'RTD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Rating Template Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-11-12 18:13:41', 'doctype': 'DocField', 'oldfieldname': 'rating', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03340', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:10', 'parenttype': 'DocType', 'fieldname': 'rating', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:13:41', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03341', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:10', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/rating_widget_control/__init__.py
Normal file
0
tools/doctype/rating_widget_control/__init__.py
Normal file
51
tools/doctype/rating_widget_control/rating_widget_control.py
Normal file
51
tools/doctype/rating_widget_control/rating_widget_control.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def show_my_rating(self,arg):
|
||||
arg = eval(arg)
|
||||
ret = {}
|
||||
ret['total_stars'] = convert_to_lists(sql("select total_stars from `tabRating Template` where name = %s", arg['template']))
|
||||
ret['avg_rating'] = convert_to_lists(sql("select count(name),round(sum(rating_stars)/count(name)) from `tabRating Widget Record` where rating_doctype = %s and rating_docname = %s and rating_template = %s",(arg['dt'], arg['dn'], arg['template'])))
|
||||
rating_details = convert_to_lists(sql("select name, rating_stars, rating_description, rating_template, rating_by, rating_to, rating_date, rating_time, rating_doctype, rating_docname from `tabRating Widget Record` where rating_by = %s and rating_doctype = %s and rating_docname = %s and rating_template = %s",(arg['by'], arg['dt'], arg['dn'], arg['template'])))
|
||||
if rating_details:
|
||||
ret['rating_details'] = rating_details or ''
|
||||
ret['flag'] = 1
|
||||
else:
|
||||
ret['rating_desc'] = convert_to_lists(sql("select rating, description from `tabRating Template Detail` where parent = %s", arg['template']))
|
||||
ret['flag'] = 0
|
||||
return ret
|
||||
|
||||
def add_rating(self,arg):
|
||||
import time
|
||||
arg = eval(arg)
|
||||
rw = Document('Rating Widget Record')
|
||||
rw.rating_stars = arg['rating']
|
||||
rw.rating_description = arg['desc']
|
||||
rw.rating_template = arg['template']
|
||||
rw.rating_by = arg['rating_by']
|
||||
rw.rating_to = Document(arg['dt'],arg['dn']).owner
|
||||
rw.rating_date = nowdate()
|
||||
rw.rating_time = time.strftime('%H:%M')
|
||||
rw.rating_doctype = arg['dt']
|
||||
rw.rating_docname = arg['dn']
|
||||
rw.save(1)
|
||||
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-12 18:26:54', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Rating Widget Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
|
||||
0
tools/doctype/rating_widget_record/__init__.py
Normal file
0
tools/doctype/rating_widget_record/__init__.py
Normal file
File diff suppressed because one or more lines are too long
0
tools/doctype/receiver_detail/__init__.py
Normal file
0
tools/doctype/receiver_detail/__init__.py
Normal file
1
tools/doctype/receiver_detail/receiver_detail.txt
Normal file
1
tools/doctype/receiver_detail/receiver_detail.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 17:10:13', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Receiver Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-07-05 13:29:27', 'doctype': 'DocField', 'oldfieldname': 'customer_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Customer Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Receiver Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05519', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-07-05 13:29:27', 'parenttype': 'DocType', 'fieldname': 'customer_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 17:10:13', 'doctype': 'DocField', 'oldfieldname': 'receiver_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Receiver Name', 'width': '350px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Receiver Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01344', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-07-05 13:29:27', 'parenttype': 'DocType', 'fieldname': 'receiver_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 17:10:13', 'doctype': 'DocField', 'oldfieldname': 'mobile_no', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Mobile No', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Receiver Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01345', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-07-05 13:29:27', 'parenttype': 'DocType', 'fieldname': 'mobile_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/reposting_tool/__init__.py
Normal file
0
tools/doctype/reposting_tool/__init__.py
Normal file
63
tools/doctype/reposting_tool/reposting_tool.js
Normal file
63
tools/doctype/reposting_tool/reposting_tool.js
Normal file
@@ -0,0 +1,63 @@
|
||||
var bin_list = [];
|
||||
var msg = [];
|
||||
var binidx = 0;
|
||||
|
||||
cur_frm.cscript['Repost Bin'] = function(doc,cdt,cdn) {
|
||||
args = {'check': 'Bin'};
|
||||
$c_obj('Reposting Tool','get_count_for_reposting', docstring(args), function(r,rt) {
|
||||
bin_list = r.message;
|
||||
repair_bin();
|
||||
});
|
||||
}
|
||||
|
||||
function repair_single_bin(){
|
||||
$c_obj('Reposting Tool', 'repair_bin', cstr(bin_list[binidx]), function(r,rt) {
|
||||
for(i = 0; i < r.message.length ; i++){
|
||||
msg.push(r.message[i]);
|
||||
}
|
||||
repair_bin();
|
||||
});
|
||||
}
|
||||
|
||||
function repair_bin(){
|
||||
if(binidx >= 10) {
|
||||
args = {'msg': msg, 'subject': 'Item Quantity'};
|
||||
$c_obj('Reposting Tool', 'send_mail', docstring(args));
|
||||
alert('Completed');
|
||||
return;
|
||||
}
|
||||
repair_single_bin();
|
||||
binidx ++;
|
||||
}
|
||||
|
||||
// Batch for Account Balances
|
||||
//======================================================
|
||||
var acc_list = [];
|
||||
var accidx = 0;
|
||||
cur_frm.cscript['Repost Account Balances'] = function(doc,cdt,cdn) {
|
||||
args = {'check': 'Account Balance'};
|
||||
$c_obj('Reposting Tool','get_count_for_reposting', docstring(args), function(r,rt) {
|
||||
acc_list = r.message;
|
||||
repair_acc_bal();
|
||||
});
|
||||
}
|
||||
|
||||
function repair_single_acc_bal(){
|
||||
$c_obj('Reposting Tool', 'repair_acc_bal', cstr(acc_list[accidx]), function(r,rt) {
|
||||
for(i = 0; i < r.message.length; i++){
|
||||
msg.push(r.message[i]);
|
||||
}
|
||||
repair_acc_bal();
|
||||
});
|
||||
}
|
||||
|
||||
function repair_acc_bal(){
|
||||
if(accidx >= 15) {
|
||||
args = {'msg' : msg, 'subject': 'Account Balance'};
|
||||
$c_obj('Reposting Tool', 'send_mail', docstring(args));
|
||||
alert('Completed');
|
||||
return;
|
||||
}
|
||||
repair_single_acc_bal();
|
||||
accidx ++;
|
||||
}
|
||||
156
tools/doctype/reposting_tool/reposting_tool.py
Normal file
156
tools/doctype/reposting_tool/reposting_tool.py
Normal file
@@ -0,0 +1,156 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.msg = []
|
||||
|
||||
def get_count_for_reposting(self, args):
|
||||
args = eval(args)
|
||||
if args['check'] == 'Bin':
|
||||
return [d[0] for d in sql("select name from `tabBin` where item_code = 'Repost Item' " )]
|
||||
|
||||
if args['check'] == 'Account Balance':
|
||||
# message
|
||||
if not self.doc.past_year:
|
||||
msgprint('<div style="color: ORANGE"> Warning: Opening balances were not imported </div>')
|
||||
|
||||
# do not repost from same year
|
||||
if self.doc.past_year == self.doc.name:
|
||||
msgprint("Cannot import from the current year")
|
||||
|
||||
return [d[0] for d in sql("select name from `tabAccount` ")]
|
||||
|
||||
def get_bin_qty(self, wh, item):
|
||||
# get actual_qty
|
||||
act_qty = sql("select ifnull(actual_qty, 0) from `tabBin` where warehouse = '%s' and item_code = '%s'" % (wh, item))
|
||||
act_qty = act_qty and flt(act_qty[0][0]) or 0
|
||||
|
||||
# get indented_qty
|
||||
ind_qty = sql("select sum(if( ifnull(t2.qty, 0) > ifnull(t2.ordered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.ordered_qty, 0), 0) ) from `tabIndent` t1, `tabIndent Detail`t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s'" % (wh, item))
|
||||
ind_qty = ind_qty and flt(ind_qty[0][0]) or 0
|
||||
|
||||
# get ordered_qty
|
||||
ord_qty = sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.received_qty, 0), (ifnull(t2.qty, 0) - ifnull(t2.received_qty, 0)) * ifnull(t2.conversion_factor, 0) , 0) ) from `tabPurchase Order` t1, `tabPO Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s'" % (wh, item))
|
||||
ord_qty = ord_qty and flt(ord_qty[0][0]) or 0
|
||||
|
||||
# get reserved_qty
|
||||
res_qty =sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.delivered_qty, 0) , 0) ) from `tabSales Order` t1, `tabSales Order Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.reserved_warehouse = '%s' and t2.item_code = '%s' " % (wh, item))
|
||||
res_qty = res_qty and flt(res_qty[0][0]) or 0
|
||||
|
||||
# get planned_qty
|
||||
plan_qty = sql("select sum(if ( ifnull(qty, 0) > ifnull(produced_qty,0), ifnull(qty, 0) - ifnull(produced_qty, 0), 0) ) from `tabProduction Order` where fg_warehouse = '%s' and production_item = '%s' and docstatus = 1" % (wh, item))
|
||||
plan_qty = plan_qty and flt(plan_qty[0][0]) or 0
|
||||
|
||||
return {'actual_qty': act_qty, 'indented_qty': ind_qty, 'ordered_qty': ord_qty, 'reserved_qty': res_qty, 'planned_qty': plan_qty }
|
||||
|
||||
def check_bin_qty(self, bin_obj, qty_dict):
|
||||
label_dict = {'actual_qty': 'Actual Qty', 'indented_qty': 'Indent Qty', 'ordered_qty': 'Ordered Qty', 'reserved_qty': 'Reserved Qty', 'planned_qty': 'Planned Qty'}
|
||||
for f in qty_dict:
|
||||
if flt(bin_obj.doc.fields[f]) != qty_dict[f]:
|
||||
msgprint('<div style="color: RED"> Difference found in %s for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (label_dict[f], bin_obj.doc.item_code, bin_obj.doc.warehouse, cstr(bin_obj.doc.fields[f]), cstr(qty_dict[f])))
|
||||
self.msg.append('<div style="color: RED"> Difference found in %s for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (label_dict[f], bin_obj.doc.item_code, bin_obj.doc.warehouse, cstr(bin_obj.doc.fields[f]), cstr(qty_dict[f])))
|
||||
|
||||
# Check projected qty
|
||||
projected_qty = flt(qty_dict['actual_qty']) + flt(qty_dict['indented_qty']) + flt(qty_dict['ordered_qty']) + flt(qty_dict['planned_qty']) - flt(qty_dict['reserved_qty'])
|
||||
if flt(projected_qty) != flt(bin_obj.doc.projected_qty):
|
||||
msgprint('<div style="color: RED">Difference found in Projected Qty for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (bin_obj.doc.item_code, bin_obj.doc.warehouse, bin_obj.doc.projected_qty, cstr(projected_qty)))
|
||||
self.msg.append('<div style="color: RED">Difference found in Projected Qty for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (bin_obj.doc.item_code, bin_obj.doc.warehouse, bin_obj.doc.projected_qty, cstr(projected_qty)))
|
||||
|
||||
def repair_bin(self, bin):
|
||||
import webnotes
|
||||
bin_obj = get_obj('Bin',bin)
|
||||
bin_act_qty = flt(bin_obj.doc.actual_qty)
|
||||
try:
|
||||
# udpate actual qty and item valuation
|
||||
bin_obj.update_item_valuation('', '2000-01-01', '00:00')
|
||||
# get bin qty
|
||||
qty_dict = self.get_bin_qty(bin_obj.doc.warehouse, bin_obj.doc.item_code)
|
||||
|
||||
# check bin qty
|
||||
self.check_bin_qty(bin_obj, qty_dict)
|
||||
|
||||
# update indented_qty, ordered_qty, reserved_qty, planned_qty
|
||||
sql("update `tabBin` set indented_qty = '%s', ordered_qty = '%s', reserved_qty = '%s', planned_qty = '%s' where warehouse = '%s' and item_code = '%s'" % ( flt(qty_dict['indented_qty']), flt(qty_dict['ordered_qty']), flt(qty_dict['reserved_qty']), flt(qty_dict['planned_qty']), bin_obj.doc.warehouse, bin_obj.doc.item_code))
|
||||
|
||||
# update projected_qty
|
||||
sql("update `tabBin` set projected_qty = ifnull(indented_qty, 0) + ifnull(ordered_qty,0) + ifnull(actual_qty, 0) + ifnull(planned_qty, 0) - ifnull(reserved_qty,0) where warehouse = '%s' and item_code = '%s' " % (bin_obj.doc.warehouse, bin_obj.doc.item_code))
|
||||
if not self.msg:
|
||||
msgprint('<div style="color: GREEN"> Reposting of Stock for Item %s and Warehouse %s completed Successfully. </div>' % (bin_obj.doc.item_code, bin_obj.doc.warehouse))
|
||||
except Exception:
|
||||
msgprint('<div style="color: RED"> Handle Item %s and Warehouse %s seprately. </div> <div style="color: RED"> ERROR: %s</div>' % (bin_obj.doc.item_code, bin_obj.doc.warehouse, str(webnotes.utils.getTraceback())))
|
||||
self.msg.append('<div style="color: RED"> ERROR: %s</div>' % (str(webnotes.utils.getTraceback())))
|
||||
|
||||
def repair_opening_bal(self, d, acc_obj, past_yr, fiscal_yr):
|
||||
# check opening balance
|
||||
opbal = sql("select balance from `tabAccount Balance` where account=%s and period = %s", (acc_obj.doc.name, past_yr))
|
||||
if flt(d.opening) != flt(opbal and flt(opbal[0][0]) or 0):
|
||||
msgprint('<div style="color: RED"> Difference found in Opening of Account %s for Period %s in Fiscal Year %s (Before : %s; After : %s) </div>' % (acc_obj.doc.name, d.period, fiscal_yr, flt(d.opening), opbal and flt(opbal[0][0]) or 0))
|
||||
self.msg.append('<div style="color: RED"> Difference found in Opening of Account %s for Period %s in Fiscal Year %s (Before : %s; After : %s) </div>' % (acc_obj.doc.name, d.period, fiscal_yr, flt(d.opening), opbal and flt(opbal[0][0]) or 0))
|
||||
sql("update `tabAccount Balance` set opening = '%s' where period = '%s' and account = '%s' " % (opbal and flt(opbal[0][0]) or 0, fiscal_yr, acc_obj.doc.name))
|
||||
|
||||
def repair_bal(self, d, acc_obj, fiscal_yr):
|
||||
# check balances
|
||||
ysd = get_value('Fiscal Year', fiscal_yr, 'year_start_date')
|
||||
bal = get_obj('GL Control').get_as_on_balance(acc_obj.doc.name, fiscal_yr, d.end_date, acc_obj.doc.debit_or_credit, acc_obj.doc.is_pl_account, acc_obj.doc.lft, acc_obj.doc.rgt, ysd)
|
||||
if flt(d.balance) != flt(bal):
|
||||
msgprint('<div style="color: RED"> Difference found in Balance of Account %s for Period %s in Fiscal Year %s (Before : %s; After : %s) </div>' % (acc_obj.doc.name, d.period, fiscal_yr, flt(d.balance), flt(bal)))
|
||||
self.msg.append('<div style="color: RED"> Difference found in Balance of Account %s for Period %s in Fiscal Year %s (Before : %s; After : %s) </div>' % (acc_obj.doc.name, d.period, fiscal_yr, flt(d.balance), flt(bal)))
|
||||
sql("update `tabAccount Balance` set balance = '%s' where period = '%s' and account = '%s' " % (bal, d.period, acc_obj.doc.name))
|
||||
|
||||
def repair_acc_bal(self, acc, past_yr = '' , fiscal_yr = ''):
|
||||
# get account obj
|
||||
acc_obj = get_obj('Account', acc, with_children = 1)
|
||||
|
||||
# get fiscal yr & past yr
|
||||
if not fiscal_yr:
|
||||
import webnotes.utils
|
||||
fiscal_yr = webnotes.utils.get_defaults()['fiscal_year']
|
||||
if not past_yr: past_yr = get_value('Fiscal Year', fiscal_yr, 'past_year')
|
||||
|
||||
# Repair Opening and Balance For Account Balances
|
||||
for d in getlist(acc_obj.doclist, 'account_balances'):
|
||||
if d.fiscal_year == fiscal_yr:
|
||||
if past_yr and (past_yr != fiscal_yr) and d.period == fiscal_yr:
|
||||
self.repair_opening_bal(d, acc_obj, past_yr, fiscal_yr)
|
||||
else:
|
||||
self.repair_bal(d, acc_obj, fiscal_yr)
|
||||
|
||||
# Acknowledge USer
|
||||
if not self.msg:
|
||||
msgprint('<div style="color: GREEN"> Openings & Balances of Account %s for Fiscal Year %s updated successfully. </div>' % ( acc_obj.doc.name, fiscal_yr))
|
||||
|
||||
return self.msg
|
||||
|
||||
def send_mail(self, args):
|
||||
args = eval(args)
|
||||
self.msg, subject = args['msg'], args['subject']
|
||||
msgprint(self.msg)
|
||||
if self.msg:
|
||||
email_msg = """ Dear Administrator,
|
||||
|
||||
In Account := %s User := %s has Reposted %s and following was found:-
|
||||
|
||||
%s
|
||||
|
||||
""" % (get_value('Control Panel', None,'account_id'), session['user'], subject, '\n'.join(self.msg))
|
||||
|
||||
sendmail(['saumil@iwebnotes.com','nabin@iwebnotes.com'], subject='Repair of ' + cstr(subject), parts = [('text/plain', email_msg)])
|
||||
1
tools/doctype/reposting_tool/reposting_tool.txt
Normal file
1
tools/doctype/reposting_tool/reposting_tool.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-13 09:24:32', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 1, 'allow_email': 1, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 173, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Reposting Tool', 'idx': None, 'hide_toolbar': 1, 'colour': 'Light Blue:DEF', 'client_script': None, 'modified': '2010-10-14 12:15:59', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00769', 'parent': 'Reposting Tool', 'read': 1, 'create': 1, 'creation': '2010-04-13 09:24:32', 'modified': '2010-10-14 12:15:59', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-13 09:24:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Recalculate MAR & Actual Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Reposting Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04638', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-14 12:15:59', 'parenttype': 'DocType', 'fieldname': 'recalculate_mar_&_actual_qty', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-28 13:34:48', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Repost Bin', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Reposting Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05722', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-14 12:15:59', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-30 09:22:26', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Repost Account Balances', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Reposting Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05758', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-14 12:15:59', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/sms_control/__init__.py
Normal file
0
tools/doctype/sms_control/__init__.py
Normal file
93
tools/doctype/sms_control/sms_control.js
Normal file
93
tools/doctype/sms_control/sms_control.js
Normal file
@@ -0,0 +1,93 @@
|
||||
function SMSManager() {
|
||||
var me = this;
|
||||
this.get_contact_number = function(contact, key, value) {
|
||||
$c_obj('SMS Control', 'get_contact_number', {
|
||||
contact_name:contact,
|
||||
value:value,
|
||||
key:key
|
||||
}, function(r,rt) {
|
||||
if(r.exc) { msgprint(r.exc); return; }
|
||||
me.number = r.message;
|
||||
me.show_dialog();
|
||||
}
|
||||
);
|
||||
}
|
||||
this.show = function(contact, key, value, mobile_nos, message) {
|
||||
this.message = message;
|
||||
if (mobile_nos) {
|
||||
|
||||
me.number = mobile_nos;
|
||||
me.show_dialog();
|
||||
} else if (contact){
|
||||
this.get_contact_number(contact, key, value)
|
||||
} else {
|
||||
me.show_dialog();
|
||||
}
|
||||
}
|
||||
this.show_dialog = function() {
|
||||
if(!me.dialog)
|
||||
me.make_dialog();
|
||||
me.dialog.set_values({
|
||||
'message': me.message,
|
||||
'number': me.number
|
||||
})
|
||||
me.dialog.show();
|
||||
}
|
||||
this.make_dialog = function() {
|
||||
var d = new wn.widgets.Dialog({
|
||||
title: 'Send SMS',
|
||||
width: 400,
|
||||
fields: [
|
||||
{fieldname:'number', fieldtype:'Data', label:'Mobile Number', reqd:1},
|
||||
{fieldname:'message', fieldtype:'Text', label:'Message', reqd:1},
|
||||
{fieldname:'send', fieldtype:'Button', label:'Send'}
|
||||
]
|
||||
})
|
||||
d.make();
|
||||
d.fields_dict.send.input.onclick = function() {
|
||||
var btn = d.fields_dict.send.input;
|
||||
var v = me.dialog.get_values();
|
||||
if(v) {
|
||||
btn.set_working();
|
||||
$c_obj('SMS Control', 'send_form_sms', v, function(r,rt) {
|
||||
btn.done_working();
|
||||
if(r.exc) {msgprint(r.exc); return; }
|
||||
msgprint('Message Sent');
|
||||
me.dialog.hide();
|
||||
})
|
||||
}
|
||||
}
|
||||
this.dialog = d;
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Send SMS'] = function(doc,dt,dn) {
|
||||
var doc = cur_frm.doc;
|
||||
var sms_man = new SMSManager();
|
||||
var default_msg = {
|
||||
'Lead' : '',
|
||||
'Enquiry' : 'Your enquiry has been logged into the system. Ref No: ' + doc.name,
|
||||
'Quotation' : 'Quotation ' + doc.name + ' has been sent via email. Thanks!',
|
||||
'Sales Order' : 'Sales Order ' + doc.name + ' has been created against '
|
||||
+ (doc.quotation_no ? ('Quote No:' + doc.quotation_no) : '')
|
||||
+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),
|
||||
'Delivery Note' : 'Items has been delivered against delivery note: ' + doc.name
|
||||
+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),
|
||||
'Receivable Voucher': 'Invoice ' + doc.name + ' has been sent via email '
|
||||
+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),
|
||||
'Indent' : 'Indent ' + doc.name + ' has been raised in the system',
|
||||
'Purchase Order' : 'Purchase Order ' + doc.name + ' has been sent via email',
|
||||
'Purchase Receipt' : 'Items has been received against purchase receipt: ' + doc.name
|
||||
}
|
||||
|
||||
if (in_list(['Quotation', 'Sales Order', 'Delivery Note', 'Receivable Voucher'], doc.doctype))
|
||||
sms_man.show(doc.contact_person, 'customer', doc.customer, '', default_msg[doc.doctype]);
|
||||
else if (in_list(['Purchase Order', 'Purchase Receipt'], doc.doctype))
|
||||
sms_man.show(doc.contact_person, 'supplier', doc.supplier, '', default_msg[doc.doctype]);
|
||||
else if (doc.doctype == 'Lead')
|
||||
sms_man.show('', '', '', doc.mobile_no, default_msg[doc.doctype]);
|
||||
else if (doc.doctype == 'Enquiry')
|
||||
sms_man.show('', '', '', doc.contact_no, default_msg[doc.doctype]);
|
||||
else if (doc.doctype == 'Indent')
|
||||
sms_man.show('', '', '', '', default_msg[doc.doctype]);
|
||||
}
|
||||
190
tools/doctype/sms_control/sms_control.py
Normal file
190
tools/doctype/sms_control/sms_control.py
Normal file
@@ -0,0 +1,190 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cint, flt, load_json, nowdate, cstr
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes import session, msgprint
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# validate receiver numbers
|
||||
# =========================================================
|
||||
def validate_receiver_nos(self,receiver_list):
|
||||
validated_receiver_list = []
|
||||
for d in receiver_list:
|
||||
# remove invalid character
|
||||
invalid_char_list = [' ', '+', '-', '(', ')']
|
||||
for x in invalid_char_list:
|
||||
d = d.replace(x, '')
|
||||
|
||||
# mobile no validation for erpnext gateway
|
||||
if get_value('SMS Settings', None, 'sms_gateway_url'):
|
||||
mob_no = d
|
||||
else:
|
||||
if not d.startswith("0") and len(d) == 10:
|
||||
mob_no = "91" + d
|
||||
elif d.startswith("0") and len(d) == 11:
|
||||
mob_no = "91" + d[1:]
|
||||
elif len(d) == 12:
|
||||
mob_no = d
|
||||
else:
|
||||
msgprint("Invalid mobile no : " + cstr(d))
|
||||
raise Exception
|
||||
|
||||
if not mob_no.isdigit():
|
||||
msgprint("Invalid mobile no : " + cstr(mob_no))
|
||||
raise Exception
|
||||
|
||||
validated_receiver_list.append(mob_no)
|
||||
|
||||
if not validated_receiver_list:
|
||||
msgprint("Please enter valid mobile nos")
|
||||
raise Exception
|
||||
|
||||
return validated_receiver_list
|
||||
|
||||
|
||||
# Connect Gateway
|
||||
# =========================================================
|
||||
def connect_gateway(self):
|
||||
"login to gateway"
|
||||
from webnotes.utils.webservice import FrameworkServer
|
||||
fw = FrameworkServer('www.erpnext.com','/','__system@webnotestech.com','password',https=1)
|
||||
return fw
|
||||
|
||||
def get_sender_name(self):
|
||||
"returns name as SMS sender"
|
||||
return webnotes.conn.get_value('Manage Account', None, 'sms_sender_name') or 'ERPNext'
|
||||
|
||||
def get_contact_number(self, arg):
|
||||
"returns mobile number of the contact"
|
||||
args = load_json(arg)
|
||||
number = sql('select mobile_no, phone from tabContact where name=%s and %s=%s' % ('%s', args['key'], '%s'),\
|
||||
(args['contact_name'], args['value']))
|
||||
return number and (number[0][0] or number[0][1]) or ''
|
||||
|
||||
def send_form_sms(self, arg):
|
||||
"called from client side"
|
||||
args = load_json(arg)
|
||||
self.send_sms([str(args['number'])], str(args['message']))
|
||||
|
||||
|
||||
# Send SMS
|
||||
# =========================================================
|
||||
def send_sms(self, receiver_list, msg, sender_name = ''):
|
||||
receiver_list = self.validate_receiver_nos(receiver_list)
|
||||
|
||||
arg = { 'account_name' : webnotes.conn.get_value('Control Panel',None,'account_id'),
|
||||
'receiver_list' : receiver_list,
|
||||
'message' : msg,
|
||||
'sender_name' : sender_name or self.get_sender_name()
|
||||
}
|
||||
|
||||
# personalized or erpnext gateway
|
||||
if get_value('SMS Settings', None, 'sms_gateway_url'):
|
||||
ret = self.send_via_personalized_gateway(arg)
|
||||
msgprint(ret)
|
||||
else:
|
||||
ret = self.send_via_erpnext_gateway(arg)
|
||||
|
||||
# Send sms via personalized gateway
|
||||
# ==========================================================
|
||||
def send_via_personalized_gateway(self, arg):
|
||||
ss = get_obj('SMS Settings', 'SMS Settings', with_children=1)
|
||||
args = {ss.doc.message_parameter : arg.get('message')}
|
||||
for d in getlist(ss.doclist, 'static_parameter_details'):
|
||||
args[d.parameter] = d.value
|
||||
|
||||
resp = []
|
||||
for d in arg.get('receiver_list'):
|
||||
args[ss.doc.receiver_parameter] = d
|
||||
resp.append(self.send_request(ss.doc.sms_gateway_url, args))
|
||||
|
||||
return resp
|
||||
|
||||
# Send sms via ERPNext gateway
|
||||
# ==========================================================
|
||||
def send_via_erpnext_gateway(self, arg):
|
||||
fw = self.connect_gateway()
|
||||
ret = fw.run_method(method = 'erpnext_utils.sms_control.send_sms', args = arg)
|
||||
|
||||
if ret.get('exc'):
|
||||
msgprint(ret['exc'])
|
||||
raise Exception
|
||||
elif ret['message']:
|
||||
sms_sent = cint(ret['message']['sms_sent'])
|
||||
sms_bal = cint(ret['message']['sms_balance'])
|
||||
self.create_sms_log(arg, ret['message']['sms_sent'])
|
||||
|
||||
if not sms_sent:
|
||||
if sms_bal < len(arg['receiver_list']):
|
||||
msgprint("You do not have enough SMS balance. Current SMS Balance: " + cstr(sms_bal) + "\nYou can send mail to sales@erpnext.com to buy additional sms packages")
|
||||
raise Exception
|
||||
else:
|
||||
msgprint("Message sent failed. May be numbers are invalid or some other issues.")
|
||||
else:
|
||||
msgprint(cstr(sms_sent) + " message sucessfully sent!\nCurrent SMS Balance: " + cstr(cint(ret['message']['sms_balance']) - cint(ret['message']['sms_sent'])))
|
||||
|
||||
|
||||
# Send Request
|
||||
# =========================================================
|
||||
def send_request(self, gateway_url, args):
|
||||
import httplib, urllib
|
||||
server, api_url = self.scrub_gateway_url(gateway_url)
|
||||
conn = httplib.HTTPConnection(server) # open connection
|
||||
headers = {}
|
||||
headers['Accept'] = "text/plain, text/html, */*"
|
||||
conn.request('GET', api_url + urllib.urlencode(args), headers = headers) # send request
|
||||
resp = conn.getresponse() # get response
|
||||
resp = resp.read()
|
||||
return resp
|
||||
|
||||
# Split gateway url to server and api url
|
||||
# =========================================================
|
||||
def scrub_gateway_url(self, url):
|
||||
url = url.replace('http://', '').strip().split('/')
|
||||
server = url.pop(0)
|
||||
api_url = '/' + '/'.join(url)
|
||||
if not api_url.endswith('?'):
|
||||
api_url += '?'
|
||||
return server, api_url
|
||||
|
||||
|
||||
|
||||
|
||||
# Create SMS Log
|
||||
# =========================================================
|
||||
def create_sms_log(self, arg, sent_sms):
|
||||
sl = Document('SMS Log')
|
||||
sl.sender_name = arg['sender_name']
|
||||
sl.sent_on = nowdate()
|
||||
sl.receiver_list = cstr(arg['receiver_list'])
|
||||
sl.message = arg['message']
|
||||
sl.no_of_requested_sms = len(arg['receiver_list'])
|
||||
sl.no_of_sent_sms = sent_sms
|
||||
sl.save(new=1)
|
||||
|
||||
# Get SMS Balance
|
||||
# =========================================================
|
||||
def get_sms_balance(self):
|
||||
arg = { 'account_name' : webnotes.conn.get_value('Control Panel',None,'account_id') }
|
||||
if get_value('SMS Settings', None, 'sms_gateway_url'):
|
||||
ret = {}
|
||||
else:
|
||||
fw = self.connect_gateway()
|
||||
ret = fw.run_method(mothod = 'erpnext_utils.sms_control.get_sms_balance', args = arg)
|
||||
|
||||
if ret.get('exc'):
|
||||
msgprint(ret['exc'])
|
||||
raise Exception
|
||||
else:
|
||||
msgprint("Current SMS Balance: " + cstr(ret['message']) + "\nYou can send mail to sales@erpnext.com to buy sms packages")
|
||||
101
tools/doctype/sms_control/sms_control.txt
Normal file
101
tools/doctype/sms_control/sms_control.txt
Normal file
@@ -0,0 +1,101 @@
|
||||
[
|
||||
{
|
||||
'allow_attach': None,
|
||||
'allow_copy': None,
|
||||
'allow_email': None,
|
||||
'allow_print': None,
|
||||
'allow_rename': None,
|
||||
'allow_trash': None,
|
||||
'autoname': None,
|
||||
'change_log': None,
|
||||
'client_script': None,
|
||||
'client_script_core': None,
|
||||
'client_string': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-08-08 17:09:24',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocType',
|
||||
'document_type': None,
|
||||
'dt_template': None,
|
||||
'hide_heading': None,
|
||||
'hide_toolbar': None,
|
||||
'idx': None,
|
||||
'in_create': 0,
|
||||
'in_dialog': None,
|
||||
'is_transaction_doc': None,
|
||||
'issingle': 1,
|
||||
'istable': None,
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-04-08 16:53:02',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Tools',
|
||||
'name': 'SMS Control',
|
||||
'name_case': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parent_node': '',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'print_outline': None,
|
||||
'read_only': None,
|
||||
'read_only_onload': None,
|
||||
'search_fields': None,
|
||||
'section_style': 'Simple',
|
||||
'server_code': None,
|
||||
'server_code_compiled': None,
|
||||
'server_code_core': None,
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'smallicon': None,
|
||||
'use_template': None,
|
||||
'version': 4
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': None,
|
||||
'create': 1,
|
||||
'creation': '2010-08-08 17:09:24',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 1,
|
||||
'match': None,
|
||||
'modified': '2011-04-08 16:53:02',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00534',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Control',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Administrator',
|
||||
'submit': None,
|
||||
'write': 1
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': None,
|
||||
'create': None,
|
||||
'creation': '2010-08-08 17:09:24',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 2,
|
||||
'match': None,
|
||||
'modified': '2011-04-08 16:53:02',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00535',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Control',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 1,
|
||||
'read': 1,
|
||||
'role': 'Administrator',
|
||||
'submit': None,
|
||||
'write': None
|
||||
}
|
||||
]
|
||||
0
tools/doctype/sms_log/__init__.py
Normal file
0
tools/doctype/sms_log/__init__.py
Normal file
1
tools/doctype/sms_log/sms_log.txt
Normal file
1
tools/doctype/sms_log/sms_log.txt
Normal file
File diff suppressed because one or more lines are too long
0
tools/doctype/todo_item/__init__.py
Normal file
0
tools/doctype/todo_item/__init__.py
Normal file
1
tools/doctype/todo_item/todo_item.txt
Normal file
1
tools/doctype/todo_item/todo_item.txt
Normal file
File diff suppressed because one or more lines are too long
0
tools/doctype/trash_control/__init__.py
Normal file
0
tools/doctype/trash_control/__init__.py
Normal file
59
tools/doctype/trash_control/trash_control.py
Normal file
59
tools/doctype/trash_control/trash_control.py
Normal file
@@ -0,0 +1,59 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
|
||||
# Get Masters
|
||||
# -----------
|
||||
def get_masters(self):
|
||||
mlist = []
|
||||
res = sql("select distinct t1.name from tabDocType t1, tabDocPerm t2 where ifnull(t1.allow_trash, 0) = 1 and (ifnull(t2.write, 0) = 1 or ifnull(t2.create, 0) = 1) and t2.role in %s and t2.parent = t1.name and t1.module not in ('DocType','Application Internal','Recycle Bin','Development','Testing','Testing System','Test') ORDER BY t1.name" % cstr(tuple(webnotes.user.get_roles())))
|
||||
for r in res:
|
||||
mlist.append(r[0])
|
||||
return mlist
|
||||
|
||||
|
||||
# Get Trash Records
|
||||
# -----------------
|
||||
def get_trash_records(self, mast_name):
|
||||
mlist = []
|
||||
rec_dict = {}
|
||||
if mast_name == 'All':
|
||||
mlist = self.get_masters()
|
||||
else:
|
||||
mlist.append(mast_name)
|
||||
for i in mlist:
|
||||
rec = [r[0] for r in sql("select name from `tab%s` where docstatus = 2" % i)]
|
||||
if rec:
|
||||
rec_dict[i] = rec
|
||||
return rec_dict
|
||||
|
||||
|
||||
# Restore Records
|
||||
# ---------------
|
||||
def restore_records(self, arg):
|
||||
arg = eval(arg)
|
||||
for k in arg:
|
||||
for r in arg[k]:
|
||||
sql("update `tab%s` set docstatus = 0, modified = '%s', trash_reason = '' where name = '%s'" % (k, now(), r))
|
||||
dt_obj = get_obj(k,r)
|
||||
if hasattr(dt_obj, 'on_restore'): dt_obj.on_restore()
|
||||
1
tools/doctype/trash_control/trash_control.txt
Normal file
1
tools/doctype/trash_control/trash_control.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-19 09:59:18', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 37, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Trash Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-13 16:35:49', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
|
||||
0
tools/doctype/tweet/__init__.py
Normal file
0
tools/doctype/tweet/__init__.py
Normal file
1
tools/doctype/tweet/tweet.txt
Normal file
1
tools/doctype/tweet/tweet.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-05-13 12:23:54', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'TW.######', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Tweet', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-17 12:48:20', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00289', 'parent': 'Tweet', 'read': 1, 'create': None, 'creation': '2009-05-13 12:23:54', 'modified': '2010-03-31 10:23:27', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-13 12:23:54', 'doctype': 'DocField', 'oldfieldname': 'by', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Tweet', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02041', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:23:27', 'parenttype': 'DocType', 'fieldname': 'by', 'fieldtype': 'Link', 'options': 'Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-05-13 12:23:54', 'doctype': 'DocField', 'oldfieldname': 'comment', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Comment', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Tweet', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02042', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:23:27', 'parenttype': 'DocType', 'fieldname': 'comment', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-26 01:31:48', 'doctype': 'DocField', 'oldfieldname': 'tag', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Tag', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Tweet', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02712', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:23:27', 'parenttype': 'DocType', 'fieldname': 'tag', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/while_you_were_out/__init__.py
Normal file
0
tools/doctype/while_you_were_out/__init__.py
Normal file
1
tools/doctype/while_you_were_out/while_you_were_out.txt
Normal file
1
tools/doctype/while_you_were_out/while_you_were_out.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-01-08 17:28:22', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'dhanalekshmi@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'WYWR/.####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'While You Were Out', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00569', 'parent': 'While You Were Out', 'read': 1, 'create': 1, 'creation': '2010-01-08 17:28:22', 'modified': '2010-03-31 09:47:12', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-01-08 17:28:22', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'While You Were Out', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'While You Were Out', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03551', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 09:47:12', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-08 17:28:22', 'doctype': 'DocField', 'oldfieldname': 'from_user', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'While You Were Out', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03552', 'idx': 2, 'default': '__user', 'colour': None, 'modified': '2010-03-31 09:47:12', 'parenttype': 'DocType', 'fieldname': 'from_user', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-01-08 17:28:22', 'doctype': 'DocField', 'oldfieldname': 'to_user', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'To', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'While You Were Out', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03553', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 09:47:12', 'parenttype': 'DocType', 'fieldname': 'to_user', 'fieldtype': 'Link', 'options': 'Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-01-08 17:28:22', 'doctype': 'DocField', 'oldfieldname': 'message', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'While You Were Out', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03554', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-31 09:47:12', 'parenttype': 'DocType', 'fieldname': 'message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/wiki_control/__init__.py
Normal file
0
tools/doctype/wiki_control/__init__.py
Normal file
32
tools/doctype/wiki_control/wiki_control.py
Normal file
32
tools/doctype/wiki_control/wiki_control.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
self.doc = d
|
||||
self.doclist = dl
|
||||
|
||||
def get_wiki_detail(self,arg):
|
||||
arg = eval(arg)
|
||||
ret = {}
|
||||
latest_revision = sql("select max(revision) from `tabWiki History` where reference=%s", arg['dn'])[0][0]
|
||||
|
||||
ret['detail'] = convert_to_lists(sql("select revision, modified_by,creation from `tabWiki History` where reference=%s and revision=%s", (arg['dn'],latest_revision)))
|
||||
ret['contributors'] = convert_to_lists(sql("select distinct modified_by from `tabWiki History` where reference=%s", arg['dn']))
|
||||
return ret
|
||||
1
tools/doctype/wiki_control/wiki_control.txt
Normal file
1
tools/doctype/wiki_control/wiki_control.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-12-08 18:08:48', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Wiki Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00528', 'parent': 'Wiki Control', 'read': None, 'create': None, 'creation': '2009-12-08 18:08:48', 'modified': '2009-12-09 16:57:54', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}]
|
||||
0
tools/doctype/wiki_history/__init__.py
Normal file
0
tools/doctype/wiki_history/__init__.py
Normal file
1
tools/doctype/wiki_history/wiki_history.txt
Normal file
1
tools/doctype/wiki_history/wiki_history.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-12-08 11:22:40', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'WH/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Wiki History', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00527', 'parent': 'Wiki History', 'read': 1, 'create': 1, 'creation': '2009-12-08 11:22:40', 'modified': '2009-12-09 16:57:44', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-08 11:22:40', 'doctype': 'DocField', 'oldfieldname': 'reference', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reference', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03483', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-12-09 16:57:44', 'parenttype': 'DocType', 'fieldname': 'reference', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-08 11:22:40', 'doctype': 'DocField', 'oldfieldname': 'version_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Version No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Wiki History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03484', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-12-09 16:57:44', 'parenttype': 'DocType', 'fieldname': 'version_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-12-08 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'revision', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Revision', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03487', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-12-09 16:57:44', 'parenttype': 'DocType', 'fieldname': 'revision', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2009-12-08 11:22:40', 'doctype': 'DocField', 'oldfieldname': 'editor', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Editor', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03485', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-12-09 16:57:44', 'parenttype': 'DocType', 'fieldname': 'editor', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
tools/doctype/wiki_page/__init__.py
Normal file
0
tools/doctype/wiki_page/__init__.py
Normal file
1
tools/doctype/wiki_page/wiki_page.txt
Normal file
1
tools/doctype/wiki_page/wiki_page.txt
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user