restructured erpnext and deleted unwanted

This commit is contained in:
nabinhait
2011-07-01 13:34:41 +05:30
parent c1c54c9400
commit ec097975d0
1280 changed files with 54494 additions and 88652 deletions

View File

@@ -0,0 +1 @@
[{'modified_by': 'Administrator', 'name': 'System Manager', 'parent': None, 'creation': '2009-03-12 13:53:20', 'modified': '2009-07-07 17:00:24', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
// Settings

View File

@@ -0,0 +1,196 @@
# 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
# -----------------------------------------------------------------------------------------
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
# Get Names of all Approving Users and Roles
# -------------------------------------------
def get_appr_user_role(self, det, doctype_name, total, based_on, condition, item, company):
amt_list, appr_users, appr_roles = [], [], []
users, roles = '',''
if det:
for x in det:
amt_list.append(flt(x[0]))
max_amount = max(amt_list)
app_dtl = sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = '%s' and (value = '%s' or value > '%s') and docstatus != 2 and based_on = '%s' and company = '%s' %s" % (doctype_name, flt(max_amount), total, based_on, company, condition))
if not app_dtl:
app_dtl = sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = '%s' and (value = '%s' or value > '%s') and docstatus != 2 and based_on = '%s' and ifnull(company,'') = '' %s" % (doctype_name, flt(max_amount), total, based_on, condition))
for d in app_dtl:
if(d[0]): appr_users.append(d[0])
if(d[1]): appr_roles.append(d[1])
if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, session['user']):
msg, add_msg = '',''
if max_amount:
dcc = TransactionBase().get_company_currency(self.doc.company)
if based_on == 'Grand Total': msg = "since Grand Total exceeds %s. %s" % (dcc, flt(max_amount))
elif based_on == 'Itemwise Discount': msg = "since Discount exceeds %s for Item Code : %s" % (cstr(max_amount)+'%', item)
elif based_on == 'Average Discount' or based_on == 'Customerwise Discount': msg = "since Discount exceeds %s" % (cstr(max_amount)+'%')
if appr_users: add_msg = "Users : "+cstr(appr_users)
if appr_roles: add_msg = "Roles : "+cstr(appr_roles)
if appr_users and appr_roles: add_msg = "Users : "+cstr(appr_users)+" or "+"Roles : "+cstr(appr_roles)
msgprint("You do not have an authority to submit this %s %s. Please send for approval to %s" % (doctype_name, msg, add_msg))
raise Exception
# Check if authorization rule is set specific to user
# ----------------------------------------------------
def validate_auth_rule(self, doctype_name, total, based_on, cond, company, item = ''):
chk = 1
add_cond1,add_cond2 = '',''
if based_on == 'Itemwise Discount':
add_cond1 += " and master_name = '"+cstr(item)+"'"
itemwise_exists = sql("select value from `tabAuthorization Rule` where transaction = '%s' and value <= '%s' and based_on = '%s' and company = '%s' and docstatus != 2 %s %s" % (doctype_name, total, based_on, company, cond, add_cond1))
if not itemwise_exists:
itemwise_exists = sql("select value from `tabAuthorization Rule` where transaction = '%s' and value <= '%s' and based_on = '%s' and ifnull(company,'') = '' and docstatus != 2 %s %s" % (doctype_name, total, based_on, cond, add_cond1))
if itemwise_exists:
self.get_appr_user_role(itemwise_exists, doctype_name, total, based_on, cond+add_cond1, item,company)
chk = 0
if chk == 1:
if based_on == 'Itemwise Discount': add_cond2 += " and ifnull(master_name,'') = ''"
appr = sql("select value from `tabAuthorization Rule` where transaction = '%s' and value <= '%s' and based_on = '%s' and company = '%s' and docstatus != 2 %s %s" % (doctype_name, total, based_on, company, cond, add_cond2))
if not appr:
appr = sql("select value from `tabAuthorization Rule` where transaction = '%s' and value <= '%s' and based_on = '%s' and ifnull(company,'') = '' and docstatus != 2 %s %s" % (doctype_name, total, based_on, cond, add_cond2))
self.get_appr_user_role(appr, doctype_name, total, based_on, cond+add_cond2, item, company)
# Bifurcate Authorization based on type
# --------------------------------------
def bifurcate_based_on_type(self, doctype_name, total, av_dis, based_on, doc_obj, val, company):
add_cond = ''
auth_value = av_dis
if val == 1: add_cond += " and system_user = '"+session['user']+"'"
elif val == 2: add_cond += " and system_role IN %s" % ("('"+"','".join(webnotes.user.get_roles())+"')")
else: add_cond += " and ifnull(system_user,'') = '' and ifnull(system_role,'') = ''"
if based_on == 'Grand Total': auth_value = total
elif based_on == 'Customerwise Discount':
if doc_obj:
if doc_obj.doc.doctype == 'Receivable Voucher': customer = doc_obj.doc.customer
else: customer = doc_obj.doc.customer_name
add_cond = " and master_name = '"+cstr(customer)+"'"
if based_on == 'Itemwise Discount':
if doc_obj:
for t in getlist(doc_obj.doclist, doc_obj.fname):
self.validate_auth_rule(doctype_name, t.adj_rate, based_on, add_cond, company,t.item_code )
else:
self.validate_auth_rule(doctype_name, auth_value, based_on, add_cond, company)
# Check Approving Authority for transactions other than expense voucher and Appraisal
# -------------------------
def validate_approving_authority(self, doctype_name,company, total, doc_obj = ''):
if doctype_name == 'Payable Voucher': doctype_name = 'Purchase Invoice'
elif doctype_name == 'Receivable Voucher': doctype_name = 'Sales Invoice'
av_dis = 0
if doc_obj:
ref_rate, basic_rate = 0, 0
for d in getlist(doc_obj.doclist, doc_obj.fname):
if d.base_ref_rate and d.basic_rate:
ref_rate += flt(d.base_ref_rate)
basic_rate += flt(d.basic_rate)
if ref_rate: av_dis = 100 - flt(basic_rate * 100 / ref_rate)
final_based_on = ['Grand Total','Average Discount','Customerwise Discount','Itemwise Discount']
# Individual User
# ================
# Check for authorization set for individual user
based_on = [x[0] for x in sql("select distinct based_on from `tabAuthorization Rule` where transaction = '%s' and system_user = '%s' and (company = '%s' or ifnull(company,'')='') and docstatus != 2" %(doctype_name, session['user'], company))]
for d in based_on:
self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 1, company)
# Remove user specific rules from global authorization rules
for r in based_on:
if r in final_based_on and r != 'Itemwise Discount': final_based_on.remove(r)
# Specific Role
# ===============
# Check for authorization set on particular roles
#based_on = [x[0] for x in sql("select based_on from `tabAuthorization Rule` where transaction = '%s' and system_role IN %s and based_on IN %s and docstatus != 2" %(doctype_name, "('"+"','".join(session['data']['profile']['roles'])+"')", "('"+"','".join(final_based_on)+"')"))]
based_on = [x[0] for x in sql("select based_on from `tabAuthorization Rule` where transaction = '%s' and system_role IN %s and based_on IN %s and (company = '%s' or ifnull(company,'')='') and docstatus != 2" %(doctype_name, "('"+"','".join(webnotes.user.get_roles())+"')", "('"+"','".join(final_based_on)+"')",company))]
for d in based_on:
self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 2, company)
# Remove role specific rules from global authorization rules
for r in based_on:
if r in final_based_on and r != 'Itemwise Discount': final_based_on.remove(r)
# Global Rule
# =============
# Check for global authorization
for g in final_based_on:
self.bifurcate_based_on_type(doctype_name, total, av_dis, g, doc_obj, 0, company)
#========================================================================================================================
# payroll related check
def get_value_based_rule(self,doctype_name,employee,total_claimed_amount,company):
val_lst =[]
val = sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and company = %s and docstatus!=2",(doctype_name,employee,employee,total_claimed_amount,company))
if not val:
val = sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and ifnull(company,'') = '' and docstatus!=2",(doctype_name,employee,employee,total_claimed_amount))
if val:
val_lst = [y[0] for y in val]
else:
val_lst.append(0)
max_val = max(val_lst)
rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and company = %s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,company,employee,employee,flt(max_val)), as_dict=1)
if not rule:
rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and ifnull(company,'') = '' and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,employee,employee,flt(max_val)), as_dict=1)
return rule
#---------------------------------------------------------------------------------------------------------------------
# related to payroll module only
def get_approver_name(self, doctype_name, total, doc_obj=''):
app_user=[]
app_specific_user =[]
rule ={}
if doc_obj:
if doctype_name == 'Expense Voucher':
rule = self.get_value_based_rule(doctype_name,doc_obj.doc.employee,doc_obj.doc.total_claimed_amount, doc_obj.doc.company)
elif doctype_name == 'Appraisal':
rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and company = %s and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee, doc_obj.doc.company),as_dict=1)
if not rule:
rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(company,'') = '' and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee),as_dict=1)
if rule:
for m in rule:
if m['to_emp'] or m['to_designation']:
if m['approving_user']:
app_specific_user.append(m['approving_user'])
elif m['approving_role']:
user_lst = [z[0] for z in sql("select distinct t1.name from `tabProfile` t1, `tabUserRole` t2 where t2.role=%s and t2.parent=t1.name and t1.name !='Administrator' and t1.name != 'Guest' and t1.docstatus !=2",m['approving_role'])]
for x in user_lst:
if not x in app_user:
app_user.append(x)
if len(app_specific_user) >0:
return app_specific_user
else:
return app_user

View File

@@ -0,0 +1,30 @@
# DocType, Authorization Control
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:52',
'docstatus': 0,
'modified': '2010-12-16 23:57:05',
'modified_by': 'nabin@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Tabbed',
'server_code_error': ' ',
'version': 216
},
# DocType, Authorization Control
{
'doctype': 'DocType',
'name': 'Authorization Control'
}
]

View File

@@ -0,0 +1,109 @@
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
// Settings Module
cur_frm.cscript.refresh = function(doc,cdt,cdn){
cur_frm.cscript.get_tips(doc, cdt, cdn);
if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Total Claimed Amount' || doc.based_on == 'Not Applicable') hide_field('master_name');
else unhide_field('master_name');
if(doc.based_on == 'Not Applicable') hide_field('value');
else unhide_field('value');
if(doc.transaction == 'Expense Voucher' || doc.transaction == 'Appraisal'){
hide_field(['master_name','system_role', 'system_user']);
unhide_field(['to_emp','to_designation']);
if(doc.transaction == 'Appraisal') hide_field('value');
else unhide_field('value');
}
else {
unhide_field(['master_name','system_role', 'system_user','value']);
hide_field(['to_emp','to_designation']);
}
}
cur_frm.cscript.based_on = function(doc){
if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Total Claimed Amount' || doc.based_on == 'Not Applicable'){
doc.master_name = '';
refresh_field('master_name');
hide_field('master_name');
}
else{
unhide_field('master_name');
}
if(doc.based_on == 'Not Applicable') {
doc.value =0;
refresh_field('value');
hide_field('value');
}
else unhide_field('value');
}
cur_frm.cscript.transaction = function(doc,cdt,cdn){
if(doc.transaction == 'Expense Voucher' || doc.transaction == 'Appraisal'){
doc.master_name = doc.system_role = doc.system_user = '';
refresh_many(['master_name','system_role', 'system_user']);
hide_field(['master_name','system_role', 'system_user']);
unhide_field(['to_emp','to_designation']);
if(doc.transaction == 'Appraisal') {
doc.value =0;
refresh_many('value');
hide_field('value');
}
else unhide_field('value');
}
else {
unhide_field(['master_name','system_role', 'system_user','value']);
hide_field(['to_emp','to_designation']);
}
if(doc.transaction == 'Expense Voucher') doc.based_on = 'Total Claimed Amount';
if(doc.transaction == 'Appraisal') doc.based_on == 'Not Applicable';
}
// System User Trigger
// -------------------
cur_frm.fields_dict['system_user'].get_query = function(doc) {
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
}
// System Role Trigger
// -----------------------
cur_frm.fields_dict['system_role'].get_query = function(doc) {
return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50'
}
// Approving User Trigger
// -----------------------
cur_frm.fields_dict['approving_user'].get_query = function(doc) {
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
}
// Approving Role Trigger
// -----------------------
cur_frm.fields_dict['approving_role'].get_query = function(doc) {
return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50'
}
// Master Name Trigger
// --------------------
cur_frm.fields_dict['master_name'].get_query = function(doc){
if(doc.based_on == 'Customerwise Discount')
return 'SELECT `tabCustomer`.`name` FROM `tabCustomer` WHERE `tabCustomer`.docstatus !=2 and `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` DESC LIMIT 50';
else if(doc.based_on == 'Itemwise Discount')
return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50';
else
return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC LIMIT 50';
}

View File

@@ -0,0 +1,91 @@
# 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
# Duplicate Entry
# ----------------
def check_duplicate_entry(self):
exists = sql("select name, docstatus from `tabAuthorization Rule` where transaction = %s and based_on = %s and system_user = %s and system_role = %s and approving_user = %s and approving_role = %s and to_emp =%s and to_designation=%s and name != %s", (self.doc.transaction, self.doc.based_on, cstr(self.doc.system_user), cstr(self.doc.system_role), cstr(self.doc.approving_user), cstr(self.doc.approving_role), cstr(self.doc.to_emp), cstr(self.doc.to_designation), self.doc.name))
auth_exists = exists and exists[0][0] or ''
if auth_exists:
if cint(exists[0][1]) == 2:
msgprint("Duplicate Entry. Please remove from trash Authorization Rule : %s." %(auth_exists))
raise Exception
else:
msgprint("Duplicate Entry. Please check Authorization Rule : %s." % (auth_exists))
raise Exception
# Validate Master Name
# ---------------------
def validate_master_name(self):
if self.doc.based_on == 'Customerwise Discount' and not sql("select name from tabCustomer where name = '%s' and docstatus != 2" % (self.doc.master_name)):
msgprint("Please select valid Customer Name for Customerwise Discount.")
raise Exception
elif self.doc.based_on == 'Itemwise Discount' and not sql("select name from tabItem where name = '%s' and docstatus != 2" % (self.doc.master_name)):
msgprint("Please select valid Item Name for Itemwise Discount.")
raise Exception
elif (self.doc.based_on == 'Grand Total' or self.doc.based_on == 'Average Discount') and self.doc.master_name:
msgprint("Please remove Customer / Item Name for %s." % (self.doc.based_on))
raise Exception
# Validate Rule
# --------------
def validate_rule(self):
if not self.doc.transaction == 'Expense Voucher' and not self.doc.transaction == 'Appraisal':
if not self.doc.approving_role and not self.doc.approving_user:
msgprint("Please enter Approving Role or Approving User")
raise Exception
elif self.doc.system_user and self.doc.system_user == self.doc.approving_user:
msgprint("Approving User cannot be same as user the rule is Applicable To (User).")
raise Exception
elif self.doc.system_role and self.doc.system_role == self.doc.approving_role:
msgprint("Approving Role cannot be same as user the rule is Applicable To (Role).")
raise Exception
elif self.doc.system_user and self.doc.approving_role and has_common([self.doc.approving_role],[x[0] for x in sql("select role from `tabUserRole` where parent = '%s'" % (self.doc.system_user))]):
msgprint("System User : %s is assigned role : %s. So rule does not make sense." % (self.doc.system_user,self.doc.approving_role))
raise Exception
elif (self.doc.transaction == 'Purchase Order' or self.doc.transaction == 'Purchase Receipt' or self.doc.transaction == 'Purchase Invoice' or self.doc.transaction == 'Stock Entry') and (self.doc.based_on == 'Average Discount' or self.doc.based_on == 'Customerwise Discount' or self.doc.based_on == 'Itemwise Discount'):
msgprint("You cannot set authorization on basis of Discount for %s." % (self.doc.transaction))
raise Exception
elif self.doc.based_on == 'Average Discount' and flt(self.doc.value) > 100.00:
msgprint("Discount cannot given for more than 100 %s." % ('%'))
raise Exception
elif self.doc.based_on == 'Customerwise Discount' and not self.doc.master_name:
msgprint("Please enter Customer Name for 'Customerwise Discount'")
raise Exception
else:
if self.doc.transaction == 'Appraisal' and self.doc.based_on != 'Not Applicable':
msgprint("Based on is 'Not Applicable' while setting authorization rule for 'Appraisal'")
raise Exception
if self.doc.transaction == 'Expense Voucher' and self.doc.based_on != 'Total Claimed Amount':
msgprint("Authorization rule should be based on 'Total Calimed Amount' while setting authorization rule for 'Expense Voucher'")
raise Exception
def validate(self):
self.check_duplicate_entry()
self.validate_rule()
self.validate_master_name()
if not self.doc.value: self.doc.value = flt(0)

View File

@@ -0,0 +1,223 @@
# DocType, Authorization Rule
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:52',
'docstatus': 0,
'modified': '2010-12-02 18:06:28',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1308741898',
'allow_trash': 1,
'autoname': 'AR.####',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'Setup',
'name': '__common__',
'search_fields': 'transaction,based_on,system_user,system_role,approving_user,approving_role',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 58
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Authorization Rule',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Authorization Rule',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'write': 1
},
# DocType, Authorization Rule
{
'doctype': 'DocType',
'name': 'Authorization Rule'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
'idx': 1,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'Company',
'reqd': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'transaction',
'fieldtype': 'Select',
'idx': 2,
'label': 'Transaction',
'oldfieldname': 'transaction',
'oldfieldtype': 'Select',
'options': '\nDelivery Note\nPurchase Invoice\nPurchase Order\nPurchase Receipt\nQuotation\nSales Invoice\nSales Order\nStock Entry\nExpense Voucher\nAppraisal',
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'based_on',
'fieldtype': 'Select',
'idx': 3,
'label': 'Based On',
'oldfieldname': 'based_on',
'oldfieldtype': 'Select',
'options': '\nGrand Total\nAverage Discount\nCustomerwise Discount\nItemwise Discount\nTotal Claimed Amount\nNot Applicable',
'reqd': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'master_name',
'fieldtype': 'Link',
'idx': 4,
'label': 'Customer / Item Name',
'oldfieldname': 'master_name',
'oldfieldtype': 'Link',
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'system_role',
'fieldtype': 'Link',
'idx': 5,
'label': 'Applicable To (Role)',
'oldfieldname': 'system_role',
'oldfieldtype': 'Link',
'options': 'Role'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'system_user',
'fieldtype': 'Link',
'idx': 6,
'label': 'Applicable To (User)',
'oldfieldname': 'system_user',
'oldfieldtype': 'Link',
'options': 'Profile'
},
# DocField
{
'colour': 'White:FFF',
'description': 'This will be used for setting rule in HR module',
'doctype': 'DocField',
'fieldname': 'to_emp',
'fieldtype': 'Link',
'idx': 7,
'label': 'Applicable To (Employee)',
'oldfieldname': 'to_emp',
'oldfieldtype': 'Link',
'options': 'Employee'
},
# DocField
{
'colour': 'White:FFF',
'description': 'This will be used for setting rule in HR module',
'doctype': 'DocField',
'fieldname': 'to_designation',
'fieldtype': 'Link',
'idx': 8,
'label': 'Applicable To (Designation)',
'oldfieldname': 'to_designation',
'oldfieldtype': 'Link',
'options': 'Designation'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'approving_role',
'fieldtype': 'Link',
'idx': 9,
'label': 'Approving Role',
'oldfieldname': 'approving_role',
'oldfieldtype': 'Link',
'options': 'Role'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'approving_user',
'fieldtype': 'Link',
'idx': 10,
'label': 'Approving User',
'oldfieldname': 'approving_user',
'oldfieldtype': 'Link',
'options': 'Profile'
},
# DocField
{
'default': '0.00',
'doctype': 'DocField',
'fieldname': 'value',
'fieldtype': 'Currency',
'idx': 11,
'label': 'Above Value',
'oldfieldname': 'value',
'oldfieldtype': 'Currency'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 12,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text'
}
]

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,88 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-23 13:32:22', 'search_fields': None, 'module': 'Setup', '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': 0, 'max_attachments': None, 'version': 25, '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': 'Contact 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}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00411', 'parent': 'Contact Control', 'read': 1, 'create': 0, 'creation': '2009-09-09 12:17:33', 'modified': '2010-08-06 22:02:45', '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': '2009-09-09 12:13:02', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Header', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02926', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'header', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-09 12:13:01', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Customer Intro', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02924', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'customer_intro', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-09 12:13:02', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Supplier Intro', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02925', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'supplier_intro', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Contact Control
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:56',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'read_only': 1,
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 25
},
# These values are common for all DocField
{
'doctype': 'DocField',
'fieldtype': 'Text',
'name': '__common__',
'parent': 'Contact Control',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 0,
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Contact Control',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'write': 1
},
# DocType, Contact Control
{
'doctype': 'DocType',
'name': 'Contact Control'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'header',
'idx': 1,
'label': 'Header'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_intro',
'idx': 2,
'label': 'Customer Intro'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'supplier_intro',
'idx': 3,
'label': 'Supplier Intro'
}
]

View File

@@ -1 +1,100 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-04-24 10:15:27', 'search_fields': '', 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, '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': 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': 'field:country_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Country', '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': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00501', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2009-11-04 16:20:24', 'modified': '2010-09-20 09:22:06', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00765', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-08 14:09:38', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00829', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-19 10:03:22', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00830', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-19 10:03:22', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-04-24 10:15:27', 'doctype': 'DocField', 'oldfieldname': 'country_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Country Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Country', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01929', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:22:06', 'parenttype': 'DocType', 'fieldname': 'country_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Country
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:56',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'autoname': 'field:country_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'in_create': 0,
'module': 'Setup',
'name': '__common__',
'read_only': 0,
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 11
},
# These values are common for all DocField
{
'doctype': 'DocField',
'fieldname': 'country_name',
'fieldtype': 'Data',
'idx': 1,
'label': 'Country Name',
'name': '__common__',
'oldfieldname': 'country_name',
'oldfieldtype': 'Data',
'parent': 'Country',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'reqd': 1
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Country',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Country
{
'doctype': 'DocType',
'name': 'Country'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'doctype': 'DocPerm',
'idx': 1,
'role': 'Sales Master Manager',
'submit': 0
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'Purchase Master Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 4,
'role': 'HR Manager'
},
# DocField
{
'doctype': 'DocField'
}
]

View File

@@ -1 +1,95 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-25 10:32:06', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, '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': 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:currency_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Currency', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-18 16:00:32', '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': 'PERM00294', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-05-18 12:54:45', 'modified': '2010-11-18 16:00:32', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00247', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-03-25 10:32:06', 'modified': '2010-11-18 16:00:32', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00248', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-03-25 10:32:06', 'modified': '2010-11-18 16:00:32', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01235', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2010-11-18 16:00:32', 'modified': '2010-11-18 16:00:32', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-25 10:32:06', 'doctype': 'DocField', 'oldfieldname': 'currency_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Currency Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Currency', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01465', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-18 16:00:32', 'parenttype': 'DocType', 'fieldname': 'currency_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Currency
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:56',
'docstatus': 0,
'modified': '2010-11-18 16:00:32',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'autoname': 'field:currency_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 0,
'module': 'Setup',
'name': '__common__',
'read_only': 0,
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 3
},
# These values are common for all DocField
{
'doctype': 'DocField',
'fieldname': 'currency_name',
'fieldtype': 'Data',
'idx': 1,
'label': 'Currency Name',
'name': '__common__',
'oldfieldname': 'currency_name',
'oldfieldtype': 'Data',
'parent': 'Currency',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'reqd': 1
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Currency',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Currency
{
'doctype': 'DocType',
'name': 'Currency'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'Accounts Manager'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'doctype': 'DocPerm',
'idx': 2,
'role': 'Sales Master Manager',
'submit': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'doctype': 'DocPerm',
'idx': 3,
'role': 'Purchase Master Manager',
'submit': 0
},
# DocField
{
'doctype': 'DocField'
}
]

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,5 @@
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if(!doc.outgoing_mail_server || !doc.mail_login || !doc.mail_password || !doc.auto_email_id || !doc.mail_port || !doc.use_ssl){
get_server_fields('set_vals','','',doc, cdt, cdn, 1);
}
}

View File

@@ -0,0 +1,44 @@
# 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,self.doclist = doc,doclist
def set_vals(self):
res = sql("select field, value from `tabSingles` where doctype = 'Control Panel' and field IN ('outgoing_mail_server','mail_login','mail_password','auto_email_id','mail_port','use_ssl')")
ret = {}
for r in res:
ret[cstr(r[0])]=r[1] and cstr(r[1]) or ''
return str(ret)
def on_update(self):
if self.doc.outgoing_mail_server:
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'outgoing_mail_server'"%self.doc.outgoing_mail_server)
if self.doc.mail_login:
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_login'"%self.doc.mail_login)
if self.doc.mail_password:
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_password'"%self.doc.mail_password)
if self.doc.auto_email_id:
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'auto_email_id'"%self.doc.auto_email_id)
if self.doc.mail_port:
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_port'"%self.doc.mail_port)
if self.doc.use_ssl:
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'use_ssl'"%self.doc.use_ssl)

View File

@@ -0,0 +1,125 @@
# DocType, Email Settings
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:59',
'docstatus': 0,
'modified': '2011-01-04 11:21:25',
'modified_by': 'umair@iwebnotes.com',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
'_last_update': '1307707462',
'allow_copy': 1,
'allow_email': 1,
'allow_print': 1,
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 27
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Email Settings',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'write': 1
},
# DocType, Email Settings
{
'doctype': 'DocType',
'name': 'Email Settings'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'outgoing_mail_server',
'fieldtype': 'Data',
'idx': 1,
'label': 'Outgoing Mail Server'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'mail_port',
'fieldtype': 'Data',
'idx': 2,
'label': 'Mail Port'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'use_ssl',
'fieldtype': 'Check',
'idx': 3,
'label': 'Use SSL'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'mail_login',
'fieldtype': 'Data',
'idx': 4,
'label': 'Login Id'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'mail_password',
'fieldtype': 'Password',
'idx': 5,
'label': 'Mail Password'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'auto_email_id',
'fieldtype': 'Data',
'idx': 6,
'label': 'Auto Email Id'
}
]

View File

@@ -1,3 +0,0 @@
cur_frm.cscript['Repost GL'] = function(doc,dt,dn) {
$c_obj('GL Control','repost_gl','',function(r,rt) {alert('Done')});
}

View File

@@ -1,131 +0,0 @@
# 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 get_bal(self,arg):
bal = sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
if bal:
return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
else:
return ''
def get_series(self):
self.doc.clear_table(self.doclist, 'series_details')
if self.doc.select_doctype:
sr= sql("Select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"%(self.doc.select_doctype))
if sr:
sr_list=sr[0][0].split("\n")
for x in sr_list:
if cstr(x)!='':
c = addchild(self.doc, 'series_details', 'Series Detail', 1, self.doclist)
c.series=cstr(x)
else:
msgprint("No series is mentioned")
else :
msgprint("Please select Doctype")
def remove_series(self):
if not getlist(self.doclist, 'series_details'):
msgprint("Please pull already existed series for the selected doctype and check the series that you want to remove")
else:
sr= sql("Select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"%(self.doc.select_doctype))
if sr:
sr_list=sr[0][0].split("\n")
for d in getlist(self.doclist, 'series_details'):
if d.remove == 1:
sr_list.remove(d.series)
sql("update `tabDocField` set options='%s' where fieldname='voucher_series' and parent='%s'"%("\n".join(sr_list),self.doc.select_doctype))
self.get_series()
def add_series(self):
if not self.doc.select_doctype or not self.doc.new_series:
msgprint("Please select Doctype and series name for which series will be added")
raise Exception
else:
sr_list = []
sr= sql("select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"% (self.doc.select_doctype))
if sr[0][0]:
sr_list=sr[0][0].split("\n")
self.check_duplicate()
if not sr_list:
sr_list.append('')
sr_list.append(self.get_new_series())
else:
sr_list.append(self.get_new_series())
sql("update `tabDocField` set options='%s' where fieldname='voucher_series' and parent='%s'"%("\n".join(sr_list),self.doc.select_doctype))
self.get_series()
def check_duplicate(self):
sr_list = sql("Select options from `tabDocField` where fieldname='voucher_series' group by parent")
nw_sr = self.get_new_series()
#msgprint(sr_list)
for sr in sr_list:
if nw_sr in sr[0]:
idx=sql("Select current from `tabSeries` where name='%s'"% (nw_sr + '/'))
msgprint("Series name already exist with index '%s'" %(idx[0][0]))
raise Exception
def get_new_series(self):
if 'FY' in cstr((self.doc.new_series).upper()):
abb=sql("select abbreviation from `tabFiscal Year` where name='%s'"%(self.doc.current_fiscal_year))
if not abb:
msgprint("Abbreviation is not mentioned in Fiscal Year")
raise Exception
else:
return cstr((self.doc.new_series).upper()).strip().replace('FY',abb[0][0])
else:
return cstr((self.doc.new_series).upper()).strip()
def on_update(self):
# fiscal year
set_default('fiscal_year', self.doc.current_fiscal_year)
ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", self.doc.current_fiscal_year, as_dict = 1)
set_default('year_start_date', ysd[0]['year_start_date'].strftime('%Y-%m-%d'))
set_default('year_end_date', get_last_day(get_first_day(ysd[0]['year_start_date'],0,11)).strftime('%Y-%m-%d'))
# company
set_default('company', self.doc.default_company)
set_default('stock_valuation', self.doc.stock_valuation or 'Moving Average')
set_default('default_currency', self.doc.default_currency or 'INR')
# Purchase in transit
if self.doc.purchase_in_transit_account:
set_default('purchase_in_transit_account', self.doc.purchase_in_transit_account)
def get_default_bank_account(self, company):
return sql("select default_bank_account from tabCompany where name = '%s'" % company)[0][0]
def get_bank_defaults(self, arg):
arg = eval(arg)
return {
'def_bv_type': self.doc.default_bank_voucher_type or '',
'def_bv_series': self.doc.default_bank_voucher_series or '',
'def_bank_account': self.get_default_bank_account(arg['company']) or '',
'bank_balance': self.get_bal(self.get_default_bank_account(arg['company'])) or 0.0,
'acc_balance': self.get_bal(arg['credit_to']) or 0.0
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1,30 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-09-17 16:54:59', 'search_fields': None, 'module': 'Setup', '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': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 13, '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': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Import Data Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-14 12:26:41', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
# DocType, Import Data Control
[
# These values are common in all dictionaries
{
'creation': '2010-10-04 16:30:30',
'docstatus': 0,
'modified': '2010-12-24 11:43:03',
'modified_by': 'abhishek@webnotestech.com',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 12
},
# DocType, Import Data Control
{
'doctype': 'DocType',
'name': 'Import Data Control'
}
]

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,80 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:00', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, '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': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:segment_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Market Segment', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': 'Title Case', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04852', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:00', 'doctype': 'DocField', 'oldfieldname': 'segment_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Segment Name', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00912', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'segment_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:10:00', 'doctype': 'DocField', 'oldfieldname': 'details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00913', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'details', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Market Segment
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:10',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:segment_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'module': 'Setup',
'name': '__common__',
'name_case': 'Title Case',
'read_only': 0,
'section_style': 'Simple',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Market Segment',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# DocType, Market Segment
{
'doctype': 'DocType',
'name': 'Market Segment'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'segment_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Segment Name',
'oldfieldname': 'segment_name',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'details',
'fieldtype': 'Text',
'idx': 3,
'label': 'Details',
'oldfieldname': 'details',
'oldfieldtype': 'Text',
'permlevel': 0
}
]

View File

View File

@@ -0,0 +1,19 @@
// Settings
cur_frm.cscript.onload = function(doc, cdt, cdn){
var callback = function(r, rt){
set_field_options('select_doc_for_series', r.message);
}
$c_obj([doc],'get_transactions','',callback);
// add page head
var ph = new PageHeader(cur_frm.fields_dict['Head HTML'].wrapper, 'Setup Series', 'Set prefix for numbering series on your transactions');
}
cur_frm.cscript.select_doc_for_series = function(doc, cdt, cdn) {
var callback = function(r, rt){
locals[cdt][cdn].set_options = r.message;
refresh_field('set_options');
}
$c_obj([doc],'get_options','',callback)
}

View File

@@ -0,0 +1,90 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import cint, cstr
from webnotes import msgprint, errprint
sql = webnotes.conn.sql
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
#-----------------------------------------------------------------------------------------------------------------------------------
def get_transactions(self):
return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.module !='Recycle Bin' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")])
#-----------------------------------------------------------------------------------------------------------------------------------
def get_options_for(self, doctype):
sr = sql("select options from `tabDocField` where parent='%s' and fieldname='naming_series'" % (doctype))
if sr and sr[0][0]:
return sr[0][0].split("\n")
else:
return []
def scrub_options_list(self, ol):
options = filter(lambda x: x, [cstr(n.upper()).strip() for n in ol])
return options
#-----------------------------------------------------------------------------------------------------------------------------------
def set_series_for(self, doctype, ol):
options = self.scrub_options_list(ol)
# validate names
[self.validate_series_name(i) for i in options]
if self.doc.user_must_always_select:
options = [''] + options
default = ''
else:
default = options[0]
# update
sql("update tabDocField set `options`=%s, `default`=%s where parent=%s and fieldname='naming_series'", ("\n".join(options), default, doctype))
self.doc.set_options = "\n".join(options)
#-----------------------------------------------------------------------------------------------------------------------------------
def update_series(self):
self.check_duplicate()
self.set_series_for(self.doc.select_doc_for_series, self.doc.set_options.split("\n"))
msgprint('Series Updated')
#-----------------------------------------------------------------------------------------------------------------------------------
def check_duplicate(self):
from core.doctype.doctype.doctype import DocType
dt = DocType()
sr = sql("select options, parent from `tabDocField` where fieldname='naming_series' and parent != %s", self.doc.select_doc_for_series)
options = self.scrub_options_list(self.doc.set_options.split("\n"))
for series in options:
dt.validate_series(series, self.doc.select_doc_for_series)
for i in sr:
if i[0]:
if series in i[0].split("\n"):
msgprint("Oops! Series name %s is already in use in %s. Please select a new one" % (series, i[1]), raise_exception=1)
#-----------------------------------------------------------------------------------------------------------------------------------
def validate_series_name(self, n):
import re
if not re.match('[a-zA-Z0-9]+(([-/][a-zA-Z0-9])?[-/][a-zA-Z0-9]*)*',n):
msgprint('Special Characters except "-" and "/" not allowed in naming series')
raise Exception
#-----------------------------------------------------------------------------------------------------------------------------------
def get_options(self, arg=''):
so = sql("select options from `tabDocField` where parent=%s and fieldname='naming_series'", self.doc.select_doc_for_series)
if so:
return so[0][0] or ''
#-----------------------------------------------------------------------------------------------------------------------------------
def update_series_start(self):
ser_det = sql("select name from `tabSeries` where name = %s", self.doc.prefix)
if ser_det:
sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.starts_from-1,self.doc.prefix))
else:
sql("insert into tabSeries (name, current) values (%s,%s)",(cstr(self.doc.prefix),cint(self.doc.starts_from)-1))
msgprint("Series Updated Successfully")

View File

@@ -0,0 +1,206 @@
# DocType, Naming Series
[
# These values are common in all dictionaries
{
'creation': '2010-10-27 14:29:55',
'docstatus': 0,
'modified': '2010-11-26 18:45:26',
'modified_by': 'sneha@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'hide_heading': 1,
'hide_toolbar': 1,
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'read_only': 1,
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 58
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Naming Series',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Naming Series',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Naming Series
{
'doctype': 'DocType',
'name': 'Naming Series'
},
# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'role': 'System Manager',
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 1,
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 0,
'role': 'System Manager',
'submit': 0,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 1,
'role': 'System Manager'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 1,
'role': 'System Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 0,
'role': 'Guest'
},
# DocField
{
'description': 'Set prefix for numbering series on your transactions',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Setup Series'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 2,
'label': 'Head HTML'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'select_doc_for_series',
'fieldtype': 'Select',
'idx': 3,
'label': 'Select Transaction'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 4,
'label': 'Help HTML',
'options': '<div style="padding: 8px; background-color: #FFD; margin: 8px 0px;">\nWrite the list of series options in the list below. Each on a new line<br>\nAllowed special characters are "/" and "-"<br>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\n</div>'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'set_options',
'fieldtype': 'Text',
'idx': 5,
'label': 'Set Series'
},
# DocField
{
'colour': 'White:FFF',
'description': 'Check this if you want to force the user to select a series before saving. There will be no default if you check this.',
'doctype': 'DocField',
'fieldname': 'user_must_always_select',
'fieldtype': 'Check',
'idx': 6,
'label': 'User must always select'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 7,
'label': 'Update',
'options': 'update_series'
},
# DocField
{
'description': 'Set starting number for series of your transactions',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 8,
'label': 'Update Series'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'prefix',
'fieldtype': 'Data',
'idx': 9,
'label': 'Prefix'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'starts_from',
'fieldtype': 'Int',
'idx': 10,
'label': 'Starts From'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 11,
'label': 'Update Series Start',
'options': 'update_series_start'
}
]

View File

@@ -1 +1,82 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-16 12:55:19', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, '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': 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': '__NSO.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Naming Series Options', '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': 'PERM01027', 'parent': 'Naming Series Options', 'read': 1, 'create': None, 'creation': '2010-06-03 11:30:14', 'modified': '2010-06-03 11:40:21', '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': 'Data', 'creation': '2010-04-16 12:55:19', 'doctype': 'DocField', 'oldfieldname': 'doc_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Doc Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series Options', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04662', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-03 11:40:21', 'parenttype': 'DocType', 'fieldname': 'doc_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-16 12:55:19', 'doctype': 'DocField', 'oldfieldname': 'series_options', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Series Options', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series Options', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04663', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-03 11:40:21', 'parenttype': 'DocType', 'fieldname': 'series_options', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Naming Series Options
[
# These values are common in all dictionaries
{
'creation': '2010-12-14 10:23:17',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'autoname': '__NSO.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'module': 'Setup',
'name': '__common__',
'read_only': 0,
'section_style': 'Simple',
'server_code_error': ' ',
'version': 4
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Naming Series Options',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Naming Series Options',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager'
},
# DocType, Naming Series Options
{
'doctype': 'DocType',
'name': 'Naming Series Options'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'doc_type',
'fieldtype': 'Data',
'idx': 1,
'label': 'Doc Type',
'oldfieldname': 'doc_type',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'series_options',
'fieldtype': 'Text',
'idx': 2,
'label': 'Series Options',
'oldfieldname': 'series_options',
'oldfieldtype': 'Text'
}
]

View File

@@ -0,0 +1,10 @@
cur_frm.cscript.select_transaction = function(doc, dt, dn) {
if(doc.select_transaction) {
var callback = function(r,rt) {
var doc = locals[dt][dn];
doc.custom_message = r.message;
refresh_field('custom_message');
}
$c_obj('Notification Control','get_message',doc.select_transaction, callback)
}
}

View File

@@ -0,0 +1,104 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import validate_email_add, cint, cstr
from webnotes.model.doc import Document
from webnotes import msgprint
sql = webnotes.conn.sql
# -----------------------------------------------------------------------------------------
def get_formatted_message(head, body):
if head:
head = '<div style="font-size: 19px; margin-bottom: 13px; color: #333; font-family: Arial;">%s</div>' % head
else:
head = ''
return '''
<div style="margin: 13px">
%(head)s
<p style="font-size: 14px; line-height: 1.7em; color: #555; font-family: Arial;">
%(body)s
</p>
</div>
''' % {'head':head, 'body':body.replace('\n', '<br>')}
# Notification control
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
# get message to load in custom text
# ----------------------------------
def get_message(self, arg):
fn = arg.lower().replace(' ', '_') + '_message'
v = sql("select value from tabSingles where field=%s and doctype=%s", (fn, 'Notification Control'))
return v and v[0][0] or ''
# set custom text
# ---------------
def set_message(self, arg=''):
fn = self.doc.select_transaction.lower().replace(' ', '_') + '_message'
webnotes.conn.set(self.doc, fn, self.doc.custom_message)
msgprint("Custom Message for %s updated!" % self.doc.select_transaction)
# notify contact
# --------------
def notify_contact(self, key, dt, dn, contact_email, contact_nm):
if contact_email:
dt_small = dt.replace(' ','_').lower()
if cint(self.doc.fields.get(dt_small)):
self.send_notification(key, dt, dn, contact_email, contact_nm)
# send notification
def send_notification(self, key, dt, dn, contact_email, contact_nm):
import webnotes.utils.encrypt
import os
from webnotes.utils.email_lib import sendmail
cp = Document('Control Panel', 'Control Panel')
banner = cp.client_name
sender_nm = sql("select concat_ws(' ', first_name, last_name) from tabProfile where name = %s", webnotes.session['user'])[0][0] or ''
if contact_nm:
contact_nm = ' ' + contact_nm
else:
contact_nm = ''
msg = '''
<div style="margin-bottom: 13px;">%(company_banner)s</div>
Hi%(contact)s,
%(message)s
<a href="http://%(domain)s/v170/index.cgi?page=Form/%(dt)s/%(dn)s&ac_name=%(account)s&akey=%(akey)s">Click here to see the document.</a></p>
Thanks,
%(sent_by)s
%(company_name)s
''' % {
'company_banner': banner,
'contact': contact_nm,
'message': self.doc.fields[key.lower().replace(' ','_')+'_message'],
'sent_by': sender_nm,
'company_name':cp.company_name,
'dt': dt.replace(' ', '%20'),
'dn': dn.replace('/', '%2F'),
'domain': os.environ.get('HTTP_HOST'),
'account': cp.account_id,
'akey': webnotes.utils.encrypt.encrypt(dn)
}
if not validate_email_add(webnotes.session['user']):
sender = "automail@webnotestech.com"
else:
sender = webnotes.session['user']
rec_lst = [contact_email, sender]
subject = cp.company_name + ' - ' + dt
sendmail(rec_lst, sender, get_formatted_message(None, msg), subject)

View File

@@ -0,0 +1,330 @@
# DocType, Notification Control
[
# These values are common in all dictionaries
{
'creation': '2010-09-01 15:48:07',
'docstatus': 0,
'modified': '2010-10-14 10:48:02',
'modified_by': 'nabin@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_copy': 1,
'allow_email': 1,
'allow_print': 1,
'colour': 'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 79
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Notification Control',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Notification Control',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1
},
# DocType, Notification Control
{
'doctype': 'DocType',
'name': 'Notification Control'
},
# DocPerm
{
'create': 0,
'doctype': 'DocPerm',
'idx': 1,
'role': 'Guest',
'write': 0
},
# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 2,
'role': 'System Manager',
'write': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Send Auto-notification for'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 2,
'label': 'Sales',
'width': '50%'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'enquiry',
'fieldtype': 'Check',
'hidden': 1,
'idx': 3,
'label': 'Enquiry',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'quotation',
'fieldtype': 'Check',
'idx': 4,
'label': 'Quotation'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'sales_order',
'fieldtype': 'Check',
'idx': 5,
'label': 'Sales Order'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'delivery_note',
'fieldtype': 'Check',
'idx': 6,
'label': 'Delivery Note'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'receivable_voucher',
'fieldtype': 'Check',
'idx': 7,
'label': 'Sales Invoice'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 8,
'label': 'Purchase',
'width': '50%'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'purchase_order',
'fieldtype': 'Check',
'idx': 9,
'label': 'Purchase Order'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'purchase_receipt',
'fieldtype': 'Check',
'idx': 10,
'label': 'Purchase Receipt'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'payable_voucher',
'fieldtype': 'Check',
'idx': 11,
'label': 'Purchase Invoice',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'expense_voucher',
'fieldtype': 'Check',
'idx': 12,
'label': 'Expense Voucher'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 13,
'label': 'Customize the Notification'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'select_transaction',
'fieldtype': 'Select',
'idx': 14,
'label': 'Select Transaction',
'options': '\nQuotation\nSales Order\nDelivery Note\nSales Invoice\nPayment Received\nPurchase Order\nPurchase Receipt\nPayment Sent',
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'custom_message',
'fieldtype': 'Text Editor',
'idx': 15,
'label': 'Custom Message'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 16,
'label': 'Update',
'options': 'set_message'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'quotation_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 17,
'label': 'Quotation Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'sales_order_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 18,
'label': 'Sales Order Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'delivery_note_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 19,
'label': 'Delivery Note Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'sales_invoice_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 20,
'label': 'Sales Invoice Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'payment_received_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 21,
'label': 'Payment Received Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'purchase_order_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 22,
'label': 'Purchase Order Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'purchase_receipt_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 23,
'label': 'Purchase Receipt Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'payment_sent_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 24,
'label': 'Payment Sent Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'expense_voucher_approved_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 25,
'label': 'Expense Voucher Approved Message',
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'expense_voucher_rejected_message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 26,
'label': 'Expense Voucher Rejected Message',
'print_hide': 1
}
]

View File

@@ -1 +1,97 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-07 10:35:41', 'search_fields': None, 'module': 'Setup', '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': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:order_lost_reason', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Order Lost Reason', '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': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00344', 'parent': 'Order Lost Reason', 'read': 1, 'create': 1, 'creation': '2009-07-07 10:35:41', 'modified': '2010-09-20 09:51:33', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00555', 'parent': 'Order Lost Reason', 'read': 1, 'create': 1, 'creation': '2009-12-31 12:18:01', 'modified': '2010-09-20 09:51:33', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Order Lost Reason', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04854', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:51:33', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-07-07 10:35:41', 'doctype': 'DocField', 'oldfieldname': 'order_lost_reason', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Order Lost Reason', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Order Lost Reason', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02544', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:51:33', 'parenttype': 'DocType', 'fieldname': 'order_lost_reason', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Order Lost Reason
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:10',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:order_lost_reason',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 4
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Order Lost Reason',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Order Lost Reason',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Order Lost Reason
{
'doctype': 'DocType',
'name': 'Order Lost Reason'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'amend': 0,
'doctype': 'DocPerm',
'idx': 2,
'role': 'Sales Master Manager',
'submit': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'order_lost_reason',
'fieldtype': 'Data',
'idx': 2,
'label': 'Order Lost Reason',
'oldfieldname': 'order_lost_reason',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
}
]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1,32 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-27 12:47:10', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'nabin@webnotestech.com', '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': 36, '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': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Period 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}]
# DocType, Period Control
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:12',
'docstatus': 0,
'modified': '2011-01-03 17:46:14',
'modified_by': 'umair@iwebnotes.com',
'owner': 'nabin@webnotestech.com'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'read_only': 1,
'section_style': 'Simple',
'server_code_error': ' ',
'version': 36
},
# DocType, Period Control
{
'doctype': 'DocType',
'name': 'Period Control'
}
]

View File

@@ -0,0 +1,186 @@
# 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 Roles and Modules on loading Permission Engine
# -----------------------------------------------------
def get_doctype_list(self):
ret = sql("""SELECT `name` FROM tabDocType
WHERE ifnull(docstatus,0)=0
AND ifnull(istable,0)=0
AND ifnull(issingle,0)=0
AND `module` NOT IN ('System','Utilities','Setup Masters','Roles','Recycle Bin','Mapper','Application Internal','Development')
ORDER BY `name` ASC""")
rl = [''] + [a[0] for a in sql("select name from tabRole where ifnull(docstatus,0)=0")]
return {'doctypes': [r[0] for r in ret], 'roles': rl}
# Get Perm Level, Perm type of Doctypes of Module and Role Selected
# -------------------------------------------------------------------
def get_permissions(self,doctype):
ret = []
# Get permtype for the role selected
ptype = sql("select `role`,`permlevel`,`read`,`write`,`create`,`submit`,`cancel`,`amend` from tabDocPerm where `parent` = %s order by `permlevel` ASC",doctype,as_dict = 1)
# to convert 0L in 0 in values of dictionary
for p in ptype:
for key in p:
if key!='role':
p[key] = cint(p[key])
ret.append(p)
# fields list
fl = ['', 'owner'] + [l[0] for l in sql("select fieldname from tabDocField where parent=%s and fieldtype='Link' and ifnull(options,'')!=''", doctype)]
return {'perms':ret, 'fields':fl}
# get default values
# ------------------
def get_defaults(self, arg):
match_key, with_profiles = arg.split('~~~')
pl = ol = []
# defaults
dl = [a for a in sql("select parent, ifnull(parenttype,'') as parenttype, ifnull(defvalue,'') as defvalue from tabDefaultValue where defkey=%s order by parenttype desc, parent asc", match_key, as_dict=1)]
# options
tn = sql("select options from tabDocField where fieldname=%s and fieldtype='Link' and docstatus=0 limit 1", match_key)[0][0]
ol = [''] + [a[0] for a in sql("select name from `tab%s` where ifnull(docstatus,0)=0" % tn)]
# roles
if with_profiles=='Yes':
# profiles
pl = [''] + [a[0] for a in sql("select name from tabProfile where ifnull(enabled,0)=1")]
return {'dl':dl, 'pl':pl, 'ol':ol}
# delete default
# ----------------------
def delete_default(self, arg):
parent, defkey, defvalue = arg.split('~~~')
sql("delete from tabDefaultValue where parent=%s and defkey=%s and defvalue=%s", (parent, defkey, defvalue))
# add default
# ----------------------
def add_default(self, arg):
parent, parenttype, defkey, defvalue = arg.split('~~~')
if sql("select name from tabDefaultValue where parent=%s and defkey=%s and defvalue=%s", (parent, defkey, defvalue)):
msgprint("This rule already exists!")
return
dv = Document('DefaultValue')
dv.parent = parent
dv.parenttype = parenttype
dv.parentfield = 'defaults'
dv.defkey = defkey
dv.defvalue = defvalue
dv.save(1)
return dv.fields
# Add Permissions
# ----------------------
def add_permission(self,args=''):
parent, role, level = eval(args)
if sql("select name from tabDocPerm where parent=%s and role=%s and permlevel=%s", (parent, role, level)):
msgprint("This permission rule already exists!")
return
d = Document('DocPerm')
d.parent = parent
d.parenttype = 'DocType'
d.parentfield = 'permissions'
d.role = role
d.permlevel = cint(level)
d.docstatus = 0
d.save(1)
sql("update tabDocType set modified = %s where name = %s",(now(), parent))
# Update Permissions
# ----------------------
def update_permissions(self,args=''):
args = eval(args)
di = args['perm_dict']
doctype_keys = di.keys() # ['Enquiry','Competitor','Zone','State']
for parent in doctype_keys:
for permlevel in di[parent].keys():
for role in di[parent][permlevel].keys():
if role:
# check if Permissions for that perm level and Role exists
exists = sql("select name from tabDocPerm where parent = %s and role = %s and ifnull(permlevel, 0) = %s",(parent, role, cint(permlevel)))
# Get values of dictionary of Perm Level
pd = di[parent][permlevel][role]
# update
if exists and (1 in pd.values()):
sql("update tabDocPerm set `read` = %s, `write` = %s, `create` = %s, `submit` = %s, `cancel` = %s, `amend` = %s, `match`=%s where parent = %s and role = %s and permlevel = %s",(pd['read'],pd['write'],pd['create'],pd['submit'],pd['cancel'],pd['amend'], pd.get('match'), parent, role, permlevel))
# new
elif not exists and (1 in pd.values()):
ch = Document('DocPerm')
ch.parentfield = 'permissions'
ch.parenttype = 'DocType'
ch.parent = parent
ch.role = role
ch.permlevel = cint(permlevel)
for key in pd.keys():
ch.fields[key] = pd.get(key, None)
ch.save(1)
# delete
elif exists and (1 not in pd.values()):
sql("delete from tabDocPerm where parent = %s and role = %s and ifnull(permlevel,0) = %s",(parent, role, cint(permlevel)))
sql("update tabDocType set modified = %s where name = %s",(now(), parent))
msgprint("Permissions Updated")
# Get Fields based on DocType and Permlevel
# ----------------------------------------------
def get_fields(self, args = ''):
ret = {}
args = eval(args)
table_fields_dict = {}
table_exists = sql("Select options from tabDocField where fieldtype = 'Table' and parent = %s",args['dt'])
if table_exists:
for d in table_exists:
table_fields_dict[d[0]]= sql("select label,fieldtype,fieldname,options from tabDocField where parent = %s and permlevel = %s",(d[0],args['permlevel']),as_dict = 1)
parent_fields_dict = sql("select label, fieldtype, fieldname, options from tabDocField where parent = %s and permlevel = %s and fieldtype not in ('Section Break','Column Break')",(args['dt'],args['permlevel']),as_dict = 1)
ret['parent_fields_dict'] = parent_fields_dict
ret['table_fields_dict'] = table_fields_dict
return ret

View File

@@ -0,0 +1,33 @@
# DocType, Permission Control
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:12',
'docstatus': 0,
'modified': '2010-12-20 15:09:18',
'modified_by': 'sneha@webnotestech.com',
'owner': 'saumil@webnotestech.com'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'read_only': 1,
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 15
},
# DocType, Permission Control
{
'doctype': 'DocType',
'name': 'Permission Control'
}
]

View File

@@ -1,196 +1,105 @@
# DocType, Personalize
[
# These values are common in all dictionaries
{
'_last_update': None,
'creation': '2011-03-22 16:06:53',
'docstatus': 0,
'modified': '2011-03-17 12:20:29',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1303277497',
'allow_attach': 1,
'allow_copy': 1,
'allow_email': 1,
'allow_print': 1,
'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': '2011-05-09 10:50:47',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': 'Other',
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': 1,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': 1,
'istable': None,
'max_attachments': 1,
'menu_index': None,
'modified': '2011-03-17 12:20:29',
'modified_by': 'Administrator',
'module': 'Setup',
'name': 'Personalize',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'name': '__common__',
'read_only': 1,
'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': None,
'smallicon': None,
'use_template': None,
'version': 4
},
# These values are common for all DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 10:50:47',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Help HTML',
'modified': '2011-05-09 10:50:47',
'modified_by': 'Administrator',
'name': '000000158',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': '<div class="help_box">You can edit HTML for your banner or add an attachment and click on "Set from Attachment"</div>',
'owner': 'Administrator',
'name': '__common__',
'parent': 'Personalize',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Personalize',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'write': 1
},
# DocType, Personalize
{
'doctype': 'DocType',
'name': 'Personalize'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 1,
'label': 'Help HTML',
'options': '<div class="help_box">You can edit HTML for your banner or add an attachment and click on "Set from Attachment"</div>'
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 10:50:47',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'header_html',
'fieldtype': 'Code',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Banner HTML',
'modified': '2011-05-09 10:50:47',
'modified_by': 'Administrator',
'name': '000000159',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Personalize',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'Banner HTML'
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 10:50:47',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'set_from_attachment',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Set from attachment',
'modified': '2011-05-09 10:50:47',
'modified_by': 'Administrator',
'name': '000000160',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Personalize',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'Set from attachment'
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 10:50:47',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'file_list',
'fieldtype': 'Text',
'hidden': 1,
'icon': None,
'idx': 4,
'in_filter': None,
'label': 'File List',
'modified': '2011-05-09 10:50:47',
'modified_by': 'Administrator',
'name': '000000161',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Personalize',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'File List'
}
]

View File

@@ -1,380 +1,185 @@
# DocType, Price List
[
# These values are common in all dictionaries
{
'allow_attach': 1,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': 1,
'autoname': 'field:price_list_name',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:09:13',
'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': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-04-18 10:01:48',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1303100817',
'allow_attach': 1,
'allow_trash': 1,
'autoname': 'field:price_list_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'Setup',
'name': 'Price List',
'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,
'name': '__common__',
'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': 6
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1,
'submit': 0
},
# DocType, Price List
{
'doctype': 'DocType',
'name': 'Price List'
},
# DocPerm
{
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00392',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Sales Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': None,
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00393',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 3,
'match': None,
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00394',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Sales User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 4,
'match': None,
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00395',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 1,
'create': 1,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 5,
'match': '',
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00396',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales Master Manager',
'submit': 0,
'write': 1
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:13',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Trash Reason',
'modified': '2011-04-18 13:55:33',
'modified_by': 'Administrator',
'name': 'FL02242',
'no_copy': None,
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'permlevel': 1
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:13',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'price_list_name',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Price List Name',
'modified': '2011-04-18 13:55:33',
'modified_by': 'Administrator',
'name': 'FL02243',
'no_copy': None,
'oldfieldname': 'price_list_name',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
'reqd': 1
},
# DocField
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-04-18 13:55:34',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Price Help',
'modified': '2011-04-18 13:55:34',
'modified_by': 'Administrator',
'name': '000000143',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'permlevel': 0
},
# DocField
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-04-18 13:55:33',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': 'Click on this button to clear prices for this list in all items',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': None,
'label': 'Clear Prices',
'modified': '2011-04-18 13:55:33',
'modified_by': 'Administrator',
'name': '000000140',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
'trigger': 'Client'
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-04-18 13:55:34',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'file_list',
'fieldtype': 'Text',
'hidden': 1,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'File List',
'modified': '2011-04-18 13:55:34',
'modified_by': 'Administrator',
'name': '000000141',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'permlevel': 0
},
# DocField
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-04-18 13:55:34',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': 'Update prices from the attachment',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': None,
'label': 'Update Prices',
'modified': '2011-04-18 13:55:34',
'modified_by': 'Administrator',
'name': '000000142',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'update_prices',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Server',
'width': None
'trigger': 'Server'
}
]

View File

View 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);
}

View File

@@ -0,0 +1,22 @@
# 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, self.doclist = doc,doclist

View File

@@ -0,0 +1,103 @@
# DocType, Print Heading
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1294312215',
'allow_trash': 1,
'autoname': 'field:print_heading',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'Setup',
'name': '__common__',
'search_fields': 'print_heading',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 27
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Print Heading',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Print Heading',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'All',
'write': 1
},
# DocType, Print Heading
{
'doctype': 'DocType',
'name': 'Print Heading'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'print_heading',
'fieldtype': 'Data',
'idx': 2,
'in_filter': 1,
'label': 'Print Heading',
'oldfieldname': 'print_heading',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'idx': 3,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Small Text',
'permlevel': 0,
'width': '300px'
}
]

View File

View File

@@ -0,0 +1,6 @@
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def t1(self):
msgprint('role')

View File

@@ -0,0 +1,25 @@
# 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 t1(self):
msgprint('role')

114
setup/doctype/role/role.txt Normal file
View File

@@ -0,0 +1,114 @@
# DocType, Role
[
# These values are common in all dictionaries
{
'creation': '2009-05-12 11:19:11',
'docstatus': 0,
'modified': '2010-12-28 17:02:39',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1307624201',
'allow_copy': 0,
'allow_email': 0,
'allow_print': 0,
'autoname': 'field:role_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'hide_heading': 0,
'hide_toolbar': 0,
'idx': 0,
'issingle': 0,
'istable': 0,
'module': 'Setup',
'name': '__common__',
'read_only': 0,
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Role',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'cancel': 0,
'create': 1,
'doctype': 'DocPerm',
'execute': 0,
'idx': 1,
'name': '__common__',
'parent': 'Role',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Administrator',
'submit': 0,
'write': 1
},
# DocType, Role
{
'doctype': 'DocType',
'name': 'Role'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'module',
'fieldtype': 'Select',
'idx': 1,
'label': 'Module',
'oldfieldname': 'module',
'oldfieldtype': 'Select',
'options': 'link:Module Def',
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'role_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Role Name',
'oldfieldname': 'role_name',
'oldfieldtype': 'Data',
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'defaults',
'fieldtype': 'Table',
'hidden': 0,
'idx': 3,
'label': 'Defaults',
'oldfieldname': 'defaults',
'oldfieldtype': 'Table',
'options': 'DefaultValue',
'reqd': 0,
'search_index': 0
}
]

View File

@@ -1 +1,30 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-17 15:07:09', 'search_fields': None, 'module': 'Setup', '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': 157, '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': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Sales Browser 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}]
# DocType, Sales Browser Control
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:21',
'docstatus': 0,
'modified': '2010-12-24 11:56:36',
'modified_by': 'abhishek@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 159
},
# DocType, Sales Browser Control
{
'doctype': 'DocType',
'name': 'Sales Browser Control'
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,33 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-03 13:32:18', 'search_fields': None, 'module': 'Setup', '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': 87, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 0, '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': None, 'name': 'Setup 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}]
# DocType, Setup Control
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:24',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'issingle': 1,
'istable': 0,
'module': 'Setup',
'name': '__common__',
'read_only': 1,
'section_style': 'Simple',
'server_code_error': ' ',
'version': 73
},
# DocType, Setup Control
{
'doctype': 'DocType',
'name': 'Setup Control'
}
]

View File

@@ -0,0 +1,64 @@
# 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
#=======================================================================================================
def get_master_lists(self):
ret = convert_to_lists(sql("select name from `tabWarehouse Type`"))
ret = ret and ret or []
return ret
#=======================================================================================================
def create_record(self,dict_val):
obj_dict = eval(dict_val)
for d in obj_dict:
if not obj_dict[d] == '' and not d =='Doctype':
ret =sql("select name from `tab%s` where name = '%s'" %(obj_dict['Doctype'],obj_dict[d]))
if ret:
return "Record already exist."
raise Exception
rec = Document(obj_dict['Doctype'])
for i in obj_dict:
if not obj_dict[i] == '' and not i == 'Doctype':
rec.fields[i] = obj_dict[i]
rec.save(1)
return "Record created."
#=======================================================================================================
def get_page_lst(self,nm):
r1 = cstr(webnotes.user.get_roles()).replace('[','').replace(']','')
ret = sql("select parent from `tabPage Role` where role in (%s) and parent = '%s'"%(r1,nm))
return ret and True or False
#=======================================================================================================
#------------------------get contry--------------------------------
def get_country(self):
cty = sql("select value from `tabSingles` where field = 'country' and doctype = 'Control Panel'")
return cty and cty[0][0] or ''

View File

@@ -0,0 +1,31 @@
# DocType, Setup Wizard Control
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:24',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'sneha@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 108
},
# DocType, Setup Wizard Control
{
'doctype': 'DocType',
'name': 'Setup Wizard Control'
}
]

View File

View File

@@ -0,0 +1,139 @@
# DocType, SMS Settings
[
# These values are common in all dictionaries
{
'creation': '2011-05-24 18:21:16',
'docstatus': 0,
'modified': '2011-05-25 11:59:34',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1306304974',
'allow_copy': 1,
'allow_email': 1,
'allow_print': 1,
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 0,
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'read_only': 0,
'section_style': 'Simple',
'show_in_menu': 0,
'version': 16
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'SMS Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'SMS Settings',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1,
'role': 'System Manager'
},
# DocType, SMS Settings
{
'doctype': 'DocType',
'name': 'SMS Settings'
},
# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 1,
'width': '50%'
},
# DocField
{
'colour': 'White:FFF',
'description': 'Eg. smsgateway.com/api/send_sms.cgi',
'doctype': 'DocField',
'fieldname': 'sms_gateway_url',
'fieldtype': 'Data',
'idx': 2,
'label': 'SMS Gateway URL',
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'description': 'Enter url parameter for message',
'doctype': 'DocField',
'fieldname': 'message_parameter',
'fieldtype': 'Data',
'idx': 3,
'label': 'Message Parameter',
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'description': 'Enter url parameter for receiver nos',
'doctype': 'DocField',
'fieldname': 'receiver_parameter',
'fieldtype': 'Data',
'idx': 4,
'label': 'Receiver Parameter',
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 5,
'label': 'Static Parameters',
'width': '50%'
},
# DocField
{
'colour': 'White:FFF',
'description': 'Enter static url parameters here (Eg. sender=ERPNext, username=ERPNext, password=1234 etc.)',
'doctype': 'DocField',
'fieldname': 'static_parameter_details',
'fieldtype': 'Table',
'idx': 6,
'label': 'Static Parameter Details',
'options': 'Static Parameter Detail'
}
]

View File

@@ -1 +1,105 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-31 16:47:00', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, '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': 15, '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:state_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'State', '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': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00533', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2009-12-15 16:10:15', 'modified': '2010-09-20 11:03:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00582', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2010-01-12 16:42:57', 'modified': '2010-09-20 11:03:36', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00759', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2010-04-08 13:47:15', 'modified': '2010-09-20 11:03:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-31 16:47:00', 'doctype': 'DocField', 'oldfieldname': 'state_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'State Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'State', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01598', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 11:03:36', 'parenttype': 'DocType', 'fieldname': 'state_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-31 16:47:00', 'doctype': 'DocField', 'oldfieldname': 'country', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Country', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'State', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01599', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 11:03:36', 'parenttype': 'DocType', 'fieldname': 'country', 'fieldtype': 'Select', 'options': 'link:Country', 'report_hide': None, 'parentfield': 'fields'}]
# DocType, State
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:25',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'autoname': 'field:state_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'in_create': 0,
'module': 'Setup',
'name': '__common__',
'read_only': 0,
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 14
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'State',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'reqd': 1
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'State',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, State
{
'doctype': 'DocType',
'name': 'State'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'doctype': 'DocPerm',
'idx': 2,
'role': 'Sales Master Manager',
'submit': 0
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'Purchase Master Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'state_name',
'fieldtype': 'Data',
'idx': 1,
'label': 'State Name',
'oldfieldname': 'state_name',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'country',
'fieldtype': 'Select',
'idx': 2,
'label': 'Country',
'oldfieldname': 'country',
'oldfieldtype': 'Select',
'options': 'link:Country'
}
]

View File

@@ -0,0 +1,59 @@
# DocType, Static Parameter Detail
[
# These values are common in all dictionaries
{
'creation': '2011-05-24 18:22:22',
'docstatus': 0,
'modified': '2011-05-24 18:42:30',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
'version': 4
},
# These values are common for all DocField
{
'doctype': 'DocField',
'fieldtype': 'Data',
'name': '__common__',
'parent': 'Static Parameter Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'reqd': 1,
'width': '150px'
},
# DocType, Static Parameter Detail
{
'doctype': 'DocType',
'name': 'Static Parameter Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'parameter',
'idx': 1,
'label': 'Parameter'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'value',
'idx': 2,
'label': 'Value'
}
]

View File

@@ -1 +1,134 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:22', 'search_fields': None, 'module': 'Setup', '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': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:supplier_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Supplier Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', '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': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00917', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:54:46', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00918', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:54:46', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00919', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:00:26', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00920', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:00:26', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00224', 'parent': 'Supplier Type', 'read': 1, 'create': 1, 'creation': '2009-03-12 16:40:23', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Supplier Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04863', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:24', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:22', 'doctype': 'DocField', 'oldfieldname': 'supplier_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Supplier Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01322', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:24', 'parenttype': 'DocType', 'fieldname': 'supplier_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Supplier Type
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:26',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:supplier_type',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 3
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Supplier Type',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Supplier Type',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1,
'submit': 0
},
# DocType, Supplier Type
{
'doctype': 'DocType',
'name': 'Supplier Type'
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 1,
'role': 'Purchase Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 0,
'role': 'Purchase Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 1,
'role': 'Purchase User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 0,
'role': 'Purchase User',
'write': 0
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 0,
'role': 'Purchase Master Manager',
'write': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'supplier_type',
'fieldtype': 'Data',
'idx': 2,
'label': 'Supplier Type',
'oldfieldname': 'supplier_type',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
}
]

View File

@@ -11,8 +11,8 @@ class DocType:
"""
if cint(self.doc.integrate_incoming):
from webnotes.utils.scheduler import set_event
set_event('maintenance.doctype.support_ticket.get_support_mails', 60*5, 1)
set_event('support.doctype.support_ticket.get_support_mails', 60*5, 1)
else:
from webnotes.utils.scheduler import cancel_event
cancel_event('maintenance.doctype.support_ticket.get_support_mails')
cancel_event('support.doctype.support_ticket.get_support_mails')

View File

@@ -1,369 +1,144 @@
# DocType, Support Email Settings
[
# These values are common in all dictionaries
{
'creation': '2011-05-23 14:50:45',
'docstatus': 0,
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1306554355',
'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': '2011-05-17 14:04:30',
'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': 1,
'is_transaction_doc': None,
'issingle': 1,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'module': 'Setup',
'name': 'Support Email Settings',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'name': '__common__',
'read_only': 1,
'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': 1,
'smallicon': None,
'subject': None,
'tag_fields': None,
'use_template': None,
'version': 8
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'amend': None,
'cancel': None,
'create': 1,
'creation': '2011-05-17 14:04:30',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000798',
'owner': 'Administrator',
'name': '__common__',
'parent': 'Support Email Settings',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'submit': None,
'write': 1
},
# DocType, Support Email Settings
{
'doctype': 'DocType',
'name': 'Support Email Settings'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-19 12:41:15',
'default': None,
'depends_on': None,
'description': 'The full email id of your incoming support emails',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'email',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Email',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000811',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'Email',
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'options': 'Email'
},
# DocField
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-20 11:34:49',
'default': None,
'depends_on': None,
'description': 'By checking this, your incoming mails will automatically be integrated with the Support Ticket',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'integrate_incoming',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Integrate Incoming',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000824',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'Integrate Incoming'
},
# DocField
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-28 09:15:55',
'default': None,
'depends_on': None,
'description': 'Signature appended to the outgoing email (Text / HTML)',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'signature',
'fieldtype': 'Text',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Signature',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': 'FL05195',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'Signature'
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-20 11:34:49',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': None,
'label': None,
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000823',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'idx': 4
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-17 14:04:30',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'use_ssl',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'Use SSL',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000799',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'Use SSL'
},
# DocField
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-17 14:04:30',
'default': None,
'depends_on': None,
'description': 'eg. pop.gmail.com',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'host',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': None,
'label': 'Host',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000800',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'Host'
},
# DocField
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-17 14:04:30',
'default': None,
'depends_on': None,
'description': 'Support Email Id',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'username',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': None,
'label': 'Username',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000801',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'Username'
},
# DocField
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-17 14:04:30',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'password',
'fieldtype': 'Password',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': None,
'label': 'Password',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000802',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
'label': 'Password'
}
]

View File

@@ -1 +1,96 @@
[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-16 18:17:59', 'search_fields': None, 'module': 'Setup', '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': 15, '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': 'Target 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': 'Link', 'creation': '2009-05-22 13:08:10', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02123', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-16 18:17:59', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01419', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-06-22 12:03:16', 'doctype': 'DocField', 'oldfieldname': 'target_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Target Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05403', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'target_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-16 18:17:59', 'doctype': 'DocField', 'oldfieldname': 'target_amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Target Amount', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01420', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'target_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Target Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:26',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'abhishek@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 15
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Target Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Target Detail
{
'doctype': 'DocType',
'name': 'Target Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'item_group',
'fieldtype': 'Link',
'idx': 1,
'in_filter': 1,
'label': 'Item Group',
'oldfieldname': 'item_group',
'oldfieldtype': 'Link',
'options': 'Item Group',
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 2,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'target_qty',
'fieldtype': 'Currency',
'idx': 3,
'label': 'Target Qty',
'oldfieldname': 'target_qty',
'oldfieldtype': 'Currency'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'target_amount',
'fieldtype': 'Currency',
'idx': 4,
'in_filter': 1,
'label': 'Target Amount',
'oldfieldname': 'target_amount',
'oldfieldtype': 'Currency',
'reqd': 0,
'search_index': 1
}
]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,104 @@
# DocType, Update Series
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:29',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_copy': 1,
'allow_email': 1,
'allow_print': 1,
'colour': 'White:FFF',
'doctype': 'DocType',
'hide_toolbar': 0,
'in_create': 1,
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'read_only': 1,
'section_style': 'Simple',
'server_code': 'class DocType:\n def __init__(self, doc, doclist=[]):\n self.doc = doc\n self.doclist = doclist\n\n def update_series(self):\n series = sql("select name,current from `tabSeries` where name = %s", self.doc.prefix,as_dict = 1)\n if series:\n msgprint("This is going to update Series with Prefix : " + series[0][\'name\'] + " from Current : " + cstr(series[0][\'current\']) + " to Current : "+ cstr(self.doc.current))\n sql("update `tabSeries` set current = \'%s\' where name = \'%s\'" % (self.doc.current,series[0][\'name\']))\n msgprint("Series Updated Successfully")\n else:\n msgprint("Please Check Prefix as there is no such Prefix : "+ self.doc.prefix +" Or Try Insert Button")\n\n def insert_series(self):\n #sql("start transaction")\n series = sql("select name,current from `tabSeries` where name = %s", self.doc.prefix, as_dict = 1)\n if series:\n msgprint("Series with Prefix : " + series[0][\'name\'] + "already in the system . Try Update Button")\n else:\n msgprint("This is going to Insert Series with Prefix : " + cstr(self.doc.prefix) + " Current: " + cstr(self.doc.current))\n sql("insert into `tabSeries` (name,current) values (\'%s\',\'%s\')" % (self.doc.prefix, self.doc.current))\n msgprint("Series Inserted Successfully")',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 5
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Update Series',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 0,
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Update Series',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'write': 1
},
# DocType, Update Series
{
'doctype': 'DocType',
'name': 'Update Series'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'prefix',
'fieldtype': 'Data',
'idx': 1,
'label': 'Prefix'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'current',
'fieldtype': 'Int',
'idx': 2,
'label': 'Current'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 3,
'label': 'Update',
'options': 'update_series'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 4,
'label': 'Insert',
'options': 'insert_series'
}
]

View File

@@ -1 +1,136 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:44', 'search_fields': '', 'module': 'Setup', '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': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 0, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:warehouse_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Warehouse Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-22 10:52:43', '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': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00878', 'parent': 'Warehouse Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00879', 'parent': 'Warehouse Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00903', 'parent': 'Warehouse Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00904', 'parent': 'Warehouse Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00212', 'parent': 'Warehouse Type', 'read': 1, 'create': 1, 'creation': '2009-03-12 15:13:34', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Warehouse Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04868', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-22 10:52:43', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'warehouse_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Warehouse Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse Type', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00676', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-22 10:52:43', 'parenttype': 'DocType', 'fieldname': 'warehouse_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
# DocType, Warehouse Type
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:30',
'docstatus': 0,
'modified': '2010-09-22 10:52:43',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:warehouse_type',
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 0,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 6
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Warehouse Type',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Warehouse Type',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1,
'submit': 0
},
# DocType, Warehouse Type
{
'doctype': 'DocType',
'name': 'Warehouse Type'
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 1,
'role': 'Material Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 0,
'role': 'Material Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 1,
'role': 'Material User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 0,
'role': 'Material User',
'write': 0
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 0,
'role': 'Material Master Manager',
'write': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'warehouse_type',
'fieldtype': 'Data',
'idx': 2,
'in_filter': 1,
'label': 'Warehouse Type',
'oldfieldname': 'warehouse_type',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1,
'search_index': 1
}
]

View File

@@ -0,0 +1,63 @@
# DocType, Workflow Action Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:30',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'swarnalata@webnotestech.com'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
'version': 5
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Workflow Action Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'width': '200px'
},
# DocType, Workflow Action Detail
{
'doctype': 'DocType',
'name': 'Workflow Action Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'action_field',
'fieldtype': 'Select',
'idx': 1,
'label': 'Field',
'oldfieldname': 'action_field',
'oldfieldtype': 'Select'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'action_value',
'fieldtype': 'Data',
'idx': 2,
'label': 'Value',
'oldfieldname': 'action_value',
'oldfieldtype': 'Data'
}
]

View File

@@ -0,0 +1,47 @@
# 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, self.doclist = doc, doclist
def apply_rule(self,form_obj):
#msgprint("hello")
rule_list = sql("select rule_name from `tabWorkflow Rule` where select_form = '%s' and rule_status='Active' order by rule_priority asc" % (form_obj.doc.doctype))
for rl in rule_list:
#msgprint(rl[0])
autho_obj=get_obj("Workflow Rule",rl[0],with_children=1)
cond_hold = autho_obj.evalute_rule(form_obj)
#msgprint("cond_hold:" + cond_hold)
if cond_hold =='Yes':
self.apply_action(rl[0],form_obj)
return
#if rule holds true then the following action will be taken
def apply_action(self,rule_no,form_obj):
rule_obj=get_obj('Workflow Rule',rule_no,with_children=1)
#msgprint("action")
for d in getlist(rule_obj.doclist,'workflow_action_details'):
field_name=sql("select fieldname from tabDocField where parent='%s' and label='%s'" %(form_obj.doc.doctype,d.action_field))[0][0]
if field_name:
#msgprint(field_name)
form_obj.doc.fields[field_name] = d.action_value
return

View File

@@ -0,0 +1,31 @@
# DocType, Workflow Engine
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:31',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'swarnalata@webnotestech.com'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 4
},
# DocType, Workflow Engine
{
'doctype': 'DocType',
'name': 'Workflow Engine'
}
]

View File

View File

@@ -0,0 +1,44 @@
$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);
}
// Show Label name of fields for selected Doctype
// ---------------------------
cur_frm.cscript.select_form = function(doc, cdt, cdn){
var mydoc = doc
var call_back_action = function(mydoc){
$c('runserverobj', args={'method':'field_label_list', 'docs':compress_doclist (make_doclist (mydoc.doctype,mydoc.name))},
function(r, rt) {
var doc = locals[mydoc.doctype][mydoc.name];
cur_frm.fields_dict.workflow_action_details.grid.get_field("action_field").df.options = r.message;
}
);
}
var call_back_rule = function(mydoc){
$c('runserverobj', args={'method':'compare_field', 'docs':compress_doclist (make_doclist (mydoc.doctype,mydoc.name))},
function(r, rt) {
var doc = locals[mydoc.doctype][mydoc.name];
cur_frm.fields_dict.workflow_rule_details.grid.get_field("comparing_field").df.options = r.message;
call_back_action(mydoc)
}
);
}
$c('runserverobj', args={'method':'maindoc_field', 'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
function(r, rt) {
var doc = locals[mydoc.doctype][mydoc.name];
cur_frm.fields_dict.workflow_rule_details.grid.get_field("rule_field").df.options = r.message;
call_back_rule(mydoc)
}
);
}

View File

@@ -0,0 +1,284 @@
# 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, self.doclist = doc, doclist
self.field_list=[]
field_info = sql("select label,fieldtype,options,fieldname from `tabDocField` where parent='%s' and fieldtype not in('Section Break','Column Break','Text','Small Text','Text Editor', 'Time', 'Check', 'Button','Code','HTML','Image','Blob','Password')"%self.doc.select_form)
for f in field_info:
sl=[]
for x in f:
sl.append(x)
self.field_list.append(sl)
#list of labels
def field_label_list(self):
label= ''
for fi in self.field_list:
if fi[1] !='Table':
label += "\n" + fi[0]
return label
def compare_field(self):
ret1=''
for fi in self.field_list:
if fi[1] =='Table':
flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Select', 'Int','Currency','Float','Link')"%fi[2])
for x in flist:
ret1 += "\n" + fi[2] + ':' + x[0]
else:
ret1 += "\n" + cstr(self.doc.select_form) + ':' + fi[0]
return cstr(ret1)
#list of all fields for which conditions can be set
def maindoc_field(self):
ret = ''
for fi in self.field_list:
if fi[1] !='Select' or fi[1] !='Link' or fi[1] !='Table':
ret += "\n" + cstr(self.doc.select_form) + ':' + fi[0]
elif fi[1] =='Select':
op = fi[2].split(':')
if op[0] != 'link':
ret += "\n" + cstr(self.doc.select_form) + ':' +fi[0]
#child table field list
for fi in self.field_list:
if fi[1] == 'Table':
flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Select', 'Int','Currency','Float','Link')"%fi[2])
for x in flist:
ret += "\n" + fi[2] + ':' + x[0]
# linked doctype field list
for fi in self.field_list:
if fi[1] == 'Link':
flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Int', 'Select','Currency','Float','Link')"%fi[2])
for f in flist:
ret += "\n" + fi[0] + ':' +f[0]
elif fi[1] == 'Select':
op = fi[2].split(':')
if op[0] == 'link':
flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Select', 'Int','Currency','Float','Link')"%op[1])
for f in flist:
ret += "\n" + fi[0] + ':' +f[0]
return cstr(ret)
#table name of the selected doctype
def child_doc(self):
lst=[]
for fi in self.field_list:
if fi[1] == 'Table':
lst.append(fi[2])
return lst
# function for finding fieldname,datatype of mentioned label
def field_info(self,label,parent):
field_name=sql("select fieldname from tabDocField where parent='%s' and label='%s'" %(parent,label))[0][0]
if field_name:
datatype=sql("select fieldtype from `tabDocField` where fieldname='%s' and parent='%s'" %(field_name,parent))[0][0]
ret={'fieldnm':field_name,'datatype':datatype}
return ret
def compare_string(self,first,second):
if first.lower()==second.lower():
return 'true'
else:
return 'false'
#evalute operator
def eval_operator(self,op):
op_sign =''
if op=='Equals':
op_sign='=='
elif op=='Not Equals':
op_sign='!='
elif op=='Greater than':
op_sign='>'
elif op=='Greater than or Equals':
op_sign='>='
elif op=='Less than':
op_sign='<'
elif op=='Less than or Equals':
op_sign='<='
return op_sign
#evaluation condition
def eval_condition(self,field_dict,form_val,value,operator):
if field_dict['datatype']=='Data' or field_dict['datatype']=='Select' or field_dict['datatype'] =='Link':
#msgprint("not eval")
if self.compare_string(cstr(form_val),cstr(value))=='false':
cond_hold='No'
else:
cond_hold='Yes'
else:
#msgprint("eval")
op_sign = self.eval_operator(operator)
chk_cond=str(form_val) + str(op_sign) + str(value)
#msgprint(chk_cond)
if eval(chk_cond):
cond_hold='Yes'
else:
cond_hold='No'
#msgprint(cond_hold)
return cond_hold
# fetching the value from the form
def find_value(self,fld_nm,tab_nm,rec_nm,child=0):
if child == 0:
form_val=sql("select %s from `tab%s` where name='%s'"%(fld_nm,tab_nm,rec_nm))
elif child == 1:
form_val=sql("select %s from `tab%s` where parent='%s'"%(fld_nm,tab_nm,rec_nm))
return form_val and form_val[0][0]
# if the comparing value is not entered manually but fetching from some other field
def compare_field_not_manual(self,comparing_field):
chk_with_value =''
temp_val = comparing_field.split(':')
if temp_val[0] == self.doc.select_form:
field_cf = self.field_info(temp_val[1],self.doc.select_form)
val_cf=self.find_value(field_cf['fieldnm'],self.doc.select_form,form_obj.doc.name)
chk_with_value = val_cf
elif temp_val[0] in child_list:
field_cf = self.field_info(second_label,first_label)
val_cf=self.find_value(field_cf['fieldnm'],first_label,form_obj.doc.name,1)
chk_with_value = val_cf
return chk_with_value
# checking with main doctype
def chk_from_main_dt(self,label1,value,operator,form_obj):
cond_hold = ''
field_dict = self.field_info(label1,self.doc.select_form) #getting fieldname info
form_val=self.find_value(field_dict['fieldnm'],self.doc.select_form,form_obj.doc.name) # find value
#msgprint(cstr(form_val))
if form_val :
cond_hold = self.eval_condition(field_dict,form_val,value,operator)
elif not form_val and field_dict['datatype'] =='Currency' or field_dict['datatype'] =='Float' or field_dict['datatype'] =='Int':
#msgprint("1")
form_val = 0.0
cond_hold = self.eval_condition(field_dict,form_val,value,operator)
return cond_hold
#checking with child doctype
def chk_from_child_dt(self,first_label,second_label,value,operator,form_obj):
cond_hold = ''
field_dict = self.field_info(second_label,first_label)
form_val=self.find_value(field_dict['fieldnm'],first_label,form_obj.doc.name,1) #fetching the value in current form from a table
if form_val or form_val==0:
cond_hold = self.eval_condition(field_dict,form_val,value,operator)
return cond_hold
# if checking is with any linked doctype means first_label field from the doctype for which rule is given and second_label field from the doctype with which first_label is linked
def chk_from_link_dt(self,first_label,second_label,form_obj,value,operator):
cond_hold=''
field_dict_first = self.field_info(first_label,self.doc.select_form)
for x in self.field_list:
if x[3] == field_dict_first['fieldnm']:
linked_to = x[2]
lt = linked_to.split(':')
if lt[0] == 'link':
field_dict_second = self.field_info(second_label,lt[1])
link_val=sql("select %s from `tab%s` where name='%s'"%(field_dict_first['fieldnm'],self.doc.select_form,form_obj.doc.name))
if link_val and link_val[0][0]:
form_val = self.find_value(field_dict_second['fieldnm'],lt[1],link_val[0][0])
if form_val :
cond_hold = self.eval_condition(field_dict_second,form_val,value,operator)
else:
field_dict_second = self.field_info(second_label,lt[0])
link_val=sql("select %s from `tab%s` where name='%s'"%(field_dict_first['fieldnm'],self.doc.select_form,form_obj.doc.name))
if link_val and link_val[0][0]:
form_val = self.find_value(field_dict_second['fieldnm'],lt[0],link_val[0][0])
if form_val :
cond_hold = self.eval_condition(field_dict_second,form_val,value,operator)
return cond_hold
def evalute_rule(self,form_obj):
#msgprint(form_obj.doc.name)
child_list = self.child_doc()
all_cond_hold=''
for d in getlist(self.doclist,'workflow_rule_details'):
label = d.rule_field.split(':') #break up checking condition
#findout the value with which condition will be checked
if d.value:
chk_with_value = d.value
elif d.comparing_field:
chk_with_value = self.compare_field_not_manual(d.comparing_field)
#msgprint(label)
# label[0] is doctype name for which rule is given, label[1] field name of that doctype
if label[0] == self.doc.select_form:
cond_hold = self.chk_from_main_dt(label[1],chk_with_value,d.operator,form_obj)
if cond_hold =='No':
if d.exception == 'Yes':
msgprint(d.message)
raise Exception
elif d.exception=='No' or d.exception=='':
msgprint(d.message)
all_cond_hold = 'No'
break
elif cond_hold =='Yes':
all_cond_hold ='Yes'
#label[0] is child doctype name , label[1] is child doctype field name
elif label[0] in child_list:
cond_hold = self.chk_from_child_dt(label[0],label[1],chk_with_value,d.operator,form_obj)
if cond_hold =='No':
if d.exception == 'Yes':
msgprint(d.message)
raise Exception
elif d.exception=='No' or d.exception=='':
msgprint(d.message)
all_cond_hold = 'No'
break
elif cond_hold =='Yes':
all_cond_hold ='Yes'
# if checking is with any linked doctype means label[0] field from the doctype for which rule is given and label[1] field from the doctype with which label[0] is linked
else:
cond_hold=self.chk_from_link_dt(label[0],label[1],form_obj,chk_with_value,d.operator)
if cond_hold =='No':
if d.exception == 'Yes':
msgprint(d.message)
raise Exception
elif d.exception=='No' or d.exception=='':
msgprint(d.message)
all_cond_hold = 'No'
break
elif cond_hold =='Yes':
all_cond_hold ='Yes'
return all_cond_hold

View File

@@ -0,0 +1,258 @@
# DocType, Workflow Rule
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:31',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'swarnalata@webnotestech.com'
},
# These values are common for all DocType
{
'_last_update': '1308741898',
'autoname': 'field:rule_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'Setup',
'name': '__common__',
'search_fields': 'select_form,rule_status',
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 30
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Workflow Rule',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Workflow Rule',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'write': 1
},
# DocType, Workflow Rule
{
'doctype': 'DocType',
'name': 'Workflow Rule'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Rule Definition',
'oldfieldtype': 'Section Break'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 2,
'label': 'Intro HTML',
'oldfieldtype': 'HTML',
'options': '<b>Select form for which you want to define rules,set priority & status.</b>'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'rule_name',
'fieldtype': 'Data',
'idx': 3,
'label': 'Rule Name',
'oldfieldname': 'rule_name',
'oldfieldtype': 'Data',
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'rule_status',
'fieldtype': 'Select',
'idx': 4,
'in_filter': 1,
'label': 'Rule Status',
'oldfieldname': 'rule_status',
'oldfieldtype': 'Select',
'options': '\nActive\nInactive',
'reqd': 1,
'search_index': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'select_form',
'fieldtype': 'Link',
'idx': 5,
'in_filter': 1,
'label': 'Select Form',
'oldfieldname': 'select_form',
'oldfieldtype': 'Link',
'options': 'DocType',
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'rule_priority',
'fieldtype': 'Int',
'idx': 6,
'label': 'Rule Priority',
'oldfieldname': 'rule_priority',
'oldfieldtype': 'Int',
'reqd': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 7,
'label': 'Define Rule',
'oldfieldtype': 'Section Break',
'options': 'Simple'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'workflow_rule_details',
'fieldtype': 'Table',
'idx': 8,
'label': 'Workflow Rule Details',
'oldfieldname': 'workflow_rule_details',
'oldfieldtype': 'Table',
'options': 'Workflow Rule Detail',
'width': '100px'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'extra_condition',
'fieldtype': 'Code',
'hidden': 1,
'idx': 9,
'label': 'Extra Condition',
'oldfieldname': 'extra_condition',
'oldfieldtype': 'Code',
'print_hide': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 10,
'label': 'Action Detail',
'oldfieldtype': 'Section Break'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 11,
'label': 'Action html',
'oldfieldtype': 'HTML',
'options': '<b>Specify actions to be taken when conditions hold satisfied</b>'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'workflow_action_details',
'fieldtype': 'Table',
'idx': 12,
'label': 'Workflow Action Details',
'oldfieldname': 'workflow_action_details',
'oldfieldtype': 'Table',
'options': 'Workflow Action Detail'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'HTML',
'hidden': 1,
'idx': 13,
'label': 'Reject HTML',
'no_copy': 1,
'oldfieldtype': 'HTML',
'options': "<b>If any condition holds false the following message will be displayed . If you wish to stop rule engine when condition holds false then set 'Raise Exception' as 'Yes' otherwise keep this field blank or 'No'.</b>",
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'message',
'fieldtype': 'Text',
'hidden': 1,
'idx': 14,
'label': 'Enter message',
'no_copy': 1,
'oldfieldname': 'message',
'oldfieldtype': 'Text',
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'raise_exception',
'fieldtype': 'Select',
'hidden': 1,
'idx': 15,
'label': 'Raise Exception',
'no_copy': 1,
'oldfieldname': 'raise_exception',
'oldfieldtype': 'Select',
'options': '\nYes\nNo',
'print_hide': 1,
'report_hide': 1
}
]

View File

@@ -0,0 +1,112 @@
# DocType, Workflow Rule Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:31',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'swarnalata@webnotestech.com'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'Setup',
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
'version': 9
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Workflow Rule Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Workflow Rule Detail
{
'doctype': 'DocType',
'name': 'Workflow Rule Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'rule_field',
'fieldtype': 'Select',
'idx': 1,
'label': 'Field',
'oldfieldname': 'rule_field',
'oldfieldtype': 'Select',
'options': '[]',
'width': '200px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'operator',
'fieldtype': 'Select',
'idx': 2,
'label': 'Operator',
'oldfieldname': 'operator',
'oldfieldtype': 'Select',
'options': '\nequal\nnot equal\ngreater than\ngreater than equal\nless than\nless than equal'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'value',
'fieldtype': 'Data',
'idx': 3,
'label': 'Value',
'oldfieldname': 'value',
'oldfieldtype': 'Data',
'width': '100px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'comparing_field',
'fieldtype': 'Select',
'idx': 4,
'label': 'Field from other forms',
'oldfieldname': 'comparing_field',
'oldfieldtype': 'Select'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'message',
'fieldtype': 'Data',
'idx': 5,
'label': 'Message when Cond. False',
'oldfieldname': 'message',
'oldfieldtype': 'Data',
'width': '200px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'exception',
'fieldtype': 'Select',
'idx': 6,
'label': 'Raise Exception',
'oldfieldname': 'exception',
'oldfieldtype': 'Select',
'options': '\nYes\nNo'
}
]

View File

@@ -1,106 +1,72 @@
# Page, Import Data
[
# These values are common in all dictionaries
{
'author': None,
'category': 'Standard',
'content': None,
'creation': '2010-12-14 10:33:09',
'creation': '2010-12-14 10:23:18',
'docstatus': 0,
'doctype': 'Page',
'file_list': None,
'icon': None,
'idx': None,
'keywords': None,
'menu_index': None,
'modified': '2011-05-02 16:28:00',
'modified': '2010-12-24 11:43:02',
'modified_by': 'Administrator',
'module': 'Setup',
'name': 'Import Data',
'owner': 'Administrator',
'page_name': 'Import Data',
'page_title': None,
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'publish': None,
'script': None,
'show_in_menu': 0,
'site_description': None,
'standard': 'Yes',
'static_content': None,
'style': None,
'stylesheet': None,
'template': None,
'write_content': None
'owner': 'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': 'Setup',
'name': '__common__',
'page_name': 'Import Data',
'show_in_menu': 0,
'standard': 'Yes'
},
# These values are common for all Page Role
{
'doctype': 'Page Role',
'name': '__common__',
'parent': 'Import Data',
'parentfield': 'roles',
'parenttype': 'Page'
},
# Page, Import Data
{
'doctype': 'Page',
'name': 'Import Data'
},
# Page Role
{
'creation': '2010-12-14 10:33:09',
'docstatus': 0,
'doctype': 'Page Role',
'idx': 1,
'modified': '2011-05-02 16:28:00',
'modified_by': 'Administrator',
'name': 'PR000224',
'owner': 'Administrator',
'parent': 'Import Data',
'parentfield': 'roles',
'parenttype': 'Page',
'role': 'Administrator'
},
# Page Role
{
'creation': '2010-12-14 10:33:09',
'docstatus': 0,
'doctype': 'Page Role',
'idx': 2,
'modified': '2011-05-02 16:28:00',
'modified_by': 'Administrator',
'name': 'PR000225',
'owner': 'harshada@webnotestech.com',
'parent': 'Import Data',
'parentfield': 'roles',
'parenttype': 'Page',
'role': 'System Manager'
},
# Page Role
{
'creation': '2010-12-14 10:33:09',
'docstatus': 0,
'doctype': 'Page Role',
'idx': 3,
'modified': '2011-05-02 16:28:00',
'modified_by': 'Administrator',
'name': 'PR000226',
'owner': 'harshada@webnotestech.com',
'parent': 'Import Data',
'parentfield': 'roles',
'parenttype': 'Page',
'role': 'Sales Master Manager'
},
# Page Role
{
'creation': '2010-12-14 10:33:09',
'docstatus': 0,
'doctype': 'Page Role',
'idx': 4,
'modified': '2011-05-02 16:28:00',
'modified_by': 'Administrator',
'name': 'PR000227',
'owner': 'harshada@webnotestech.com',
'parent': 'Import Data',
'parentfield': 'roles',
'parenttype': 'Page',
'role': 'Purchase Master Manager'
},
# Page Role
{
'creation': '2010-12-14 10:33:09',
'docstatus': 0,
'doctype': 'Page Role',
'idx': 5,
'modified': '2011-05-02 16:28:00',
'modified_by': 'Administrator',
'name': 'PR000228',
'owner': 'harshada@webnotestech.com',
'parent': 'Import Data',
'parentfield': 'roles',
'parenttype': 'Page',
'role': 'Material Master Manager'
}
]

View File

@@ -1 +1,44 @@
[{'creation': '2010-01-07 10:44:43', 'module': 'Setup', 'doctype': 'Page', 'owner': 'saumil@webnotestech.com', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 1, 'content': None, 'page_name': 'Permission Engine', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Permission Engine', 'idx': None, 'static_content': None, 'modified': '2010-11-18 20:24:21', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000107', 'parent': 'Permission Engine', 'creation': '2010-01-07 11:10:21', 'modified': '2010-11-18 20:24:21', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'System Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
# Page, Permission Engine
[
# These values are common in all dictionaries
{
'creation': '2010-12-14 10:23:18',
'docstatus': 0,
'modified': '2011-01-04 13:11:17',
'modified_by': 'Administrator',
'owner': 'saumil@webnotestech.com'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': 'Setup',
'name': '__common__',
'page_name': 'Permission Engine',
'show_in_menu': 1,
'standard': 'Yes'
},
# These values are common for all Page Role
{
'doctype': 'Page Role',
'idx': 1,
'name': '__common__',
'parent': 'Permission Engine',
'parentfield': 'roles',
'parenttype': 'Page',
'role': 'System Manager'
},
# Page, Permission Engine
{
'doctype': 'Page',
'name': 'Permission Engine'
},
# Page Role
{
'doctype': 'Page Role'
}
]

View File

@@ -1 +1,27 @@
[{'creation': '2010-07-13 13:42:28', 'module': 'Setup', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'harshada@webnotestech.com', 'script': None, 'show_in_menu': None, 'content': None, 'page_name': 'Setup', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Setup', 'idx': None, 'static_content': None, 'modified': '2010-11-24 16:25:07', 'parenttype': None, 'parent_node': None, 'parentfield': None}]
# Page, Setup
[
# These values are common in all dictionaries
{
'creation': '2010-12-16 23:46:03',
'docstatus': 0,
'modified': '2010-12-18 13:30:38',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': 'Setup',
'name': '__common__',
'page_name': 'Setup',
'standard': 'Yes'
},
# Page, Setup
{
'doctype': 'Page',
'name': 'Setup'
}
]

View File

@@ -1 +1,44 @@
[{'creation': '2010-04-26 11:03:08', 'module': 'Setup', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Setup Wizard', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Setup Wizard', 'idx': None, 'static_content': None, 'modified': '2010-09-25 00:00:00', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000127', 'parent': 'Setup Wizard', 'creation': '2010-04-26 13:35:08', 'modified': '2010-07-13 13:36:23', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}]
# Page, Setup Wizard
[
# These values are common in all dictionaries
{
'creation': '2010-10-12 15:19:32',
'docstatus': 0,
'modified': '2010-09-25 00:00:00',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': 'Setup',
'name': '__common__',
'page_name': 'Setup Wizard',
'show_in_menu': 0,
'standard': 'Yes'
},
# These values are common for all Page Role
{
'doctype': 'Page Role',
'idx': 1,
'name': '__common__',
'parent': 'Setup Wizard',
'parentfield': 'roles',
'parenttype': 'Page',
'role': 'System Manager'
},
# Page, Setup Wizard
{
'doctype': 'Page',
'name': 'Setup Wizard'
},
# Page Role
{
'doctype': 'Page Role'
}
]

View File

@@ -1 +1,51 @@
[{'creation': '2010-12-18 17:10:03', 'module': 'Setup', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': None, 'content': None, 'page_name': 'Webforms', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Webforms', 'idx': None, 'static_content': None, 'modified': '2010-12-18 17:14:25', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000075', 'parent': 'Webforms', 'creation': '2010-12-18 17:11:12', 'modified': '2010-12-18 17:14:25', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}]
# Page, Webforms
[
# These values are common in all dictionaries
{
'creation': '2010-10-14 11:15:59',
'docstatus': 0,
'modified': '2011-01-04 13:19:54',
'modified_by': 'Administrator',
'owner': 'ashwini@webnotestech.com'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': 'Setup',
'name': '__common__',
'page_name': 'Webforms',
'show_in_menu': 1,
'standard': 'Yes'
},
# These values are common for all Page Role
{
'doctype': 'Page Role',
'name': '__common__',
'parent': 'Webforms',
'parentfield': 'roles',
'parenttype': 'Page'
},
# Page, Webforms
{
'doctype': 'Page',
'name': 'Webforms'
},
# Page Role
{
'doctype': 'Page Role',
'idx': 1,
'role': 'Administrator'
},
# Page Role
{
'doctype': 'Page Role',
'idx': 2,
'role': 'System Manager'
}
]