mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
Sourced wnframework-modules from Google Code as erpnext
This commit is contained in:
218
settings/Module Def/Settings/Settings.txt
Normal file
218
settings/Module Def/Settings/Settings.txt
Normal file
@@ -0,0 +1,218 @@
|
||||
[
|
||||
{
|
||||
'_last_update': None,
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'disabled': 'Yes',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def',
|
||||
'doctype_list': None,
|
||||
'file_list': None,
|
||||
'idx': None,
|
||||
'is_hidden': None,
|
||||
'last_updated_date': '2010-11-29 12:02:02',
|
||||
'modified': '2010-09-25 00:00:00',
|
||||
'modified_by': 'Administrator',
|
||||
'module_desc': None,
|
||||
'module_icon': None,
|
||||
'module_label': 'Settings',
|
||||
'module_name': 'Settings',
|
||||
'module_page': None,
|
||||
'module_seq': None,
|
||||
'name': 'Settings',
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'trash_reason': None,
|
||||
'widget_code': None
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Country',
|
||||
'doc_name': 'Country',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003098',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'State',
|
||||
'doc_name': 'State',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003099',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Currency',
|
||||
'doc_name': 'Currency',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003100',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Price List',
|
||||
'doc_name': 'Price List',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003101',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Warehouse Type',
|
||||
'doc_name': 'Warehouse Type',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003102',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Warehouse',
|
||||
'doc_name': 'Warehouse',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003103',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'UOM',
|
||||
'doc_name': 'UOM',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003104',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Terms and Conditions',
|
||||
'doc_name': 'Terms And Conditions',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003105',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Terrioty',
|
||||
'doc_name': 'Territoy',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 9,
|
||||
'modified': '2011-03-24 15:04:47',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003106',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Settings',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
}
|
||||
]
|
||||
0
settings/__init__.py
Normal file
0
settings/__init__.py
Normal file
0
settings/doctype/__init__.py
Normal file
0
settings/doctype/__init__.py
Normal file
0
settings/doctype/authorization_control/__init__.py
Normal file
0
settings/doctype/authorization_control/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
// Settings
|
||||
195
settings/doctype/authorization_control/authorization_control.py
Normal file
195
settings/doctype/authorization_control/authorization_control.py
Normal file
@@ -0,0 +1,195 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
|
||||
# Get 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:
|
||||
if based_on == 'Grand Total': msg = "since Grand Total exceeds %s. %s" % (get_defaults()['currency'], 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
|
||||
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-06-15 13:11:09', 'search_fields': None, 'module': 'Settings', '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': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 255, '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': 'Authorization Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-08 14:33:07', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
|
||||
0
settings/doctype/authorization_rule/__init__.py
Normal file
0
settings/doctype/authorization_rule/__init__.py
Normal file
109
settings/doctype/authorization_rule/authorization_rule.js
Normal file
109
settings/doctype/authorization_rule/authorization_rule.js
Normal 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';
|
||||
}
|
||||
91
settings/doctype/authorization_rule/authorization_rule.py
Normal file
91
settings/doctype/authorization_rule/authorization_rule.py
Normal 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)
|
||||
File diff suppressed because one or more lines are too long
0
settings/doctype/email_settings/__init__.py
Normal file
0
settings/doctype/email_settings/__init__.py
Normal file
5
settings/doctype/email_settings/email_settings.js
Normal file
5
settings/doctype/email_settings/email_settings.js
Normal 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);
|
||||
}
|
||||
}
|
||||
44
settings/doctype/email_settings/email_settings.py
Normal file
44
settings/doctype/email_settings/email_settings.py
Normal 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)
|
||||
1
settings/doctype/email_settings/email_settings.txt
Normal file
1
settings/doctype/email_settings/email_settings.txt
Normal file
File diff suppressed because one or more lines are too long
0
settings/doctype/naming_series/__init__.py
Normal file
0
settings/doctype/naming_series/__init__.py
Normal file
19
settings/doctype/naming_series/naming_series.js
Normal file
19
settings/doctype/naming_series/naming_series.js
Normal 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)
|
||||
}
|
||||
90
settings/doctype/naming_series/naming_series.py
Normal file
90
settings/doctype/naming_series/naming_series.py
Normal 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")
|
||||
1
settings/doctype/naming_series/naming_series.txt
Normal file
1
settings/doctype/naming_series/naming_series.txt
Normal file
File diff suppressed because one or more lines are too long
0
settings/doctype/notification_control/__init__.py
Normal file
0
settings/doctype/notification_control/__init__.py
Normal 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)
|
||||
}
|
||||
}
|
||||
104
settings/doctype/notification_control/notification_control.py
Normal file
104
settings/doctype/notification_control/notification_control.py
Normal 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)
|
||||
File diff suppressed because one or more lines are too long
0
settings/doctype/permission_control/__init__.py
Normal file
0
settings/doctype/permission_control/__init__.py
Normal file
186
settings/doctype/permission_control/permission_control.py
Normal file
186
settings/doctype/permission_control/permission_control.py
Normal 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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-01-07 10:42:02', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'saumil@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': 0, 'max_attachments': None, 'version': 47, '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': '', 'name': 'Permission Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-18 20:24:33', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
|
||||
0
settings/doctype/print_heading/__init__.py
Normal file
0
settings/doctype/print_heading/__init__.py
Normal file
10
settings/doctype/print_heading/print_heading.js
Normal file
10
settings/doctype/print_heading/print_heading.js
Normal file
@@ -0,0 +1,10 @@
|
||||
$import(Tips Common)
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
22
settings/doctype/print_heading/print_heading.py
Normal file
22
settings/doctype/print_heading/print_heading.py
Normal 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
|
||||
1
settings/doctype/print_heading/print_heading.txt
Normal file
1
settings/doctype/print_heading/print_heading.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-28 16:08:11', 'search_fields': 'print_heading', 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 28, '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:print_heading', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Print Heading', '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': 'PERM01019', 'parent': 'Print Heading', 'read': 1, 'create': 1, 'creation': '2010-05-31 09:51:59', 'modified': '2010-09-20 10:32:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-05-31 09:08:23', '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': 'Print Heading', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05127', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 10:32:30', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-28 16:08:11', 'doctype': 'DocField', 'oldfieldname': 'print_heading', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Print Heading', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Print Heading', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05110', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 10:32:30', 'parenttype': 'DocType', 'fieldname': 'print_heading', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-06 18:26:35', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Print Heading', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05844', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 10:32:30', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
settings/doctype/series_detail/__init__.py
Normal file
0
settings/doctype/series_detail/__init__.py
Normal file
1
settings/doctype/series_detail/series_detail.txt
Normal file
1
settings/doctype/series_detail/series_detail.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-06-12 17:10:41', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', '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': 'Series Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Read Only', 'creation': '2009-06-12 17:10:41', 'doctype': 'DocField', 'oldfieldname': 'series', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Series Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02330', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:05:22', 'parenttype': 'DocType', 'fieldname': 'series', 'fieldtype': 'Read Only', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-06-12 17:10:41', 'doctype': 'DocField', 'oldfieldname': 'remove', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Remove', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Series Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02331', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:05:22', 'parenttype': 'DocType', 'fieldname': 'remove', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
settings/doctype/setup_wizard_control/__init__.py
Normal file
0
settings/doctype/setup_wizard_control/__init__.py
Normal 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 ''
|
||||
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-13 15:32:04', 'search_fields': None, 'module': 'Settings', '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': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 108, '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': 'Setup Wizard Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
|
||||
0
settings/doctype/sms_settings/__init__.py
Executable file
0
settings/doctype/sms_settings/__init__.py
Executable file
320
settings/doctype/sms_settings/sms_settings.txt
Executable file
320
settings/doctype/sms_settings/sms_settings.txt
Executable file
@@ -0,0 +1,320 @@
|
||||
[
|
||||
{
|
||||
'_last_update': '1306301711',
|
||||
'allow_attach': None,
|
||||
'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-24 18:21:16',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocType',
|
||||
'document_type': None,
|
||||
'dt_template': None,
|
||||
'hide_heading': None,
|
||||
'hide_toolbar': None,
|
||||
'idx': None,
|
||||
'in_create': 0,
|
||||
'in_dialog': None,
|
||||
'is_transaction_doc': None,
|
||||
'issingle': 1,
|
||||
'istable': None,
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Settings',
|
||||
'name': 'SMS Settings',
|
||||
'name_case': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'print_outline': None,
|
||||
'read_only': 0,
|
||||
'read_only_onload': None,
|
||||
'search_fields': None,
|
||||
'section_style': 'Simple',
|
||||
'server_code': None,
|
||||
'server_code_compiled': None,
|
||||
'server_code_core': None,
|
||||
'server_code_error': None,
|
||||
'show_in_menu': 0,
|
||||
'smallicon': None,
|
||||
'subject': None,
|
||||
'tag_fields': None,
|
||||
'use_template': None,
|
||||
'version': 16
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': None,
|
||||
'create': 1,
|
||||
'creation': '2011-05-24 18:21:16',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 1,
|
||||
'match': None,
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00846',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'System Manager',
|
||||
'submit': None,
|
||||
'write': 1
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': None,
|
||||
'create': None,
|
||||
'creation': '2011-05-24 18:21:16',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 2,
|
||||
'match': None,
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00847',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 1,
|
||||
'read': 1,
|
||||
'role': 'System Manager',
|
||||
'submit': None,
|
||||
'write': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-24 18:21:16',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Column Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'in_filter': None,
|
||||
'label': None,
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05444',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': '50%'
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-24 18:21:16',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': 'Eg. smsgateway.com/api/send_sms.cgi',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sms_gateway_url',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'in_filter': None,
|
||||
'label': 'SMS Gateway URL',
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05440',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-24 18:21:16',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': 'Enter url parameter for message',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'message_parameter',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'in_filter': None,
|
||||
'label': 'Message Parameter',
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05441',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-24 18:21:16',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': 'Enter url parameter for receiver nos',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'receiver_parameter',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'in_filter': None,
|
||||
'label': 'Receiver Parameter',
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05442',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-24 18:21:16',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Column Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'in_filter': None,
|
||||
'label': 'Static Parameters',
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05445',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': '50%'
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-24 18:21:16',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': 'Enter static url parameters here (Eg. sender=ERPNext, username=ERPNext, password=1234 etc.)',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'static_parameter_details',
|
||||
'fieldtype': 'Table',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'in_filter': None,
|
||||
'label': 'Static Parameter Details',
|
||||
'modified': '2011-05-25 11:59:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05443',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'Static Parameter Detail',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'SMS Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
}
|
||||
]
|
||||
0
settings/doctype/static_parameter_detail/__init__.py
Executable file
0
settings/doctype/static_parameter_detail/__init__.py
Executable file
131
settings/doctype/static_parameter_detail/static_parameter_detail.txt
Executable file
131
settings/doctype/static_parameter_detail/static_parameter_detail.txt
Executable file
@@ -0,0 +1,131 @@
|
||||
[
|
||||
{
|
||||
'_last_update': None,
|
||||
'_user_tags': None,
|
||||
'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-25 11:26:05',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocType',
|
||||
'document_type': None,
|
||||
'dt_template': None,
|
||||
'hide_heading': None,
|
||||
'hide_toolbar': None,
|
||||
'idx': None,
|
||||
'in_create': None,
|
||||
'in_dialog': None,
|
||||
'is_transaction_doc': None,
|
||||
'issingle': None,
|
||||
'istable': 1,
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-05-24 18:42:30',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Settings',
|
||||
'name': 'Static Parameter Detail',
|
||||
'name_case': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'print_outline': None,
|
||||
'read_only': None,
|
||||
'read_only_onload': None,
|
||||
'search_fields': None,
|
||||
'section_style': 'Simple',
|
||||
'server_code': None,
|
||||
'server_code_compiled': None,
|
||||
'server_code_core': None,
|
||||
'server_code_error': None,
|
||||
'show_in_menu': 0,
|
||||
'smallicon': None,
|
||||
'subject': None,
|
||||
'tag_fields': None,
|
||||
'use_template': None,
|
||||
'version': 4
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 11:26:05',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'parameter',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'in_filter': None,
|
||||
'label': 'Parameter',
|
||||
'modified': '2011-05-25 11:26:05',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05012',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Static Parameter Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': '150px'
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-25 11:26:05',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'value',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'in_filter': None,
|
||||
'label': 'Value',
|
||||
'modified': '2011-05-25 11:26:05',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05013',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Static Parameter Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': '150px'
|
||||
}
|
||||
]
|
||||
0
settings/doctype/update_series/__init__.py
Normal file
0
settings/doctype/update_series/__init__.py
Normal file
1
settings/doctype/update_series/update_series.txt
Normal file
1
settings/doctype/update_series/update_series.txt
Normal file
File diff suppressed because one or more lines are too long
0
settings/doctype/workflow_action_detail/__init__.py
Normal file
0
settings/doctype/workflow_action_detail/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-23 13:52:22', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'swarnalata@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Workflow Action Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-11-23 13:52:22', 'doctype': 'DocField', 'oldfieldname': 'action_field', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03385', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:54', 'parenttype': 'DocType', 'fieldname': 'action_field', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-23 13:52:22', 'doctype': 'DocField', 'oldfieldname': 'action_value', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Value', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03386', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:54', 'parenttype': 'DocType', 'fieldname': 'action_value', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
settings/doctype/workflow_engine/__init__.py
Normal file
0
settings/doctype/workflow_engine/__init__.py
Normal file
47
settings/doctype/workflow_engine/workflow_engine.py
Normal file
47
settings/doctype/workflow_engine/workflow_engine.py
Normal 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
|
||||
1
settings/doctype/workflow_engine/workflow_engine.txt
Normal file
1
settings/doctype/workflow_engine/workflow_engine.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-23 14:28:25', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'swarnalata@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': 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': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Workflow Engine', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
|
||||
0
settings/doctype/workflow_rule/__init__.py
Normal file
0
settings/doctype/workflow_rule/__init__.py
Normal file
44
settings/doctype/workflow_rule/workflow_rule.js
Normal file
44
settings/doctype/workflow_rule/workflow_rule.js
Normal 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)
|
||||
}
|
||||
);
|
||||
}
|
||||
284
settings/doctype/workflow_rule/workflow_rule.py
Normal file
284
settings/doctype/workflow_rule/workflow_rule.py
Normal 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
|
||||
710
settings/doctype/workflow_rule/workflow_rule.txt
Normal file
710
settings/doctype/workflow_rule/workflow_rule.txt
Normal file
@@ -0,0 +1,710 @@
|
||||
[
|
||||
{
|
||||
'_last_update': '1300960468',
|
||||
'allow_attach': None,
|
||||
'allow_copy': None,
|
||||
'allow_email': None,
|
||||
'allow_print': None,
|
||||
'allow_rename': None,
|
||||
'allow_trash': None,
|
||||
'autoname': 'field:rule_name',
|
||||
'change_log': None,
|
||||
'client_script': None,
|
||||
'client_script_core': None,
|
||||
'client_string': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'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,
|
||||
'last_update': '1294161037',
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Settings',
|
||||
'name': 'Workflow Rule',
|
||||
'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': 'select_form,rule_status',
|
||||
'section_style': 'Tray',
|
||||
'server_code': None,
|
||||
'server_code_compiled': None,
|
||||
'server_code_core': None,
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'smallicon': None,
|
||||
'use_template': None,
|
||||
'version': 31
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-03-24 15:58:12',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Section Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'in_filter': None,
|
||||
'label': 'Rule Definition',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000006338',
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-03-24 15:58:12',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'HTML',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'in_filter': None,
|
||||
'label': 'Intro HTML',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000006339',
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': 'HTML',
|
||||
'options': '<b>Select form for which you want to define rules,set priority & status.</b>',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-11-30 22:42:01',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rule_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'in_filter': None,
|
||||
'label': 'Rule Name',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL02596',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'rule_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rule_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'in_filter': None,
|
||||
'label': 'Rule Name',
|
||||
'modified': '2010-11-30 22:45:39',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03601',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'rule_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rule_status',
|
||||
'fieldtype': 'Select',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Rule Status',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03602',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'rule_status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nActive\nInactive',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'select_form',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'in_filter': 1,
|
||||
'label': 'Select Form',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03603',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'select_form',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'DocType',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client',
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-11-30 22:42:01',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rule_priority',
|
||||
'fieldtype': 'Int',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'in_filter': None,
|
||||
'label': 'Rule Priority',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL02597',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'rule_priority',
|
||||
'oldfieldtype': 'Int',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 0,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rule_priority',
|
||||
'fieldtype': 'Int',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'in_filter': None,
|
||||
'label': 'Rule Priority',
|
||||
'modified': '2010-11-30 22:45:39',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03604',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'rule_priority',
|
||||
'oldfieldtype': 'Int',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 0,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-03-24 15:58:12',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Section Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'in_filter': None,
|
||||
'label': 'Define Rule',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000006340',
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'workflow_rule_details',
|
||||
'fieldtype': 'Table',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'in_filter': None,
|
||||
'label': 'Workflow Rule Details',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03606',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'workflow_rule_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Workflow Rule Detail',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': '100px'
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'extra_condition',
|
||||
'fieldtype': 'Code',
|
||||
'hidden': 1,
|
||||
'icon': None,
|
||||
'idx': 9,
|
||||
'in_filter': None,
|
||||
'label': 'Extra Condition',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03607',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'extra_condition',
|
||||
'oldfieldtype': 'Code',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-03-24 15:58:12',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Section Break',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 10,
|
||||
'in_filter': None,
|
||||
'label': 'Action Detail',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000006341',
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-03-24 15:58:12',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'HTML',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 11,
|
||||
'in_filter': None,
|
||||
'label': 'Action html',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000006342',
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': 'HTML',
|
||||
'options': '<b>Specify actions to be taken when conditions hold satisfied</b>',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'workflow_action_details',
|
||||
'fieldtype': 'Table',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 12,
|
||||
'in_filter': None,
|
||||
'label': 'Workflow Action Details',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03610',
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'workflow_action_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Workflow Action Detail',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-03-24 15:58:12',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'HTML',
|
||||
'hidden': 1,
|
||||
'icon': None,
|
||||
'idx': 13,
|
||||
'in_filter': None,
|
||||
'label': 'Reject HTML',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000006343',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': None,
|
||||
'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>",
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-11-30 17:30:03',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'message',
|
||||
'fieldtype': 'Text',
|
||||
'hidden': 1,
|
||||
'icon': None,
|
||||
'idx': 14,
|
||||
'in_filter': None,
|
||||
'label': 'Enter message',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL00549',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'message',
|
||||
'oldfieldtype': 'Text',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'message',
|
||||
'fieldtype': 'Text',
|
||||
'hidden': 1,
|
||||
'icon': None,
|
||||
'idx': 14,
|
||||
'in_filter': None,
|
||||
'label': 'Enter message',
|
||||
'modified': '2010-11-30 22:45:39',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03612',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'message',
|
||||
'oldfieldtype': 'Text',
|
||||
'options': None,
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': '',
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'raise_exception',
|
||||
'fieldtype': 'Select',
|
||||
'hidden': 1,
|
||||
'icon': None,
|
||||
'idx': 15,
|
||||
'in_filter': None,
|
||||
'label': 'Raise Exception',
|
||||
'modified': '2011-03-24 15:58:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL03613',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'raise_exception',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nYes\nNo',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': None,
|
||||
'create': 1,
|
||||
'creation': '2010-11-30 22:45:39',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 1,
|
||||
'match': None,
|
||||
'modified': '2010-11-30 22:45:39',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00660',
|
||||
'owner': 'swarnalata@webnotestech.com',
|
||||
'parent': 'Workflow Rule',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Administrator',
|
||||
'submit': None,
|
||||
'write': 1
|
||||
}
|
||||
]
|
||||
0
settings/doctype/workflow_rule_detail/__init__.py
Normal file
0
settings/doctype/workflow_rule_detail/__init__.py
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user