merged from webnotes/erpnext
This commit is contained in:
commit
dcaaea5041
@ -5,7 +5,7 @@
|
||||
{
|
||||
'creation': '2010-09-25 10:50:34',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-07-27 11:43:40',
|
||||
'modified': '2011-07-28 12:01:10',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
@ -358,7 +358,7 @@
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Lease Agreement List',
|
||||
'doc_name': 'Lease Agreement List',
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item',
|
||||
'idx': 33
|
||||
@ -367,7 +367,7 @@
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Lease Monthly Future Installment Inflows',
|
||||
'doc_name': 'Lease Monthly Future Installment Inflows',
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item',
|
||||
'idx': 34
|
||||
@ -376,7 +376,7 @@
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Lease Overdue Age Wise',
|
||||
'doc_name': 'Lease Overdue Age Wise',
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item',
|
||||
'idx': 35
|
||||
@ -385,7 +385,7 @@
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Lease Overdue List',
|
||||
'doc_name': 'Lease Overdue List',
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item',
|
||||
'idx': 36
|
||||
@ -394,7 +394,7 @@
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Lease Receipts Client Wise',
|
||||
'doc_name': 'Lease Receipts Client Wise',
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item',
|
||||
'idx': 37
|
||||
@ -402,8 +402,8 @@
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Lease Receipt Summary Year to Date',
|
||||
'doc_name': 'Lease Receipt Summary Year to Date',
|
||||
'display_name': 'Lease Receipt Summary Month Wise',
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item',
|
||||
'idx': 38
|
||||
@ -412,7 +412,7 @@
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Lease Yearly Future Installment Inflows',
|
||||
'doc_name': 'Lease Yearly Future Installment Inflows',
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item',
|
||||
'idx': 39
|
||||
|
||||
@ -72,16 +72,6 @@ cur_frm.fields_dict['master_name'].get_query=function(doc){
|
||||
else alert("Please select master type");
|
||||
}
|
||||
|
||||
/*
|
||||
// Get customer/supplier address
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.master_name = function(doc,cdt,cdn){
|
||||
if(doc.master_name){
|
||||
get_server_fields('get_address','','',doc,cdt,cdn);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// parent account get query
|
||||
// -----------------------------------------
|
||||
cur_frm.fields_dict['parent_account'].get_query = function(doc){
|
||||
|
||||
@ -31,7 +31,7 @@ class DocType:
|
||||
def get_address(self):
|
||||
add=sql("Select address from `tab%s` where name='%s'"%(self.doc.master_type,self.doc.master_name))
|
||||
ret={'address':add[0][0]}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# check whether master name entered for supplier/customer
|
||||
|
||||
@ -455,7 +455,8 @@
|
||||
'description': "Don't delete this field at any cost",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'old_parent',
|
||||
'fieldtype': 'Data',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Account',
|
||||
'hidden': 1,
|
||||
'idx': 24,
|
||||
'label': 'Old Parent',
|
||||
|
||||
@ -45,5 +45,5 @@ class DocType:
|
||||
def update_details(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.clearance_date:
|
||||
sql("update `tabJournal Voucher` set clearance_date = %s where name=%s", (d.clearance_date, d.voucher_id))
|
||||
sql("update `tabJournal Voucher` set clearance_date = %s, modified = %s where name=%s", (d.clearance_date, nowdate(), d.voucher_id))
|
||||
msgprint("Updated")
|
||||
@ -31,7 +31,7 @@ class DocType:
|
||||
ret = {
|
||||
'company_abbr' : abbr
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def validate(self):
|
||||
# Cost Center name must be unique
|
||||
|
||||
@ -39,7 +39,7 @@ class DocType(TransactionBase):
|
||||
'company_address': cstr(comp_det[0][0]),
|
||||
'registration_details': cstr(comp_det[0][1])
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# Get party details
|
||||
#------------------
|
||||
@ -56,7 +56,7 @@ class DocType(TransactionBase):
|
||||
'party_address': cstr(address_display)
|
||||
}
|
||||
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# Get TDS Return acknowledgement
|
||||
#-------------------------------
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
if(doc.__islocal){
|
||||
doc.clearance_date ='';
|
||||
refresh_field('clearance_date');
|
||||
}
|
||||
|
||||
if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
|
||||
|
||||
|
||||
@ -38,9 +38,9 @@ class DocType:
|
||||
args = eval(args)
|
||||
o_s = sql("select outstanding_amount from `tab%s` where name = '%s'" % (args['doctype'],args['docname']))
|
||||
if args['doctype'] == 'Payable Voucher':
|
||||
return cstr({'debit': o_s and flt(o_s[0][0]) or 0})
|
||||
return {'debit': o_s and flt(o_s[0][0]) or 0}
|
||||
if args['doctype'] == 'Receivable Voucher':
|
||||
return cstr({'credit': o_s and flt(o_s[0][0]) or 0})
|
||||
return {'credit': o_s and flt(o_s[0][0]) or 0}
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------
|
||||
# Create remarks
|
||||
|
||||
802
accounts/doctype/journal_voucher/journal_voucher.txt
Normal file
802
accounts/doctype/journal_voucher/journal_voucher.txt
Normal file
@ -0,0 +1,802 @@
|
||||
# DocType, Journal Voucher
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:06',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-07-28 15:28:12',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1311251040',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Accounts',
|
||||
'name': '__common__',
|
||||
'search_fields': 'voucher_type,posting_date, due_date, cheque_no',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': ' ',
|
||||
'tag_fields': 'voucher_type',
|
||||
'version': 309
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Journal Voucher',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Journal Voucher',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Journal Voucher
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Journal Voucher'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'Accounts Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 0,
|
||||
'role': 'Accounts Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'Accounts User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 1,
|
||||
'role': 'Accounts User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 2,
|
||||
'label': '1. Select Series and Dates',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 3,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'voucher_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Voucher Type',
|
||||
'oldfieldname': 'voucher_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nLoan Receipt',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'write_off_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 5,
|
||||
'label': 'Write Off Amount <=',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Accounts Receivable',
|
||||
'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'write_off_based_on',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 6,
|
||||
'label': 'Write Off Based On',
|
||||
'options': 'Accounts Receivable\nAccounts Payable',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'To manage multiple series please go to Setup > Manage Series',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 7,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'naming_series',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'JV',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Today',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'voucher_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'Voucher Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'voucher_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'The date at which current entry will get or has actually executed.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'posting_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 9,
|
||||
'in_filter': 1,
|
||||
'label': 'Posting Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'posting_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'due_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 10,
|
||||
'label': 'Due Date',
|
||||
'oldfieldname': 'due_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'The date at which current entry is corrected in the system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amendment_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 11,
|
||||
'label': 'Amendment Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 12,
|
||||
'label': 'Amended From',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Journal Voucher',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 13,
|
||||
'label': 'Get Outstanding Invoices',
|
||||
'options': 'get_outstanding_invoices',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Server'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 14,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cheque_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 15,
|
||||
'in_filter': 1,
|
||||
'label': 'Cheque No',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'cheque_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cheque_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 16,
|
||||
'label': 'Cheque Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'cheque_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'clearance_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 17,
|
||||
'in_filter': 1,
|
||||
'label': 'Clearance Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'clearance_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'user_remark',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 18,
|
||||
'in_filter': 1,
|
||||
'label': 'User Remark',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'user_remark',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'User Remark will be added to Auto Remark',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'remark',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 19,
|
||||
'label': 'Remark',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'remark',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 20,
|
||||
'label': '2. Add / Edit GL Entries',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'entries',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 21,
|
||||
'label': 'Entries',
|
||||
'oldfieldname': 'entries',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Journal Voucher Detail',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 22,
|
||||
'label': 'Get Balance',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'total_debit',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 23,
|
||||
'in_filter': 1,
|
||||
'label': 'Total Debit',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'total_debit',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'total_credit',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 24,
|
||||
'in_filter': 1,
|
||||
'label': 'Total Credit',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'total_credit',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'difference',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 25,
|
||||
'label': 'Difference',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'difference',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 26,
|
||||
'label': 'Addtional Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 27,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bill_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 28,
|
||||
'label': 'Bill No',
|
||||
'oldfieldname': 'bill_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bill_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 29,
|
||||
'label': 'Bill Date',
|
||||
'oldfieldname': 'bill_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'No',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_opening',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 30,
|
||||
'in_filter': 1,
|
||||
'label': 'Is Opening',
|
||||
'oldfieldname': 'is_opening',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'No\nYes',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'aging_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 31,
|
||||
'label': 'Aging Date',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'aging_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cancel_reason',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 32,
|
||||
'label': 'Cancel Reason',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'cancel_reason',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'pay_to_recd_from',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 33,
|
||||
'label': 'Pay To / Recd From',
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'total_amount',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 34,
|
||||
'label': 'Total Amount',
|
||||
'no_copy': 1,
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'total_amount_in_words',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 35,
|
||||
'label': 'Total Amount in Words',
|
||||
'no_copy': 1,
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 36,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 37,
|
||||
'in_filter': 1,
|
||||
'label': 'Fiscal Year',
|
||||
'oldfieldname': 'fiscal_year',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Fiscal Year',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 38,
|
||||
'in_filter': 1,
|
||||
'label': 'Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'select_print_heading',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 39,
|
||||
'label': 'Select Print Heading',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'select_print_heading',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Print Heading',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 40,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 41,
|
||||
'label': 'View Ledger Entry',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 42,
|
||||
'label': 'TDS',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'No',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'tds_applicable',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 43,
|
||||
'in_filter': 1,
|
||||
'label': 'TDS Applicable',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'tds_applicable',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nYes\nNo',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'tds_category',
|
||||
'fieldtype': 'Select',
|
||||
'hidden': 0,
|
||||
'idx': 44,
|
||||
'in_filter': 1,
|
||||
'label': 'TDS Category',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'tds_category',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:TDS Category',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_account',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 45,
|
||||
'label': 'Supplier Account',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'supplier_account',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Account',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 46,
|
||||
'label': 'Get TDS',
|
||||
'no_copy': 0,
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Tax Code will be populated based on account head mentioned in TDS Category master',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'tax_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 47,
|
||||
'label': 'TDS Account Head',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'tax_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Account',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 48,
|
||||
'label': 'Rate',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'ded_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 49,
|
||||
'label': 'Amount',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'ded_amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client'
|
||||
}
|
||||
]
|
||||
@ -1,5 +1,17 @@
|
||||
$.extend(cur_frm.cscript, {
|
||||
Generate: function(doc, dt, dn) {
|
||||
if(doc.installment_amount==''){
|
||||
msgprint('Set Installment Amount before generating schedule');
|
||||
return;
|
||||
}
|
||||
if(doc.no_of_installments==''){
|
||||
msgprint('Set Number of Installments before generating schedule');
|
||||
return;
|
||||
}
|
||||
if(doc.start_date==''){
|
||||
msgprint('Set Start Date before generating schedule');
|
||||
return;
|
||||
}
|
||||
cur_frm.cscript.clear_installments(doc);
|
||||
tot=0;i=0;
|
||||
while(tot<flt(doc.invoice_amount)-flt(doc.down_payment)){
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
{
|
||||
'creation': '2011-07-22 17:47:57',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-07-27 12:54:48',
|
||||
'modified': '2011-07-27 15:33:55',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
@ -19,7 +19,7 @@
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 20
|
||||
'version': 21
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -114,7 +114,7 @@
|
||||
'fieldname': 'account',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Account',
|
||||
'label': 'Lessee Account',
|
||||
'options': 'Account',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
$.extend(cur_frm.cscript, {
|
||||
Generate: function(doc, dt, dn) {
|
||||
cur_frm.cscript.clear_installments(doc);
|
||||
for(var i=0; i< doc.no_of_installments; i++) {
|
||||
d = LocalDB.add_child(doc, 'Loan Installment', 'installments');
|
||||
d.amount = doc.loan_amount / doc.no_of_installments;
|
||||
d.due_date = dateutil.add_months(doc.start_date, i+1);
|
||||
}
|
||||
cur_frm.refresh();
|
||||
},
|
||||
/* submit:function(doc){
|
||||
data=doc.get_values();
|
||||
|
||||
data['']=
|
||||
$c_obj(make_doclist(dt,dn),'loan_post',data,function(){});
|
||||
},*/
|
||||
refresh: function(doc) {
|
||||
cur_frm.cscript.hide_show_buttons(doc);
|
||||
},
|
||||
hide_show_buttons: function(doc) {
|
||||
if(doc.docstatus==0) {
|
||||
hide_field('Installment Reciept'); show_field('Generate');
|
||||
} else if (doc.docstatus==1) {
|
||||
show_field('Installment Reciept');hide_field('Generate');
|
||||
}
|
||||
},
|
||||
clear_installments: function(doc) {
|
||||
$.each(getchildren('Loan Installment', doc.name, 'installments', 'Loan'),
|
||||
function(i, d) {
|
||||
LocalDB.delete_doc('Loan Installment', d.name);
|
||||
}
|
||||
)
|
||||
},
|
||||
'Installment Reciept': function(doc, dt, dn) {
|
||||
var d = new wn.widgets.Dialog({
|
||||
width: 500,
|
||||
title: 'Add a new payment installment',
|
||||
fields: [
|
||||
{fieldtype:'Data', label:'Cheque Number', fieldname:'cheque_number', reqd:1},
|
||||
{fieldtype:'Date', label:'Cheque Date', fieldname:'cheque_date', reqd:1},
|
||||
{fieldtype:'Link', label:'Bank Account', fieldname:'bank_account', reqd:1, options:'Account'},
|
||||
{fieldtype:'Button', label:'Update',fieldname:'update'}
|
||||
]
|
||||
})
|
||||
d.show();
|
||||
d.fields_dict.update.input.onclick = function() {
|
||||
var data = d.get_values();
|
||||
|
||||
if(data) {
|
||||
$c_obj(make_doclist(dt,dn),'loan_installment_post',data,function(){cur_frm.refresh(); d.hide();});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1,48 +0,0 @@
|
||||
import webnotes
|
||||
from webnotes.model.doc import make_autoname, Document, addchild
|
||||
from webnotes import msgprint
|
||||
from webnotes.utils import get_defaults
|
||||
import json
|
||||
from accounts.utils import post_jv
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc, self.doclist = doc, doclist
|
||||
|
||||
def autoname(self):
|
||||
"""
|
||||
Create Loan Id using naming_series pattern
|
||||
"""
|
||||
self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
|
||||
|
||||
def loan_post(self):
|
||||
data['voucher_type']='Loan Issue'
|
||||
data['naming_series']='JV'
|
||||
data['fiscal_year'] = get_defaults()['fiscal_year'] # To be modified to take care
|
||||
data['company'] = get_defaults()['company']
|
||||
data['debit_account'] = self.doc['receivable_account']
|
||||
data['credit_account'] = self.doc['account']
|
||||
data['amount'] = self.doc.loan_amount
|
||||
jv_name=post_jv(data)
|
||||
|
||||
def loan_installment_post(self, args):
|
||||
"""
|
||||
Posts the loan receipt into Journal Voucher
|
||||
"""
|
||||
next_inst = sql("select amount,name from `tabLoan Installment` where parent=%s and ifnull(cheque_number,'')='' order by due_date limit 1",self.doc.name)
|
||||
|
||||
data = json.loads(args)
|
||||
data['voucher_type']='Loan Receipt'
|
||||
data['naming_series']='JV'
|
||||
data['amount']=next_inst[0][0]
|
||||
data['debit_account']=data.get('bank_account')
|
||||
data['credit_account']=self.doc.account
|
||||
data['fiscal_year']=get_defaults()['fiscal_year']
|
||||
data['company']=get_defaults()['company']
|
||||
jv_name=post_jv(data)
|
||||
|
||||
sql("update `tabLoan Installment` set cheque_number=%s, cheque_date=%s, jv_number=%s where name=%s",(data.get('cheque_number'),data.get('cheque_date'),jv_name,next_inst[0][1]))
|
||||
|
||||
self.doclist = [Document(d.doctype, d.name) for d in self.doclist]
|
||||
|
||||
@ -1,172 +0,0 @@
|
||||
# DocType, Loan
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-07-15 10:35:26',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-07-18 12:12:19',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1310963215',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Accounts',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 15
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Loan',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Loan',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'Accounts User'
|
||||
},
|
||||
|
||||
# DocType, Loan
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Loan'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 1,
|
||||
'label': 'Naming Series',
|
||||
'options': '\nLOAN',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'account',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 2,
|
||||
'label': 'Account',
|
||||
'options': 'Account',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'receivable_account',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Receivable Account',
|
||||
'options': 'Account'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'invoice',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'label': 'Invoice',
|
||||
'options': 'Receivable Voucher',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'loan_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 5,
|
||||
'label': 'Loan Amount',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'start_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 6,
|
||||
'label': 'Start Date',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'no_of_installments',
|
||||
'fieldtype': 'Int',
|
||||
'idx': 7,
|
||||
'label': 'No of Installments',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 8,
|
||||
'label': 'Generate',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'installments',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 9,
|
||||
'label': 'Installments',
|
||||
'options': 'Loan Installment'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 10,
|
||||
'label': 'Installment Reciept'
|
||||
}
|
||||
]
|
||||
@ -1,17 +0,0 @@
|
||||
import unittest
|
||||
import webnotes
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
class TestScheduleGeneartion(unittest.TestCase):
|
||||
def setUp(self):
|
||||
webnotes.conn.begin()
|
||||
# create a mock loan
|
||||
self.loan = get_obj('Loan', 'LOAN00001')
|
||||
|
||||
def test_generation(self):
|
||||
"test the genaration of loan installments"
|
||||
self.loan.generate()
|
||||
self.assertEqual(self.loan.get_installment_total(), self.loan.doc.loan_amount)
|
||||
|
||||
def tearDown(self):
|
||||
webnotes.conn.rollback()
|
||||
@ -1,111 +0,0 @@
|
||||
# DocType, Loan Installment
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-07-15 10:36:42',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-07-15 15:48:34',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Accounts',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 4
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Loan Installment',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Loan Installment
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Loan Installment'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 1,
|
||||
'label': 'Amount',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'due_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 2,
|
||||
'label': 'Due Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cheque_number',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Cheque Number',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cheque_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 4,
|
||||
'label': 'Cheque Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'deposit_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 5,
|
||||
'label': 'Deposit Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'realized_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 6,
|
||||
'label': 'Realized Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'jv_number',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 7,
|
||||
'label': 'JV Number',
|
||||
'options': 'Journal Voucher',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
@ -48,14 +48,14 @@ class DocType(TransactionBase):
|
||||
ret['due_date'] = add_days(cstr(self.doc.posting_date), acc_head and cint(acc_head[0][1]) or 0)
|
||||
elif not acc_head:
|
||||
msgprint("%s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company))
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def get_cust(self):
|
||||
ret = {}
|
||||
if self.doc.credit_to:
|
||||
ret['supplier'] = get_value('Account',self.doc.credit_to,'master_name')
|
||||
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# Get Default Cost Center and Expense Head from Item Master
|
||||
@ -70,7 +70,7 @@ class DocType(TransactionBase):
|
||||
if not args['cost_center'] or args['cost_center'] == 'undefined':
|
||||
cost_center = sql("select cost_center from `tabItem` where name = '%s'" % args['item_code'])
|
||||
ret['cost_center'] = cost_center and cost_center[0][0] or ''
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# Get Items based on PO or PR
|
||||
@ -84,7 +84,7 @@ class DocType(TransactionBase):
|
||||
self.validate_duplicate_docname('purchase_order')
|
||||
self.doclist = get_obj('DocType Mapper', 'Purchase Order-Payable Voucher').dt_map('Purchase Order', 'Payable Voucher', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Payable Voucher'],['PO Detail', 'PV Detail']]")
|
||||
|
||||
ret = eval(self.get_credit_to())
|
||||
ret = self.get_credit_to()
|
||||
#self.doc.supplier_name = ret['supplier_name']
|
||||
#self.doc.supplier_address = ret['supplier_address']
|
||||
|
||||
@ -115,7 +115,7 @@ class DocType(TransactionBase):
|
||||
'cost_center' : item_det and item_det[0]['cost_center'] or '',
|
||||
'item_tax_rate' : str(t)
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# Advance Allocation
|
||||
# -------------------
|
||||
@ -139,7 +139,7 @@ class DocType(TransactionBase):
|
||||
def get_rate1(self,acc):
|
||||
rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc))
|
||||
ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# *************************** Server Utility Functions *****************************
|
||||
@ -345,7 +345,7 @@ class DocType(TransactionBase):
|
||||
# get tds rate
|
||||
# -------------
|
||||
def get_tds_rate(self):
|
||||
return str({'rate' : flt(get_value('Account', self.doc.tax_code, 'tax_rate'))})
|
||||
return {'rate' : flt(get_value('Account', self.doc.tax_code, 'tax_rate'))}
|
||||
|
||||
# set aging date
|
||||
#-------------------
|
||||
|
||||
@ -129,7 +129,7 @@ class DocType:
|
||||
|
||||
# save
|
||||
le.save(1)
|
||||
le_obj.on_update(adv_adj = '')
|
||||
le_obj.on_update(adv_adj = '', cancel = '')
|
||||
|
||||
|
||||
# Reposting Balances
|
||||
|
||||
@ -90,7 +90,7 @@ class DocType(TransactionBase):
|
||||
def get_debit_to(self):
|
||||
acc_head = self.get_customer_account()
|
||||
if acc_head:
|
||||
return cstr({ 'debit_to' : acc_head })
|
||||
return { 'debit_to' : acc_head }
|
||||
|
||||
|
||||
# Set Due Date = Posting Date + Credit Days
|
||||
@ -128,7 +128,7 @@ class DocType(TransactionBase):
|
||||
get_obj('DocType Mapper', 'Sales Order-Receivable Voucher').dt_map('Sales Order', 'Receivable Voucher', self.doc.sales_order_main, self.doc, self.doclist, "[['Sales Order', 'Receivable Voucher'],['Sales Order Detail', 'RV Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team']]")
|
||||
self.get_income_account('entries')
|
||||
|
||||
ret = eval(self.get_debit_to())
|
||||
ret = self.get_debit_to()
|
||||
if ret.has_key('debit_to'):
|
||||
self.doc.debit_to = ret['debit_to']
|
||||
|
||||
@ -162,7 +162,7 @@ class DocType(TransactionBase):
|
||||
if ret['warehouse']:
|
||||
actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item_code, ret['warehouse']))
|
||||
ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# Get tax rate if account type is tax
|
||||
@ -515,7 +515,7 @@ class DocType(TransactionBase):
|
||||
ret = {
|
||||
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# Make GL Entries
|
||||
# -------------------------
|
||||
|
||||
@ -34,7 +34,7 @@ class DocType:
|
||||
else:
|
||||
ret = { 'registration_details': cstr(comp_det[0][0])}
|
||||
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# Get default bank and tds account
|
||||
#------------------------------------
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
report.customize_filters = function() {
|
||||
|
||||
//this.hide_all_filters();
|
||||
this.mytabs.items['Select Columns'].hide();
|
||||
this.mytabs.items['More Filters'].hide();
|
||||
|
||||
|
||||
this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Budget Detail'});
|
||||
this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Budget Detail', in_first_page:1});
|
||||
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Period'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',1,{whiteSpace:'pre'});
|
||||
}
|
||||
|
||||
this.mytabs.items['More Filters'].hide();
|
||||
this.mytabs.items['Select Columns'].hide();
|
||||
|
||||
@ -51,7 +51,6 @@ for r in res:
|
||||
q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
|
||||
cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
|
||||
if ch:
|
||||
|
||||
qur = q1+cond2+cond1+" and t2.name = '%s'"
|
||||
ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
|
||||
|
||||
@ -132,11 +131,6 @@ def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
|
||||
col_idx[str(c) + n ] = len(colnames) - 1
|
||||
|
||||
|
||||
|
||||
# make default columns
|
||||
#coltypes[col_idx[based_on]] = 'Link'
|
||||
#coloptions[col_idx[based_on]]= based_on
|
||||
|
||||
# get start date
|
||||
start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
|
||||
if not start_date:
|
||||
@ -163,7 +157,7 @@ for r in res:
|
||||
|
||||
ch = make_child_lst(based_on,r[0].strip())
|
||||
|
||||
actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where t2.is_pl_account = 'Yes' and t1.is_cancelled = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
|
||||
actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where ifnull(t2.is_pl_account, 'No') = 'Yes' and ifnull(t1.is_cancelled, 'No') = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
|
||||
|
||||
#----------------------------------------------------------
|
||||
actual = flt(actual[0][0])
|
||||
|
||||
@ -1 +1,10 @@
|
||||
SELECT CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM `tabCost Center` AS node,`tabCost Center` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft
|
||||
SELECT
|
||||
CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name
|
||||
FROM
|
||||
`tabCost Center` AS node,`tabCost Center` AS parent
|
||||
WHERE
|
||||
node.lft BETWEEN parent.lft AND parent.rgt
|
||||
AND node.docstatus !=2
|
||||
AND node.company_name like '%(company)s%%'
|
||||
GROUP BY node.name
|
||||
ORDER BY node.lft
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
}
|
||||
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
@ -0,0 +1,13 @@
|
||||
data =[
|
||||
['Agreement No.','Data','100px',''],
|
||||
['Lessee Name','Data','300px',''],
|
||||
['Amount','Currency','120px','']
|
||||
]
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
select la.name, la.account, la.invoice_amount
|
||||
from `tabLease Agreement` la
|
||||
where start_date between '%(date)s' and '%(date1)s' order by la.name
|
||||
@ -0,0 +1,14 @@
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
// this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
|
||||
|
||||
}
|
||||
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
@ -0,0 +1,13 @@
|
||||
data =[
|
||||
['Month','Data','100px',''],
|
||||
['Year','Data','100px',''],
|
||||
['Amount','Currency','120px','']
|
||||
]
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
select date_format(due_date,'%M') as mnt,year(due_date),sum(amount)
|
||||
|
||||
from `tabLease Agreement` la,`tabLease Installment` lai
|
||||
|
||||
where la.name=lai.parent and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
|
||||
|
||||
group by date_format(due_date,'%M-%Y')
|
||||
|
||||
order by year(due_date),month(due_date)
|
||||
@ -0,0 +1,14 @@
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
// this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
|
||||
|
||||
}
|
||||
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
@ -0,0 +1,14 @@
|
||||
data =[
|
||||
['Agreement No.','Data','100px',''],
|
||||
['Lessee Name','Data','300px',''],
|
||||
['Amount','Currency','120px',''],
|
||||
['Age','Data','100px','']
|
||||
]
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
select la.name,la.account,lai.amount,cast('%(date)s' as date)-due_date as age
|
||||
|
||||
from `tabLease Agreement` la,`tabLease Installment` lai
|
||||
|
||||
where la.name=lai.parent and lai.due_date<cast('%(date)s' as date) and (lai.cheque_date is null or lai.cheque_date > cast('%(date)s' as date))
|
||||
|
||||
order by cast('%(date)s' as date)-due_date desc
|
||||
@ -0,0 +1,14 @@
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
// this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
|
||||
|
||||
}
|
||||
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
@ -0,0 +1,16 @@
|
||||
data =[
|
||||
['Lessee Name','Data','300px',''],
|
||||
['Below 30 Days','Currency','120px',''],
|
||||
['Below 90 Days','Currency','120px',''],
|
||||
['Below 180 Days','Currency','120px',''],
|
||||
['Below 360 Days','Currency','120px',''],
|
||||
['Above 360 Days','Currency','120px',''],
|
||||
]
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
select account,sum(od_30)as od_30,sum(od_90)as od_90,sum(od_180)as od_180,sum(od_360)as od_360,sum(od_1yr)as od_1yr from
|
||||
(
|
||||
select account,case when age<=30 then amount end as od_30,case when age between 31 and 90 then amount end as od_90,case when age between 91 and 180 then amount end as od_180,case when age between 181 and 360 then amount end as od_360,case when age>360 then amount end as od_1yr from
|
||||
(
|
||||
select la.account,lai.amount,cast('%(date)s' as date)-due_date as age
|
||||
from `tabLease Agreement` la,`tabLease Installment` lai
|
||||
where la.name=lai.parent and lai.due_date<'%(date)s' and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
|
||||
)a
|
||||
)b group by account order by account
|
||||
@ -0,0 +1,11 @@
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
}
|
||||
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
@ -0,0 +1,13 @@
|
||||
data =[
|
||||
['Month','Data','100px',''],
|
||||
['Year','Data','100px',''],
|
||||
['Amount','Currency','120px','']
|
||||
]
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
SELECT date_format(gl.posting_date,'%M'),year(gl.posting_date),sum(gl.credit) as amount
|
||||
FROM `tabGL Entry` gl, `tabAccount` a
|
||||
WHERE gl.account=a.name and a.master_type='Customer' and gl.credit>0 and gl.posting_date between '%(date)s' and '%(date1)s'
|
||||
GROUP BY month(gl.posting_date),year(gl.posting_date)
|
||||
ORDER BY year(gl.posting_date),month(gl.posting_date)
|
||||
@ -1,4 +1,4 @@
|
||||
# Search Criteria, lease_receipt_summary_year_to_date
|
||||
# Search Criteria, lease_receipt_summary_month_wise
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
@ -13,21 +13,18 @@
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
|
||||
'criteria_name': 'Lease Receipt Summary (Year to date)',
|
||||
'criteria_name': 'Lease Receipt Summary Month Wise',
|
||||
'doc_type': 'GL Entry',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
|
||||
'module': 'Accounts',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'sort_by': '`tabGL Entry`.`company`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, lease_receipt_summary_year_to_date
|
||||
# Search Criteria, lease_receipt_summary_month_wise
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': 'lease_receipt_summary_year_to_date'
|
||||
'name': 'lease_receipt_summary_month_wise'
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,11 @@
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
}
|
||||
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
@ -0,0 +1,12 @@
|
||||
data =[
|
||||
['Lessee Name','Data','300px',''],
|
||||
['Amount','Currency','120px','']
|
||||
]
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
SELECT gl.account,sum(gl.credit) as amount
|
||||
FROM `tabGL Entry` gl, `tabAccount` a
|
||||
WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s'
|
||||
GROUP BY gl.account
|
||||
ORDER BY posting_date
|
||||
@ -13,12 +13,13 @@
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
|
||||
'criteria_name': 'Lease Receipts Client wise',
|
||||
'criteria_name': 'Lease Receipts Client Wise',
|
||||
'doc_type': 'GL Entry',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
|
||||
'module': 'Accounts',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
// this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
|
||||
|
||||
}
|
||||
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
@ -0,0 +1,12 @@
|
||||
data =[
|
||||
['Year','Data','100px',''],
|
||||
['Amount','Currency','120px','']
|
||||
]
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
select year(date_sub(due_date,interval 6 MONTH)) as yr,sum(amount)
|
||||
|
||||
from `tabLease Agreement` la,`tabLease Installment` lai
|
||||
|
||||
where la.name=lai.parent and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
|
||||
|
||||
group by year(date_sub(due_date,interval 6 MONTH))
|
||||
|
||||
order by yr
|
||||
@ -90,12 +90,12 @@ class DocType:
|
||||
# get item details
|
||||
# ---------------------------------
|
||||
def get_item_details(self, arg =''):
|
||||
return cstr( get_obj(dt='Purchase Common').get_item_details(self,arg) )
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
|
||||
# Get UOM Details
|
||||
# ---------------------------------
|
||||
def get_uom_details(self, arg = ''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_uom_details(arg))
|
||||
return get_obj(dt='Purchase Common').get_uom_details(arg)
|
||||
|
||||
# GET TERMS & CONDITIONS
|
||||
#-----------------------------
|
||||
|
||||
@ -84,7 +84,7 @@ class DocType(TransactionBase):
|
||||
# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
|
||||
contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where supplier = '%s' and is_supplier = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
|
||||
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
||||
return cstr(ret)
|
||||
return ret
|
||||
else:
|
||||
msgprint("Supplier : %s does not exists" % (name))
|
||||
raise Exception
|
||||
@ -142,14 +142,14 @@ class DocType(TransactionBase):
|
||||
ret['purchase_rate'] = item and flt(item[0]['last_purchase_rate']) or 0
|
||||
ret['import_rate'] = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(obj.doc.fields.has_key('conversion_rate') and flt(obj.doc.conversion_rate) or 1)
|
||||
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# Get Available Qty at Warehouse
|
||||
def get_bin_details( self, arg = ''):
|
||||
arg = eval(arg)
|
||||
bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], arg['warehouse']), as_dict=1)
|
||||
ret = { 'projected_qty' : bin and flt(bin[0]['projected_qty']) or 0 }
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
# Get UOM Details
|
||||
def get_uom_details(self, arg = ''):
|
||||
@ -163,7 +163,7 @@ class DocType(TransactionBase):
|
||||
'purchase_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])) or 0
|
||||
}
|
||||
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
# get last purchase rate
|
||||
def get_last_purchase_rate( self, obj):
|
||||
@ -522,7 +522,7 @@ class DocType(TransactionBase):
|
||||
'rate' : rate and (rate[0]['account_type'] == 'Tax' and not arg['charge_type'] == 'Actual') and flt(rate[0]['tax_rate']) or 0
|
||||
}
|
||||
#msgprint(ret)
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
|
||||
@ -38,23 +38,17 @@ class DocType(TransactionBase):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date')
|
||||
|
||||
|
||||
# Client Trigger Functions
|
||||
#----------------------------------------------------------------------------------------------------
|
||||
# Get Supplier Details
|
||||
#def get_supplier_details(self, name = ''):
|
||||
#return cstr(get_obj(dt='Purchase Common').get_supplier_details(name))
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details(self, arg =''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_item_details(self,arg))
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
|
||||
# Get UOM Details
|
||||
def get_uom_details(self, arg = ''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_uom_details(arg))
|
||||
return get_obj(dt='Purchase Common').get_uom_details(arg)
|
||||
|
||||
# get available qty at warehouse
|
||||
def get_bin_details(self, arg = ''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_bin_details(arg))
|
||||
return get_obj(dt='Purchase Common').get_bin_details(arg)
|
||||
|
||||
# Pull Indent
|
||||
def get_indent_details(self):
|
||||
|
||||
@ -18,7 +18,7 @@ class DocType:
|
||||
'supplier_name' : cd and cd[0][4] or '',
|
||||
'supplier_address': cd and cd[0][5] or ''
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def get_rfq_details(self):
|
||||
self.doc.clear_table(self.doclist, 'supplier_quotation_details')
|
||||
@ -28,12 +28,12 @@ class DocType:
|
||||
def update_approval_status(self):
|
||||
if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
|
||||
set(self.doc, 'approval_status','Approved')
|
||||
return cstr(self.doc.approval_status)
|
||||
return self.doc.approval_status
|
||||
elif self.doc.approval_status == 'Approved':
|
||||
pc_obj = get_obj('Purchase Common')
|
||||
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
|
||||
set(self.doc, 'approval_status', 'Not Approved')
|
||||
return cstr(self.doc.approval_status)
|
||||
return self.doc.approval_status
|
||||
|
||||
def validate_item_list(self):
|
||||
if not getlist(self.doclist, 'supplier_quotation_details'):
|
||||
@ -101,4 +101,4 @@ class DocType:
|
||||
# Get Supplier Details
|
||||
# --------------------
|
||||
def get_supplier_details(self, name = ''):
|
||||
return cstr(get_obj('Purchase Common').get_supplier_details(name))
|
||||
return get_obj('Purchase Common').get_supplier_details(name)
|
||||
12
home/page/dashboard/dashboard.css
Normal file
12
home/page/dashboard/dashboard.css
Normal file
@ -0,0 +1,12 @@
|
||||
div.dashboard_table td {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
div.dashboard-title {
|
||||
font-weight: bold;
|
||||
padding: '3px 0px';
|
||||
}
|
||||
|
||||
div.dashboard-graph {
|
||||
height: 180px;
|
||||
}
|
||||
8
home/page/dashboard/dashboard.html
Normal file
8
home/page/dashboard/dashboard.html
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="layout_wrapper dashboard">
|
||||
<div class="header"></div>
|
||||
<div class="body">
|
||||
<!-- 4x2 table to show the dashboards-->
|
||||
<div class="help_box">Loading...</div>
|
||||
<div class="dashboard_table"></div>
|
||||
</div>
|
||||
</div>
|
||||
139
home/page/dashboard/dashboard.js
Normal file
139
home/page/dashboard/dashboard.js
Normal file
@ -0,0 +1,139 @@
|
||||
pscript.onload_dashboard = function() {
|
||||
// load jqplot
|
||||
$.scriptPath = 'js/'
|
||||
$.require(['jquery/jquery.jqplot.min.js',
|
||||
'jquery/jqplot-plugins/jqplot.barRenderer.js',
|
||||
'jquery/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js',
|
||||
'jquery/jqplot-plugins/jqplot.canvasTextRenderer.min.js',
|
||||
'jquery/jqplot-plugins/jqplot.categoryAxisRenderer.min.js']);
|
||||
|
||||
|
||||
pscript.dashboard_settings = {
|
||||
company: sys_defaults.company,
|
||||
start: dateutil.obj_to_str(dateutil.add_days(new Date(), -60)),
|
||||
end: dateutil.obj_to_str(new Date()),
|
||||
interval: 7
|
||||
}
|
||||
|
||||
var ph = new PageHeader($('.dashboard .header').get(0), 'Dashboards');
|
||||
var db = new Dashboard();
|
||||
|
||||
ph.add_button('Settings', db.show_settings);
|
||||
|
||||
db.refresh();
|
||||
|
||||
}
|
||||
|
||||
Dashboard = function() {
|
||||
var me = this;
|
||||
$.extend(me, {
|
||||
refresh: function() {
|
||||
$('.dashboard .help_box').css('display', 'block');
|
||||
$c_page('home', 'dashboard', 'load_dashboard', JSON.stringify(pscript.dashboard_settings), function(r,rt) {
|
||||
$('.dashboard .help_box').css('display', 'none');
|
||||
me.render(r.message);
|
||||
})
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
$('.dashboard_table').html('');
|
||||
var t = make_table($('.dashboard_table').get(0), 4, 2, '100%', ['50%', '50%'], {padding: '5px'});
|
||||
var ridx=0; var cidx=0;
|
||||
for(var i=0; i< data.length; i++) {
|
||||
// switch columns and rows
|
||||
if(cidx==2) { cidx=0; ridx++}
|
||||
|
||||
// give an id!
|
||||
var cell = $td(t,ridx,cidx);
|
||||
var title = $a(cell, 'div', 'dashboard-title', '', data[i][0].title);
|
||||
var parent = $a(cell, 'div', 'dashboard-graph')
|
||||
|
||||
parent.id = '_dashboard' + ridx + '-' + cidx;
|
||||
|
||||
// render graph
|
||||
me.render_graph(parent.id, data[i][1]);
|
||||
cidx++;
|
||||
}
|
||||
},
|
||||
|
||||
render_graph: function(parent, values) {
|
||||
var vl = [];
|
||||
$.each(values, function(i,v) {
|
||||
vl.push([dateutil.str_to_user(v[0]), v[1]]);
|
||||
});
|
||||
$.jqplot(parent, [vl], {
|
||||
seriesDefaults:{
|
||||
renderer:$.jqplot.BarRenderer,
|
||||
rendererOptions: {fillToZero: true},
|
||||
},
|
||||
axes: {
|
||||
// Use a category axis on the x axis and use our custom ticks.
|
||||
xaxis: {
|
||||
min: 0,
|
||||
renderer: $.jqplot.CategoryAxisRenderer,
|
||||
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
|
||||
tickOptions: {
|
||||
angle: -30,
|
||||
fontSize: '8pt'
|
||||
}
|
||||
},
|
||||
// Pad the y axis just a little so bars can get close to, but
|
||||
// not touch, the grid boundaries. 1.2 is the default padding.
|
||||
yaxis: {
|
||||
min: 0,
|
||||
pad: 1.05,
|
||||
tickOptions: {formatString: '%d'}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
show_settings: function() {
|
||||
var d = new wn.widgets.Dialog({
|
||||
title: 'Set Company Settings',
|
||||
width: 500,
|
||||
fields: [
|
||||
{
|
||||
label:'Company',
|
||||
reqd: 1,
|
||||
fieldname:'company',
|
||||
fieldtype:'Link',
|
||||
options: 'Company'
|
||||
},
|
||||
{
|
||||
label:'Start Date',
|
||||
reqd: 1,
|
||||
fieldname:'start',
|
||||
fieldtype:'Date',
|
||||
},
|
||||
{
|
||||
label:'End Date',
|
||||
reqd: 1,
|
||||
fieldname:'end',
|
||||
fieldtype:'Date',
|
||||
},
|
||||
{
|
||||
label:'Interval',
|
||||
reqd: 1,
|
||||
fieldname:'interval',
|
||||
fieldtype:'Int'
|
||||
},
|
||||
{
|
||||
label:'Regenerate',
|
||||
fieldname:'refresh',
|
||||
fieldtype:'Button'
|
||||
}
|
||||
]
|
||||
});
|
||||
d.onshow = function() {
|
||||
d.set_values(pscript.dashboard_settings);
|
||||
}
|
||||
d.fields_dict.refresh.input.onclick = function() {
|
||||
pscript.dashboard_settings = d.get_values();
|
||||
me.refresh();
|
||||
d.hide();
|
||||
}
|
||||
d.show();
|
||||
}
|
||||
})
|
||||
}
|
||||
220
home/page/dashboard/dashboard.py
Normal file
220
home/page/dashboard/dashboard.py
Normal file
@ -0,0 +1,220 @@
|
||||
dashboards = [
|
||||
{
|
||||
'type': 'account',
|
||||
'account': 'Income',
|
||||
'title': 'Income'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'account',
|
||||
'account': 'Expenses',
|
||||
'title': 'Expenses'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'from_company',
|
||||
'account': 'receivables_group',
|
||||
'title': 'Receivables'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'from_company',
|
||||
'account': 'payables_group',
|
||||
'title': 'Payables'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'cash',
|
||||
'debit_or_credit': 'Debit',
|
||||
'title': 'Cash Inflow'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'cash',
|
||||
'debit_or_credit': 'Credit',
|
||||
'title': 'Cash Outflow'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'creation',
|
||||
'doctype': 'Quotation',
|
||||
'title': 'New Quotations'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'creation',
|
||||
'doctype': 'Sales Order',
|
||||
'title': 'New Orders'
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
class DashboardWidget:
|
||||
def __init__(self, company, start, end, interval):
|
||||
import webnotes
|
||||
from webnotes.utils import getdate
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
self.company = company
|
||||
self.abbr = webnotes.conn.get_value('Company', company, 'abbr')
|
||||
self.start = getdate(start)
|
||||
self.end = getdate(end)
|
||||
|
||||
self.interval = interval
|
||||
self.fiscal_year = webnotes.conn.sql("""
|
||||
select name from `tabFiscal Year`
|
||||
where year_start_date <= %s and
|
||||
DATE_ADD(year_start_date, INTERVAL 1 YEAR) >= %s
|
||||
""", (start, start))[0][0]
|
||||
self.glc = get_obj('GL Control')
|
||||
self.cash_accounts = [d[0] for d in webnotes.conn.sql("""
|
||||
select name from tabAccount
|
||||
where account_type='Bank or Cash'
|
||||
and company = %s and docstatus = 0
|
||||
""", company)]
|
||||
|
||||
def timeline(self):
|
||||
"""
|
||||
get the timeline for the dashboard
|
||||
"""
|
||||
import webnotes
|
||||
from webnotes.utils import add_days
|
||||
tl = []
|
||||
|
||||
if self.start > self.end:
|
||||
webnotes.msgprint("Start must be before end", raise_exception=1)
|
||||
|
||||
curr = self.start
|
||||
tl.append(curr)
|
||||
|
||||
while curr < self.end:
|
||||
curr = add_days(curr, self.interval, 'date')
|
||||
tl.append(curr)
|
||||
|
||||
tl.append(self.end)
|
||||
|
||||
return tl
|
||||
|
||||
def generate(self, opts):
|
||||
"""
|
||||
Generate the dasboard
|
||||
"""
|
||||
tl = self.timeline()
|
||||
self.out = []
|
||||
|
||||
for i in range(len(tl)-1):
|
||||
self.out.append([tl[i+1].strftime('%Y-%m-%d'), self.value(opts, tl[i], tl[i+1]) or 0])
|
||||
|
||||
return self.out
|
||||
|
||||
def get_account_balance(self, acc, start):
|
||||
"""
|
||||
Get as on account balance
|
||||
"""
|
||||
import webnotes
|
||||
# add abbreviation to company
|
||||
|
||||
if not acc.endswith(self.abbr):
|
||||
acc += ' - ' + self.abbr
|
||||
|
||||
# get other reqd parameters
|
||||
try:
|
||||
globals().update(webnotes.conn.sql('select debit_or_credit, lft, rgt from tabAccount where name=%s', acc, as_dict=1)[0])
|
||||
except Exception,e:
|
||||
webnotes.msgprint('Wrongly defined account: ' + acc)
|
||||
print acc
|
||||
raise e
|
||||
|
||||
return self.glc.get_as_on_balance(acc, self.fiscal_year, start, debit_or_credit, lft, rgt)
|
||||
|
||||
def get_creation_trend(self, doctype, start, end):
|
||||
"""
|
||||
Get creation # of creations in period
|
||||
"""
|
||||
import webnotes
|
||||
return int(webnotes.conn.sql("""
|
||||
select count(*) from `tab%s` where creation between %s and %s and docstatus=1
|
||||
""" % (doctype, '%s','%s'), (start, end))[0][0])
|
||||
|
||||
def get_account_amt(self, acc, start, end, debit_or_credit):
|
||||
"""
|
||||
Get debit, credit over a period
|
||||
"""
|
||||
import webnotes
|
||||
# add abbreviation to company
|
||||
|
||||
if not acc.endswith(self.abbr):
|
||||
acc += ' - ' + self.abbr
|
||||
|
||||
ret = webnotes.conn.sql("""
|
||||
select ifnull(sum(ifnull(t1.debit,0)),0), ifnull(sum(ifnull(t1.credit,0)),0)
|
||||
from `tabGL Entry` t1, tabAccount t2
|
||||
where t1.account = t2.name
|
||||
and t2.is_pl_account = 'Yes'
|
||||
and t2.debit_or_credit=%s
|
||||
and ifnull(t1.is_cancelled, 'No')='No'
|
||||
and t1.posting_date between %s and %s
|
||||
""", (debit_or_credit, start, end))[0]
|
||||
|
||||
return debit_or_credit=='Credit' and float(ret[1]-ret[0]) or float(ret[0]-ret[1])
|
||||
|
||||
def value(self, opts, start, end):
|
||||
"""
|
||||
Value of the series on a particular date
|
||||
"""
|
||||
import webnotes
|
||||
if opts['type']=='account':
|
||||
debit_or_credit = 'Debit'
|
||||
if opts['account']=='Income':
|
||||
debit_or_credit = 'Credit'
|
||||
|
||||
return self.get_account_amt(opts['account'], start, end, debit_or_credit)
|
||||
|
||||
elif opts['type']=='from_company':
|
||||
acc = webnotes.conn.get_value('Company', self.company, \
|
||||
opts['account'].split('.')[-1])
|
||||
|
||||
return self.get_account_balance(acc, start)[2]
|
||||
|
||||
elif opts['type']=='cash':
|
||||
if opts['debit_or_credit']=='Credit':
|
||||
return sum([self.get_account_amt(acc, start, end, opts['debit_or_credit']) for acc in self.cash_accounts]) or 0
|
||||
elif opts['debit_or_credit']=='Debit':
|
||||
return sum([self.get_account_amt(acc, start, end, opts['debit_or_credit']) for acc in self.cash_accounts]) or 0
|
||||
|
||||
elif opts['type']=='creation':
|
||||
return self.get_creation_trend(opts['doctype'], start, end)
|
||||
|
||||
|
||||
def load_dashboard(args):
|
||||
"""
|
||||
Get dashboard based on
|
||||
1. Company (default company)
|
||||
2. Start Date (last 3 months)
|
||||
3. End Date (today)
|
||||
4. Interval (7 days)
|
||||
"""
|
||||
dl = []
|
||||
import json
|
||||
args = json.loads(args)
|
||||
dw = DashboardWidget(args['company'], args['start'], args['end'], int(args['interval']))
|
||||
|
||||
# render the dashboards
|
||||
for d in dashboards:
|
||||
dl.append([d, dw.generate(d)])
|
||||
|
||||
return dl
|
||||
|
||||
if __name__=='__main__':
|
||||
import sys
|
||||
sys.path.append('/var/www/webnotes/wnframework/cgi-bin')
|
||||
from webnotes.db import Database
|
||||
import webnotes
|
||||
webnotes.conn = Database(use_default=1)
|
||||
webnotes.session = {'user':'Administrator'}
|
||||
print load_dashboard("""{
|
||||
"company": "My Test",
|
||||
"start": "2011-05-01",
|
||||
"end": "2011-08-01",
|
||||
"interval": "7"
|
||||
}""")
|
||||
49
home/page/dashboard/dashboard.txt
Normal file
49
home/page/dashboard/dashboard.txt
Normal file
@ -0,0 +1,49 @@
|
||||
# Page, dashboard
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-08-25 16:22:44',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-08-25 16:22:54',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'category': 'Standard',
|
||||
'doctype': 'Page',
|
||||
'module': 'Home',
|
||||
'name': '__common__',
|
||||
'page_name': 'Dashboard',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# These values are common for all Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'name': '__common__',
|
||||
'parent': 'dashboard',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Page'
|
||||
},
|
||||
|
||||
# Page, dashboard
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': 'dashboard'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'role': 'Accounts Manager'
|
||||
}
|
||||
]
|
||||
@ -15,3 +15,48 @@ span.home-status-unread {
|
||||
color: #FFF;
|
||||
background-color: RED;
|
||||
}
|
||||
|
||||
div.setup-wizard {
|
||||
display: none;
|
||||
margin: 13px 0px;
|
||||
background-color: #FED;
|
||||
padding: 13px;
|
||||
}
|
||||
|
||||
div.setup-wizard .header {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: #322;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
|
||||
div.setup-wizard .percent-outer {
|
||||
height: 17px;
|
||||
background-color: #FFF;
|
||||
border: 2px solid #322;
|
||||
}
|
||||
|
||||
div.setup-wizard .percent-inner {
|
||||
height: 17px;
|
||||
background-color: GREEN;
|
||||
}
|
||||
|
||||
div.setup-wizard .suggestion {
|
||||
margin: 7px 0px;
|
||||
color: #322;
|
||||
}
|
||||
|
||||
div.setup-wizard .prev-next {
|
||||
height: 13px;
|
||||
}
|
||||
|
||||
div.setup-wizard .prev-next span {
|
||||
display: none;
|
||||
float: right;
|
||||
margin-left: 13px;
|
||||
color: #877;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -24,8 +24,8 @@ pscript.home_make_body = function() {
|
||||
wrapper.head = $a(wrapper.body, 'div');
|
||||
|
||||
wrapper.banner_area = $a(wrapper.head, 'div');
|
||||
wrapper.toolbar_area = $a(wrapper.head, 'div');
|
||||
|
||||
wrapper.setup_wizard_area = $a(wrapper.body, 'div', 'setup-wizard')
|
||||
|
||||
wrapper.system_message_area = $a(wrapper.body, 'div', '',
|
||||
{marginBottom:'16px', padding:'8px', backgroundColor:'#FFD', border:'1px dashed #AA6', display:'none'})
|
||||
@ -612,7 +612,6 @@ pscript.home_make_status = function() {
|
||||
// get values
|
||||
$c_page('home', 'event_updates', 'get_status_details', user,
|
||||
function(r,rt) {
|
||||
|
||||
home_status_bar.render(r.message);
|
||||
|
||||
// system_messages
|
||||
@ -622,6 +621,11 @@ pscript.home_make_status = function() {
|
||||
// render online users
|
||||
pscript.online_users_obj.render(r.message.online_users);
|
||||
pscript.online_users = r.message.online_users;
|
||||
|
||||
// setup wizard
|
||||
if(r.message.setup_status) {
|
||||
new SetupWizard(r.message.setup_status)
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -633,7 +637,7 @@ pscript.show_system_message = function(wrapper, msg) {
|
||||
var txt = $a(wrapper.system_message_area, 'div', '', {lineHeight:'1.6em'});
|
||||
txt.innerHTML = msg;
|
||||
|
||||
var span = $ln($a(wrapper.system_message_area, 'div'), 'Dismiss',
|
||||
var span = $ln($a(wrapper.system_message_area, 'div', '', {textAlign:'right'}), 'Dismiss'.bold(),
|
||||
function(me) {
|
||||
me.set_working();
|
||||
$c_obj('Home Control', 'dismiss_message', '', function(r,rt) {
|
||||
@ -729,3 +733,53 @@ pscript.validate_fields = function(d)
|
||||
if(!flag) alert(msg);
|
||||
return flag;
|
||||
}
|
||||
|
||||
SetupWizard = function(status) {
|
||||
var me = this;
|
||||
$.extend(this, {
|
||||
make: function(status) {
|
||||
me.status = status;
|
||||
me.wrapper = page_body.pages['Event Updates'].setup_wizard_area;
|
||||
$ds(me.wrapper);
|
||||
me.make_percent(status.percent);
|
||||
me.make_suggestion(status.ret);
|
||||
},
|
||||
make_percent: function(percent) {
|
||||
$a(me.wrapper, 'div', 'header', {}, 'Your setup is '+percent+'% complete');
|
||||
var o = $a(me.wrapper, 'div', 'percent-outer');
|
||||
$a(o, 'div', 'percent-inner', {width:percent + '%'});
|
||||
},
|
||||
make_suggestion: function(ret) {
|
||||
me.suggest_area = $a(me.wrapper, 'div', 'suggestion');
|
||||
if(me.status.ret.length>1) {
|
||||
me.prev_next = $a(me.wrapper, 'div', 'prev-next');
|
||||
|
||||
// next
|
||||
me.next = $a(me.prev_next, 'span', 'link_type', null, 'Next Suggestion',
|
||||
function() { me.show_suggestion(me.cur_sugg+1) });
|
||||
|
||||
// prev
|
||||
me.prev = $a(me.prev_next, 'span', 'link_type', null, 'Previous Suggestion',
|
||||
function() { me.show_suggestion(me.cur_sugg-1) });
|
||||
|
||||
}
|
||||
if(me.status.ret.length) {
|
||||
me.show_suggestion(0);
|
||||
} else {
|
||||
me.suggest_area.innerHTML = 'Congratulations: '.bold() + 'You are now on your track... Good luck';
|
||||
}
|
||||
},
|
||||
show_suggestion: function(idx) {
|
||||
me.cur_sugg = idx;
|
||||
me.suggest_area.innerHTML = 'What you can do next: '.bold() + me.status.ret[idx];
|
||||
|
||||
// show hide prev, next
|
||||
if(me.status.ret.length>1) {
|
||||
$dh(me.prev); $dh(me.next);
|
||||
if(idx>0) $ds(me.prev);
|
||||
if(idx<me.status.ret.length-1) $ds(me.next);
|
||||
}
|
||||
}
|
||||
})
|
||||
this.make(status);
|
||||
}
|
||||
|
||||
@ -35,11 +35,53 @@ def get_status_details(arg=None):
|
||||
if msg_id and msg_id != webnotes.conn.get_global('system_message_id', webnotes.session['user']):
|
||||
msg = webnotes.conn.get_global('system_message')
|
||||
|
||||
return {
|
||||
ret = {
|
||||
'user_count': len(online) or 0,
|
||||
'unread_messages': get_unread_messages(),
|
||||
'online_users': online or [],
|
||||
'system_message':msg,
|
||||
'is_trial': webnotes.conn.get_global('is_trial'),
|
||||
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0')
|
||||
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0'),
|
||||
'setup_status': get_setup_status()
|
||||
}
|
||||
return ret
|
||||
|
||||
def get_setup_status():
|
||||
"""
|
||||
Returns the setup status of the current account
|
||||
"""
|
||||
if cint(webnotes.conn.get_global('setup_done')):
|
||||
return ''
|
||||
|
||||
percent = 20
|
||||
ret = []
|
||||
|
||||
header = webnotes.conn.get_value('Control Panel', None, 'client_name') or ''
|
||||
if header.startswith('<div style="padding:4px; font-size:20px;">'\
|
||||
+webnotes.conn.get_value('Control Panel', None, 'company_name')):
|
||||
ret.append('<a href="#!Form/Personalize/Personalize">Upload your company banner</a>')
|
||||
else:
|
||||
percent += 20
|
||||
|
||||
def check_type(doctype, ret, percent):
|
||||
if not webnotes.conn.sql("select count(*) from tab%s" % doctype)[0][0]:
|
||||
ret.append('''
|
||||
<a href="#!Form/%(dt)s/New">
|
||||
Create a new %(dt)s
|
||||
</a> or
|
||||
<a href="#!Import Data/%(dt)s">
|
||||
Import from a spreadsheet</a>''' % {'dt':doctype})
|
||||
else:
|
||||
percent += 20
|
||||
return ret, percent
|
||||
|
||||
ret, percent = check_type('Item', ret, percent)
|
||||
ret, percent = check_type('Customer', ret, percent)
|
||||
ret, percent = check_type('Supplier', ret, percent)
|
||||
|
||||
if percent==100:
|
||||
webnotes.conn.set_global('setup_done', '1')
|
||||
return ''
|
||||
|
||||
return {'ret': ret, 'percent': percent}
|
||||
|
||||
@ -134,24 +134,28 @@ MemberList.prototype.make_search = function() {
|
||||
MemberList.prototype.make_list = function() {
|
||||
var me = this;
|
||||
this.lst_area = $a(this.list_wrapper, 'div');
|
||||
this.lst = new Listing('Profiles',1);
|
||||
this.lst.colwidths = ['100%'];
|
||||
this.lst.opts.cell_style = {padding:'0px'}
|
||||
this.lst.get_query = function() {
|
||||
|
||||
this.lst = new wn.widgets.Listing({
|
||||
parent: this.lst_area,
|
||||
as_dict: 1,
|
||||
get_query: function() {
|
||||
var c1 = '';
|
||||
if(me.search_inp.value && me.search_inp.value != 'Search') {
|
||||
var c1 = repl(' AND (first_name LIKE "%(txt)s" OR last_name LIKE "%(txt)s" OR name LIKE "%(txt)s")', {txt:'%' + me.search_inp.value + '%'});
|
||||
}
|
||||
|
||||
this.query = repl("SELECT distinct ifnull(name,''), ifnull(concat_ws(' ', first_name, last_name),''), \
|
||||
ifnull(messanger_status,''), ifnull(gender,''), ifnull(file_list,''), 0, enabled, last_login \
|
||||
from tabProfile where docstatus != 2 AND name not in ('Guest','Administrator') %(cond)s \
|
||||
return repl("SELECT name, \
|
||||
ifnull(concat_ws(' ', first_name, last_name),'') as full_name, \
|
||||
gender, file_list, enabled \
|
||||
FROM tabProfile \
|
||||
WHERE docstatus != 2 \
|
||||
AND name not in ('Guest','Administrator') %(cond)s \
|
||||
ORDER BY name asc",{cond:c1});
|
||||
},
|
||||
render_row: function(parent, data) {
|
||||
me.member_items[data.name] = new MemberItem(parent, data, me);
|
||||
}
|
||||
this.lst.make(this.lst_area);
|
||||
this.lst.show_cell= function(cell, ri, ci, d) {
|
||||
me.member_items[d[ri][0]] = new MemberItem(cell, d[ri], me);
|
||||
}
|
||||
});
|
||||
this.lst.run();
|
||||
}
|
||||
|
||||
@ -186,14 +190,14 @@ MemberItem = function(parent, det, mlist) {
|
||||
var me = this;
|
||||
this.det = det;
|
||||
this.wrapper = $a(parent, 'div');
|
||||
this.enabled = det[6];
|
||||
this.enabled = det.enabled;
|
||||
|
||||
this.tab = make_table(this.wrapper, 1,2,'100%', ['20%', '70%'], {padding:'4px', overflow:'hidden'});
|
||||
$y(this.tab, {tableLayout:'fixed', borderCollapse:'collapse'})
|
||||
|
||||
this.is_online = function() {
|
||||
for(var i=0;i<pscript.online_users.length;i++) {
|
||||
if(det[0]==pscript.online_users[i][0]) return true;
|
||||
if(det.name==pscript.online_users[i][0]) return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,30 +214,30 @@ MemberItem = function(parent, det, mlist) {
|
||||
this.set_image = function() {
|
||||
// image
|
||||
this.img = $a($td(this.tab,0,0),'img','',{width:'41px'});
|
||||
set_user_img(this.img, det[0], null,
|
||||
(det[4] ? det[4].split(NEWLINE)[0].split(',')[1] : ('no_img_' + (det[3]=='Female' ? 'f' : 'm'))));
|
||||
set_user_img(this.img, det.name, null,
|
||||
(det.file_list ? det.file_list.split(NEWLINE)[0].split(',')[1] : ('no_img_' + (det.gender=='Female' ? 'f' : 'm'))));
|
||||
}
|
||||
|
||||
// set other details like email id, name etc
|
||||
this.set_details = function() {
|
||||
// name
|
||||
this.fullname = det[1] ? det[1] : det[0];
|
||||
this.fullname = det.full_name || det.name;
|
||||
var div = $a($td(this.tab, 0, 1), 'div', '', {fontWeight: 'bold',padding:'2px 0px'});
|
||||
this.name_link = $a(div,'span','link_type');
|
||||
this.name_link.innerHTML = crop(this.fullname, 15);
|
||||
this.name_link.onclick = function() {
|
||||
mlist.show_profile(me.det[0], me);
|
||||
mlist.show_profile(me.det.name, me);
|
||||
}
|
||||
|
||||
// "you" tag
|
||||
if(user==det[0]) {
|
||||
if(user==det.name) {
|
||||
var span = $a(div,'span','',{padding:'2px' ,marginLeft:'3px'});
|
||||
span.innerHTML = '(You)'
|
||||
}
|
||||
|
||||
// email id
|
||||
var div = $a($td(this.tab, 0, 1), 'div', '', {color: '#777', fontSize:'11px'});
|
||||
div.innerHTML = det[0];
|
||||
div.innerHTML = det.name;
|
||||
|
||||
// working img
|
||||
var div = $a($td(this.tab, 0, 1), 'div');
|
||||
@ -256,7 +260,7 @@ MemberItem = function(parent, det, mlist) {
|
||||
this.set_details();
|
||||
|
||||
// show initial
|
||||
if(user==det[0]) me.name_link.onclick();
|
||||
if(user==det.name) me.name_link.onclick();
|
||||
}
|
||||
|
||||
|
||||
@ -305,6 +309,7 @@ MemberProfile = function(parent, uid, member_item) {
|
||||
if(has_common(['Administrator','System Manager'],user_roles)) {
|
||||
var roles_btn = $btn(this.toolbar_area, 'Set Roles', function() { me.show_roles() },{marginRight:'3px'});
|
||||
var delete_btn = $btn(this.toolbar_area, 'Delete User', function() { me.delete_user(); },{marginRight:'3px'});
|
||||
var ip_btn = $btn(this.toolbar_area, 'Securty Settings', function() { me.set_security(); },{marginRight:'3px'});
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,6 +320,74 @@ MemberProfile = function(parent, uid, member_item) {
|
||||
this.role_object.dialog.show();
|
||||
}
|
||||
|
||||
// show securty settings
|
||||
this.set_security = function() {
|
||||
var d = new wn.widgets.Dialog({
|
||||
title: 'Set User Security',
|
||||
width: 500,
|
||||
fields: [
|
||||
{
|
||||
label:'IP Address',
|
||||
description: 'Restrict user login by IP address, partial ips (111.111.111), \
|
||||
multiple addresses (separated by commas) allowed',
|
||||
fieldname:'restrict_ip',
|
||||
fieldtype:'Data'
|
||||
},
|
||||
|
||||
{
|
||||
label:'Login After',
|
||||
description: 'User can only login after this hour (0-24)',
|
||||
fieldtype: 'Int',
|
||||
fieldname: 'login_after'
|
||||
},
|
||||
|
||||
{
|
||||
label:'Login Before',
|
||||
description: 'User can only login before this hour (0-24)',
|
||||
fieldtype: 'Int',
|
||||
fieldname: 'login_before'
|
||||
},
|
||||
|
||||
{
|
||||
label:'New Password',
|
||||
description: 'Update the current user password',
|
||||
fieldtype: 'Data',
|
||||
fieldname: 'new_password'
|
||||
},
|
||||
|
||||
{
|
||||
label:'Update',
|
||||
fieldtype:'Button',
|
||||
fieldname:'update'
|
||||
}
|
||||
]
|
||||
});
|
||||
d.onshow = function() {
|
||||
d.set_values({
|
||||
restrict_ip: me.profile.restrict_ip || '',
|
||||
login_before: me.profile.login_before || '',
|
||||
login_after: me.profile.login_after || '',
|
||||
new_password: ''
|
||||
})
|
||||
}
|
||||
d.fields_dict.update.input.onclick = function() {
|
||||
var btn = this;
|
||||
this.set_working();
|
||||
var args = d.get_values();
|
||||
args.user = me.profile.name;
|
||||
$c_page('home', 'my_company', 'update_security', JSON.stringify(args), function(r,rt) {
|
||||
if(r.exc) {
|
||||
msgprint(r.exc);
|
||||
btn.done_working();
|
||||
return;
|
||||
}
|
||||
$.extend(me.profile, d.get_values());
|
||||
d.hide();
|
||||
});
|
||||
}
|
||||
d.show();
|
||||
}
|
||||
|
||||
// delete user
|
||||
// create a confirm dialog and call server method
|
||||
this.delete_user = function() {
|
||||
@ -534,6 +607,7 @@ MemberConversation = function(parent, uid, fullname) {
|
||||
|
||||
this.lst = new wn.widgets.Listing({
|
||||
parent: this.lst_area,
|
||||
as_dict: 1,
|
||||
no_result_message: (user==uid
|
||||
? 'No messages by anyone yet'
|
||||
: 'No messages yet. To start a conversation post a new message'),
|
||||
@ -577,18 +651,18 @@ MemberCoversationComment = function(cell, det, conv) {
|
||||
this.wrapper = $a(cell, 'div', 'my-company-comment-wrapper');
|
||||
this.comment = $a(this.wrapper, 'div', 'my-company-comment');
|
||||
|
||||
this.user = $a(this.comment, 'span', 'link_type', {fontWeight:'bold'}, pscript.get_fullname(det[1]));
|
||||
this.user = $a(this.comment, 'span', 'link_type', {fontWeight:'bold'}, pscript.get_fullname(det.owner));
|
||||
this.user.onclick = function() {
|
||||
page_body.pages['My Company'].member_list.show_profile(me.det[1]);
|
||||
page_body.pages['My Company'].member_list.show_profile(me.det.owner);
|
||||
}
|
||||
|
||||
var st = (!det[4] ? {fontWeight: 'bold'} : null);
|
||||
this.msg = $a(this.comment, 'span', 'social', st, ': ' + det[0]);
|
||||
var st = (!det.docstatus ? {fontWeight: 'bold'} : null);
|
||||
this.msg = $a(this.comment, 'span', 'social', st, ': ' + det.creation);
|
||||
|
||||
if(det[1]==user) {
|
||||
if(det.full_name==user) {
|
||||
$y(this.wrapper, {backgroundColor: '#D9D9F3'});
|
||||
}
|
||||
this.timestamp = $a(this.wrapper, 'div', 'my-company-timestamp', '', comment_when(det[3]));
|
||||
this.timestamp = $a(this.wrapper, 'div', 'my-company-timestamp', '', comment_when(det.creation));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -129,3 +129,19 @@ def set_read_all_messages(arg=''):
|
||||
WHERE comment_doctype = 'My Company'
|
||||
AND comment_docname = %s
|
||||
""", webnotes.user.name)
|
||||
|
||||
def update_security(args=''):
|
||||
import json
|
||||
args = json.loads(args)
|
||||
webnotes.conn.set_value('Profile', args['user'], 'restrict_ip', args.get('restrict_ip'))
|
||||
webnotes.conn.set_value('Profile', args['user'], 'login_after', args.get('login_after'))
|
||||
webnotes.conn.set_value('Profile', args['user'], 'login_before', args.get('login_before'))
|
||||
|
||||
if 'new_password' in args:
|
||||
if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
|
||||
import server_tools.gateway_utils
|
||||
webnotes.msgprint(server_tools.gateway_utils.change_password('', args['new_password'])['message'])
|
||||
else:
|
||||
webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s", (args['new_password'], args['user']))
|
||||
|
||||
webnotes.msgprint('Settings Updated')
|
||||
@ -17,7 +17,7 @@ def change_password(arg):
|
||||
webnotes.msgprint('Old password is not correct', raise_exception=1)
|
||||
|
||||
from webnotes.utils import nowdate
|
||||
webnotes.conn.sql("update tabProfile set password=password(%s), password_last_updated=%s where name=%s",(arg['new_password'], nowdate(), webnotes.session['user']))
|
||||
webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s",(arg['new_password'], nowdate(), webnotes.session['user']))
|
||||
webnotes.msgprint('Password Updated');
|
||||
|
||||
def get_user_details(arg=None):
|
||||
|
||||
@ -1,603 +1,318 @@
|
||||
# Module Def, HR
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'_last_update': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'disabled': 'No',
|
||||
'creation': '2011-07-01 17:41:43',
|
||||
'docstatus': 0,
|
||||
'doctype': u'Module Def',
|
||||
'doctype_list': None,
|
||||
'file_list': None,
|
||||
'idx': None,
|
||||
'is_hidden': 'No',
|
||||
'last_updated_date': None,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified': '2011-08-25 13:54:43',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'name': '__common__',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def Item
|
||||
{
|
||||
'doctype': 'Module Def Item',
|
||||
'name': '__common__',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def
|
||||
{
|
||||
'disabled': 'No',
|
||||
'doctype': u'Module Def',
|
||||
'is_hidden': 'No',
|
||||
'module_desc': 'Human Resource Management - Employee Database, Salaries etc.',
|
||||
'module_icon': 'HR.gif',
|
||||
'module_label': 'HR',
|
||||
'module_name': 'HR',
|
||||
'module_page': None,
|
||||
'module_seq': 9,
|
||||
'name': 'HR',
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'trash_reason': None,
|
||||
'widget_code': None
|
||||
'name': '__common__'
|
||||
},
|
||||
|
||||
# Module Def, HR
|
||||
{
|
||||
'doctype': u'Module Def',
|
||||
'name': 'HR'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Your Employee Database',
|
||||
'display_name': 'Employee',
|
||||
'doc_name': 'Employee',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'employee_name\nemployment_type\nstatus\nbranch\ndesignation\ndepartment\ngrade\nreports_to',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01335',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 1
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Employees Daily Attendance Tracking Form',
|
||||
'display_name': 'Attendance',
|
||||
'doc_name': 'Attendance',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'employee\nemployee_name\nstatus\natt_date\nfiscal_year\ncompany',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01336',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 2
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Upload Attendance data',
|
||||
'display_name': 'Attendance Control Panel',
|
||||
'doc_name': 'Attendance Control Panel',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01337',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 3
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Leave allocation for selected employees at a time',
|
||||
'display_name': 'Leave Control Panel',
|
||||
'doc_name': 'Leave Control Panel',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01338',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 4
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Allocate leave for fiscal year',
|
||||
'display_name': 'Leave Allocation',
|
||||
'doc_name': 'Leave Allocation',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'employee\nleave_type\nfiscal_year\ntotal_leaves_allocated\nposting_date',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01339',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 5
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Apply Leave',
|
||||
'display_name': 'Leave Application',
|
||||
'doc_name': 'Leave Application',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'employee\nleave_type\nfiscal_year\nfrom_date\nto_date\ntotal_leave_days',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01340',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 6
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Submit Employees Expenses',
|
||||
'display_name': 'Expense Voucher',
|
||||
'doc_name': 'Expense Voucher',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\nemployee\nemployee_name\nposting_date\ntotal_claimed_amount\ntotal_sanctioned_amount\nexp_approver',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01341',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 7
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Assign Responsibilities to employee and evaluate',
|
||||
'display_name': 'Appraisal',
|
||||
'doc_name': 'Appraisal',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\nemployee\nemployee_name\nstart_date\nend_date\ntotal_score\nkra_approver',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01342',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 8
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Generate Salary Structure heads for an employee',
|
||||
'display_name': 'Salary Structure',
|
||||
'doc_name': 'Salary Structure',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'employee\nis_active\nfiscal_year\nfrom_date\nctc\ntotal_earning\ntotal_deduction\ntotal',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 9,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01343',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 9
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Generate Salary Slip for an employee',
|
||||
'display_name': 'Salary Slip',
|
||||
'doc_name': 'Salary Slip',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'month\nyear\nemployee\nemployee_name\npayment_days\narrear_amount\nencashment_amount\ngross_pay\ntotal_deduction\nnet_pay',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 10,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01344',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 10
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Generate Salary Slip for all employee at a time',
|
||||
'display_name': 'Salary Slip Control Panel',
|
||||
'doc_name': 'Salary Slip Control Panel',
|
||||
'description': 'Generate Salary Slip for multiple employee at a time based on selected criteria',
|
||||
'display_name': 'Salary Manager',
|
||||
'doc_name': 'Salary Manager',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 11,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01345',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 11
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': 'Job Applications received for various positions',
|
||||
'display_name': 'Job Application',
|
||||
'doc_name': 'Job Application',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'applicant_name\nemail\nposition',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 12,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01346',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 12
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': None,
|
||||
'display_name': 'Employee Information',
|
||||
'doc_name': 'Employee',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 13,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01347',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 13
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': None,
|
||||
'display_name': "Employee's Birthday",
|
||||
'doc_name': 'Employee',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 14,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01348',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 14
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': None,
|
||||
'display_name': 'New or left employees for a month',
|
||||
'doc_name': 'Employee',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 15,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01349',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 15
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': None,
|
||||
'display_name': 'Monthly Attendance Details',
|
||||
'doc_name': 'Attendance',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 16,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01350',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 16
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:33',
|
||||
'description': None,
|
||||
'display_name': 'Leave Application Details',
|
||||
'doc_name': 'Leave Application',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 17,
|
||||
'modified': '2011-06-30 15:51:33',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01351',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 17
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Leave Allocation Details',
|
||||
'doc_name': 'Leave Allocation',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 18,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01352',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 18
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Employee Leave Balance Report',
|
||||
'doc_name': 'Employee',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 19,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01353',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 19
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Salary Structure Details',
|
||||
'doc_name': 'Salary Structure',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 20,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01354',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 20
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Salary Register',
|
||||
'doc_name': 'Salary Slip',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 21,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01355',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 21
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Salary Slips',
|
||||
'doc_name': 'Salary Slip',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 22,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01356',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 22
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Pending Appraisals',
|
||||
'doc_name': 'Appraisal',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 23,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01357',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 23
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Employee Appraisals',
|
||||
'doc_name': 'Appraisal',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 24,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01358',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 24
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Pending Expense Vouchers',
|
||||
'doc_name': 'Expense Voucher',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 25,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01359',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 25
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'description': None,
|
||||
'display_name': 'Expense Vouchers',
|
||||
'doc_name': 'Expense Voucher',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 26,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01360',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
'idx': 26
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 1,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00340',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'HR Manager'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'creation': '2011-06-30 15:51:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 2,
|
||||
'modified': '2011-06-30 15:51:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00341',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'HR',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'HR User'
|
||||
}
|
||||
]
|
||||
@ -26,7 +26,7 @@ class DocType:
|
||||
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
|
||||
emp_nm= emp_nm and emp_nm[0][0] or ''
|
||||
self.doc.employee_name = emp_nm
|
||||
return cstr(emp_nm)
|
||||
return emp_nm
|
||||
|
||||
def fetch_kra(self):
|
||||
if not self.doc.kra_template:
|
||||
@ -88,7 +88,7 @@ class DocType:
|
||||
if d.score:
|
||||
total = total + flt(d.score_earned)
|
||||
ret={'total_score':flt(total)}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def declare_completed(self):
|
||||
ret={}
|
||||
|
||||
@ -34,7 +34,7 @@ class DocType:
|
||||
set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
|
||||
|
||||
ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''}
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
#validation for duplicate record
|
||||
def validate_duplicate_record(self):
|
||||
|
||||
@ -41,7 +41,7 @@ class DocType:
|
||||
if self.doc.date_of_birth:
|
||||
dt = getdate(self.doc.date_of_birth) + datetime.timedelta(21915)
|
||||
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
# check if salary structure exists
|
||||
#========================================================================================================
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-02-17 11:16:08',
|
||||
'creation': '2010-08-08 17:08:59',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-06-27 14:39:04',
|
||||
'modified': '2011-08-11 17:27:12',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
@ -26,7 +26,7 @@
|
||||
'show_in_menu': 0,
|
||||
'subject': '%(employee_name)s',
|
||||
'tag_fields': 'status',
|
||||
'version': 443
|
||||
'version': 444
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -40,12 +40,14 @@
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Employee',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
'read': 1,
|
||||
'submit': 0
|
||||
},
|
||||
|
||||
# DocType, Employee
|
||||
@ -56,21 +58,24 @@
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'write': 1
|
||||
'role': 'Employee',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'role': 'All'
|
||||
'role': 'All',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
@ -95,22 +100,6 @@
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 1,
|
||||
'role': 'HR User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 1,
|
||||
'role': 'HR Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
@ -141,7 +130,7 @@
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'naming_series',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'WN-EMP\nEMP/',
|
||||
'options': 'EMP/',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
@ -173,8 +162,7 @@
|
||||
'oldfieldname': 'employee_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -276,7 +264,7 @@
|
||||
'options': '\nActive\nLeft',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -409,8 +397,7 @@
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Department',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -474,21 +461,11 @@
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_sales_person',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 27,
|
||||
'label': 'Is Sales Person',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 28,
|
||||
'idx': 27,
|
||||
'label': 'Salary Information',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0,
|
||||
@ -501,11 +478,11 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'salary_mode',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 29,
|
||||
'idx': 28,
|
||||
'label': 'Salary Mode',
|
||||
'oldfieldname': 'salary_mode',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nBank\nCash \nCheque',
|
||||
'options': '\nBank\nCash\nCheque',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
@ -518,7 +495,7 @@
|
||||
'fieldname': 'bank_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 30,
|
||||
'idx': 29,
|
||||
'in_filter': 1,
|
||||
'label': 'Bank Name',
|
||||
'oldfieldname': 'bank_name',
|
||||
@ -535,7 +512,7 @@
|
||||
'fieldname': 'bank_ac_no',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 31,
|
||||
'idx': 30,
|
||||
'label': 'Bank A/C No.',
|
||||
'oldfieldname': 'bank_ac_no',
|
||||
'oldfieldtype': 'Data',
|
||||
@ -547,7 +524,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'esic_card_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 32,
|
||||
'idx': 31,
|
||||
'label': 'ESIC CARD No',
|
||||
'oldfieldname': 'esic_card_no',
|
||||
'oldfieldtype': 'Data',
|
||||
@ -559,7 +536,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'pf_number',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 33,
|
||||
'idx': 32,
|
||||
'label': 'PF Number',
|
||||
'oldfieldname': 'pf_number',
|
||||
'oldfieldtype': 'Data',
|
||||
@ -571,7 +548,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'gratuity_lic_id',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 34,
|
||||
'idx': 33,
|
||||
'label': 'Gratuity LIC ID',
|
||||
'oldfieldname': 'gratuity_lic_id',
|
||||
'oldfieldtype': 'Data',
|
||||
@ -582,7 +559,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 35,
|
||||
'idx': 34,
|
||||
'label': 'Contact Details',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -591,7 +568,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 36,
|
||||
'idx': 35,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
@ -601,7 +578,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cell_number',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 37,
|
||||
'idx': 36,
|
||||
'label': 'Cell Number',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -611,7 +588,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'personal_email',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 38,
|
||||
'idx': 37,
|
||||
'label': 'Personal Email',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -621,7 +598,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'notice_number_of_days',
|
||||
'fieldtype': 'Int',
|
||||
'idx': 39,
|
||||
'idx': 38,
|
||||
'label': 'Notice - Number of Days',
|
||||
'oldfieldname': 'notice_number_of_days',
|
||||
'oldfieldtype': 'Int',
|
||||
@ -632,7 +609,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 40,
|
||||
'idx': 39,
|
||||
'label': 'Emergency Contact Details',
|
||||
'options': '<b>Emergency Contact Details</b>',
|
||||
'permlevel': 0
|
||||
@ -643,7 +620,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'person_to_be_contacted',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 41,
|
||||
'idx': 40,
|
||||
'label': 'Person To Be Contacted',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -653,7 +630,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'relation',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 42,
|
||||
'idx': 41,
|
||||
'label': 'Relation',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -663,7 +640,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'emergency_phone_number',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 43,
|
||||
'idx': 42,
|
||||
'label': 'Emergency Phone Number',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -672,7 +649,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 44,
|
||||
'idx': 43,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
@ -682,7 +659,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'permanent_accommodation_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 45,
|
||||
'idx': 44,
|
||||
'label': 'Permanent Accommodation Type',
|
||||
'options': '\nRented\nOwned',
|
||||
'permlevel': 0
|
||||
@ -693,7 +670,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'permanent_address',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 46,
|
||||
'idx': 45,
|
||||
'label': 'Permanent Address',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -703,7 +680,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'current_accommodation_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 47,
|
||||
'idx': 46,
|
||||
'label': 'Current Accommodation Type',
|
||||
'options': '\nRented\nOwned',
|
||||
'permlevel': 0
|
||||
@ -714,7 +691,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'current_address',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 48,
|
||||
'idx': 47,
|
||||
'label': 'Current Address',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -723,7 +700,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 49,
|
||||
'idx': 48,
|
||||
'label': 'Personal Details',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -732,7 +709,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 50,
|
||||
'idx': 49,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
@ -742,7 +719,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'pan_number',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 51,
|
||||
'idx': 50,
|
||||
'label': 'PAN Number',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -752,7 +729,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'passport_number',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 52,
|
||||
'idx': 51,
|
||||
'label': 'Passport Number',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -763,7 +740,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'hidden': 1,
|
||||
'idx': 53,
|
||||
'idx': 52,
|
||||
'label': 'Employee Profile',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
@ -775,7 +752,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'date_of_issue',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 54,
|
||||
'idx': 53,
|
||||
'label': 'Date of Issue',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -785,7 +762,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'valid_upto',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 55,
|
||||
'idx': 54,
|
||||
'label': 'Valid Upto',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -796,7 +773,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'hidden': 1,
|
||||
'idx': 56,
|
||||
'idx': 55,
|
||||
'label': 'Salary Structure',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
@ -808,7 +785,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'place_of_issue',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 57,
|
||||
'idx': 56,
|
||||
'label': 'Place of Issue',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -818,7 +795,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'marital_status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 58,
|
||||
'idx': 57,
|
||||
'label': 'Marital Status',
|
||||
'options': '\nSingle\nMarried\nDivorced\nWidowed',
|
||||
'permlevel': 0
|
||||
@ -829,7 +806,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'blood_group',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 59,
|
||||
'idx': 58,
|
||||
'label': 'Blood Group',
|
||||
'options': '\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-',
|
||||
'permlevel': 0
|
||||
@ -839,7 +816,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 60,
|
||||
'idx': 59,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
@ -851,7 +828,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'family_background',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 61,
|
||||
'idx': 60,
|
||||
'label': 'Family Background',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -863,7 +840,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'health_details',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 62,
|
||||
'idx': 61,
|
||||
'label': 'Health Details',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -872,7 +849,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 63,
|
||||
'idx': 62,
|
||||
'label': 'Educational Qualification',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -882,7 +859,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'educational_qualification_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 64,
|
||||
'idx': 63,
|
||||
'label': 'Educational Qualification Details',
|
||||
'options': 'Educational Qualifications Detail',
|
||||
'permlevel': 0
|
||||
@ -892,7 +869,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 65,
|
||||
'idx': 64,
|
||||
'label': 'Career History',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -901,7 +878,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 66,
|
||||
'idx': 65,
|
||||
'label': 'Previous Work Experience',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
@ -912,7 +889,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'previous_experience_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 67,
|
||||
'idx': 66,
|
||||
'label': 'Previous Experience Details',
|
||||
'options': 'Previous Experience Detail',
|
||||
'permlevel': 0
|
||||
@ -922,7 +899,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 68,
|
||||
'idx': 67,
|
||||
'label': 'History In Company',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
@ -933,7 +910,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'experience_in_company_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 69,
|
||||
'idx': 68,
|
||||
'label': 'Experience In Company Details',
|
||||
'options': 'Experience In Company Detail',
|
||||
'permlevel': 0
|
||||
@ -943,7 +920,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 70,
|
||||
'idx': 69,
|
||||
'label': 'Exit',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
@ -953,7 +930,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 71,
|
||||
'idx': 70,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
@ -963,7 +940,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'resignation_letter_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 72,
|
||||
'idx': 71,
|
||||
'label': 'Resignation Letter Date',
|
||||
'oldfieldname': 'resignation_letter_date',
|
||||
'oldfieldtype': 'Date',
|
||||
@ -975,7 +952,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'relieving_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 73,
|
||||
'idx': 72,
|
||||
'in_filter': 1,
|
||||
'label': 'Relieving Date',
|
||||
'oldfieldname': 'relieving_date',
|
||||
@ -988,7 +965,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reason_for_leaving',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 74,
|
||||
'idx': 73,
|
||||
'label': 'Reason for Leaving',
|
||||
'oldfieldname': 'reason_for_leaving',
|
||||
'oldfieldtype': 'Data',
|
||||
@ -1000,7 +977,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'leave_encashed',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 75,
|
||||
'idx': 74,
|
||||
'label': 'Leave Encashed?',
|
||||
'oldfieldname': 'leave_encashed',
|
||||
'oldfieldtype': 'Select',
|
||||
@ -1013,7 +990,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'encashment_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 76,
|
||||
'idx': 75,
|
||||
'label': 'Encashment Date',
|
||||
'oldfieldname': 'encashment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
@ -1024,7 +1001,7 @@
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 77,
|
||||
'idx': 76,
|
||||
'label': 'Exit Interview Details',
|
||||
'oldfieldname': 'col_brk6',
|
||||
'oldfieldtype': 'Column Break',
|
||||
@ -1037,7 +1014,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'held_on',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 78,
|
||||
'idx': 77,
|
||||
'label': 'Held On',
|
||||
'oldfieldname': 'held_on',
|
||||
'oldfieldtype': 'Date',
|
||||
@ -1049,7 +1026,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reason_for_resignation',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 79,
|
||||
'idx': 78,
|
||||
'label': 'Reason for Resignation',
|
||||
'oldfieldname': 'reason_for_resignation',
|
||||
'oldfieldtype': 'Select',
|
||||
@ -1062,7 +1039,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'new_workplace',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 80,
|
||||
'idx': 79,
|
||||
'label': 'New Workplace',
|
||||
'oldfieldname': 'new_workplace',
|
||||
'oldfieldtype': 'Data',
|
||||
@ -1074,7 +1051,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'feedback',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 81,
|
||||
'idx': 80,
|
||||
'label': 'Feedback',
|
||||
'oldfieldname': 'feedback',
|
||||
'oldfieldtype': 'Text',
|
||||
@ -1087,7 +1064,7 @@
|
||||
'fieldname': 'file_list',
|
||||
'fieldtype': 'Text',
|
||||
'hidden': 1,
|
||||
'idx': 82,
|
||||
'idx': 81,
|
||||
'label': 'File List',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
@ -1098,7 +1075,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 83,
|
||||
'idx': 82,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
|
||||
@ -66,7 +66,7 @@ class DocType:
|
||||
'carry_forwarded_leaves' : prev_bal,
|
||||
'total_leaves_allocated' : flt(prev_bal) + flt(self.doc.new_leaves_allocated)
|
||||
}
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# ********************************************** validate *****************************************************
|
||||
@ -75,7 +75,7 @@ class DocType:
|
||||
# get total allocated leaves
|
||||
# ---------------------------
|
||||
def get_total_allocated_leaves(self):
|
||||
leave_det = eval(self.get_carry_forwarded_leaves())
|
||||
leave_det = self.get_carry_forwarded_leaves()
|
||||
set(self.doc,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves']))
|
||||
set(self.doc,'total_leaves_allocated',flt(leave_det['total_leaves_allocated']))
|
||||
|
||||
|
||||
@ -52,11 +52,8 @@ cur_frm.cscript.from_date = function(doc, dt, dn) {
|
||||
// to date
|
||||
// --------
|
||||
cur_frm.cscript.to_date = function(doc, dt, dn) {
|
||||
if(cint(doc.half_day) == 1 && doc.from_date && doc.from_date != doc.to_date){
|
||||
if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
|
||||
msgprint("To Date should be same as From Date for Half Day leave");
|
||||
return;
|
||||
}
|
||||
if(cint(doc.half_day) == 1){
|
||||
set_multiple(dt,dn,{to_date:doc.from_date});
|
||||
}
|
||||
calculate_total_days(doc, dt, dn);
|
||||
|
||||
@ -33,7 +33,7 @@ class DocType:
|
||||
leave_app = sql("select total_leave_days from `tabLeave Application` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, self.doc.fiscal_year))
|
||||
leave_app = leave_app and flt(leave_app[0][0]) or 0
|
||||
ret = {'leave_balance':leave_all - leave_app}
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# ************************************************ utilities *************************************************
|
||||
@ -55,7 +55,7 @@ class DocType:
|
||||
tot_days = date_diff(self.doc.to_date, self.doc.from_date) + 1
|
||||
holidays = self.get_holidays()
|
||||
ret = {'total_leave_days':flt(tot_days)-flt(holidays)}
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# ************************************************ validate *************************************************
|
||||
@ -82,7 +82,7 @@ class DocType:
|
||||
if not self.is_lwp():
|
||||
bal = self.get_leave_balance()
|
||||
tot_leaves = self.get_total_leave_days()
|
||||
bal, tot_leaves = eval(bal), eval(tot_leaves)
|
||||
bal, tot_leaves = bal, tot_leaves
|
||||
set(self.doc,'leave_balance',flt(bal['leave_balance']))
|
||||
set(self.doc,'total_leave_days',flt(tot_leaves['total_leave_days']))
|
||||
if flt(bal['leave_balance']) < flt(tot_leaves['total_leave_days']):
|
||||
|
||||
4
hr/doctype/salary_manager/__init__.py
Normal file
4
hr/doctype/salary_manager/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
from webnotes import ValidationError
|
||||
|
||||
class SalarySlipExistsError(ValidationError): pass
|
||||
|
||||
67
hr/doctype/salary_manager/salary_manager.js
Normal file
67
hr/doctype/salary_manager/salary_manager.js
Normal file
@ -0,0 +1,67 @@
|
||||
var display_activity_log = function(msg) {
|
||||
if(!pscript.ss_html)
|
||||
pscript.ss_html = $a(cur_frm.fields_dict['Activity Log'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#CCC'});
|
||||
pscript.ss_html.innerHTML = '<div style="color:#EEE; background-color:#555;"><b><i>Activity Log:</i><br></b></div>';
|
||||
pscript.ss_html.innerHTML += '<div style="color:#666; padding: 5px">'+ msg + '</div>';
|
||||
}
|
||||
|
||||
//Create salary slip
|
||||
//-----------------------
|
||||
cur_frm.cscript['Create Salary Slip'] = function(doc, cdt, cdn) {
|
||||
var callback = function(r, rt){
|
||||
if (r.message)
|
||||
display_activity_log(r.message);
|
||||
}
|
||||
$c('runserverobj', args={'method':'create_sal_slip','docs':compress_doclist(make_doclist (cdt, cdn))},callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Submit salary slip
|
||||
//-----------------------
|
||||
cur_frm.cscript['Submit Salary Slip'] = function(doc, cdt, cdn) {
|
||||
var check = confirm("Do you really want to Submit all Salary Slip for month : " + doc.month+" and fiscal year : "+doc.fiscal_year);
|
||||
if(check){
|
||||
var callback = function(r, rt){
|
||||
if (r.message)
|
||||
display_activity_log(r.message);
|
||||
}
|
||||
$c('runserverobj', args={'method':'submit_salary_slip','docs':compress_doclist(make_doclist (cdt, cdn))},callback);
|
||||
}
|
||||
}
|
||||
|
||||
// Make Bank Voucher
|
||||
//-----------------------
|
||||
cur_frm.cscript['Make Bank Voucher'] = function(doc,cdt,cdn){
|
||||
if(doc.month && doc.fiscal_year){
|
||||
cur_frm.cscript.make_jv(doc, cdt, cdn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Make JV
|
||||
//-----------------------
|
||||
cur_frm.cscript.make_jv = function(doc, dt, dn) {
|
||||
var call_back = function(r,rt){
|
||||
var jv = LocalDB.create('Journal Voucher');
|
||||
jv = locals['Journal Voucher'][jv];
|
||||
jv.voucher_type = 'Bank Voucher';
|
||||
jv.user_remark = 'Payment of salary for the month: ' + doc.month + 'and fiscal year: ' + doc.fiscal_year;
|
||||
jv.fiscal_year = doc.fiscal_year;
|
||||
jv.company = doc.company;
|
||||
jv.posting_date = dateutil.obj_to_str(new Date());
|
||||
|
||||
// credit to bank
|
||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||
d1.account = r.message['default_bank_account'];
|
||||
d1.credit = r.message['amount']
|
||||
|
||||
// debit to salary account
|
||||
var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||
d2.account = r.message['default_salary_account'];
|
||||
d2.debit = r.message['amount']
|
||||
|
||||
loaddoc('Journal Voucher', jv.name);
|
||||
}
|
||||
$c_obj(make_doclist(dt,dn),'get_acc_details','',call_back);
|
||||
}
|
||||
172
hr/doctype/salary_manager/salary_manager.py
Normal file
172
hr/doctype/salary_manager/salary_manager.py
Normal file
@ -0,0 +1,172 @@
|
||||
# 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_emp_list(self):
|
||||
"""
|
||||
Returns list of active employees based on selected criteria
|
||||
and for which salary structure exists
|
||||
"""
|
||||
|
||||
cond = self.get_filter_condition()
|
||||
|
||||
emp_list = sql("""
|
||||
select t1.name
|
||||
from `tabEmployee` t1, `tabSalary Structure` t2
|
||||
where t1.docstatus!=2 and t2.docstatus != 2
|
||||
and ifnull(t1.status, 'Left') = 'Active' and ifnull(t2.is_active, 'No') = 'Yes'
|
||||
and t1.name = t2.employee
|
||||
%s """% cond)
|
||||
|
||||
return emp_list
|
||||
|
||||
|
||||
def get_filter_condition(self):
|
||||
self.check_mandatory()
|
||||
|
||||
cond = ''
|
||||
for f in ['company', 'branch', 'department', 'designation', 'grade', 'employment_type']:
|
||||
if self.doc.fields.get(f):
|
||||
cond += " and t1." + f + " = '" + self.doc.fields.get(f) + "'"
|
||||
|
||||
return cond
|
||||
|
||||
|
||||
def check_mandatory(self):
|
||||
for f in ['company', 'month', 'fiscal_year']:
|
||||
if not self.doc.fields[f]:
|
||||
msgprint("Please select %s to proceed" % f, raise_exception=1)
|
||||
|
||||
|
||||
def create_sal_slip(self):
|
||||
"""
|
||||
Creates salary slip for selected employees if already not created
|
||||
|
||||
"""
|
||||
|
||||
emp_list = self.get_emp_list()
|
||||
log = ""
|
||||
if emp_list:
|
||||
log = "<table><tr><td colspan = 2>Following Salary Slip has been created: </td></tr><tr><td><u>SAL SLIP ID</u></td><td><u>EMPLOYEE NAME</u></td></tr>"
|
||||
else:
|
||||
log = "<table><tr><td colspan = 2>No employee found for the above selected criteria</td></tr>"
|
||||
|
||||
for emp in emp_list:
|
||||
if not sql("""select name from `tabSalary Slip`
|
||||
where docstatus!= 2 and employee = %s and month = %s and fiscal_year = %s and company = %s
|
||||
""", (emp[0], self.doc.month, self.doc.fiscal_year, self.doc.company)):
|
||||
ss = Document('Salary Slip')
|
||||
ss.fiscal_year = self.doc.fiscal_year
|
||||
ss.employee = emp[0]
|
||||
ss.month = self.doc.month
|
||||
ss.email_check = self.doc.send_email
|
||||
ss.company = self.doc.company
|
||||
ss.save(1)
|
||||
|
||||
ss_obj = get_obj('Salary Slip', ss.name, with_children=1)
|
||||
ss_obj.get_emp_and_leave_details()
|
||||
ss_obj.calculate_net_pay()
|
||||
ss_obj.validate()
|
||||
ss_obj.doc.save()
|
||||
|
||||
for d in getlist(ss_obj.doclist, 'earning_details'):
|
||||
d.save()
|
||||
for d in getlist(ss_obj.doclist, 'deduction_details'):
|
||||
d.save()
|
||||
|
||||
log += '<tr><td>' + ss.name + '</td><td>' + ss_obj.doc.employee_name + '</td></tr>'
|
||||
log += '</table>'
|
||||
return log
|
||||
|
||||
def get_sal_slip_list(self):
|
||||
"""
|
||||
Returns list of salary slips based on selected criteria
|
||||
which are not submitted
|
||||
"""
|
||||
cond = self.get_filter_condition()
|
||||
ss_list = sql("""
|
||||
select t1.name from `tabSalary Slip` t1
|
||||
where t1.docstatus = 0 and month = '%s' and fiscal_year = '%s' %s
|
||||
""" % (self.doc.month, self.doc.fiscal_year, cond))
|
||||
return ss_list
|
||||
|
||||
|
||||
def submit_salary_slip(self):
|
||||
"""
|
||||
Submit all salary slips based on selected criteria
|
||||
"""
|
||||
ss_list = self.get_sal_slip_list()
|
||||
log = ""
|
||||
if ss_list:
|
||||
log = """<table>
|
||||
<tr>
|
||||
<td colspan = 2>Following Salary Slip has been submitted: </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><u>SAL SLIP ID</u></td>
|
||||
<td><u>EMPLOYEE NAME</u></td>
|
||||
</tr>
|
||||
"""
|
||||
else:
|
||||
log = "<table><tr><td colspan = 2>No salary slip found to submit for the above selected criteria</td></tr>"
|
||||
|
||||
for ss in ss_list:
|
||||
ss_obj = get_obj("Salary Slip",ss[0],with_children=1)
|
||||
set(ss_obj.doc, 'docstatus', 1)
|
||||
ss_obj.on_submit()
|
||||
|
||||
log += '<tr><td>' + ss[0] + '</td><td>' + ss_obj.doc.employee_name + '</td></tr>'
|
||||
log += '</table>'
|
||||
return log
|
||||
|
||||
|
||||
def get_total_salary(self):
|
||||
"""
|
||||
Get total salary amount from submitted salary slip based on selected criteria
|
||||
"""
|
||||
cond = self.get_filter_condition()
|
||||
tot = sql("""
|
||||
select sum(rounded_total) from `tabSalary Slip` t1
|
||||
where t1.docstatus = 1 and month = '%s' and fiscal_year = '%s' %s
|
||||
""" % (self.doc.month, self.doc.fiscal_year, cond))
|
||||
|
||||
return flt(tot[0][0])
|
||||
|
||||
|
||||
def get_acc_details(self):
|
||||
"""
|
||||
get default bank account,default salary acount from company
|
||||
"""
|
||||
amt = self.get_total_salary()
|
||||
com = sql("select default_bank_account from `tabCompany` where name = '%s'" % self.doc.company)
|
||||
|
||||
if not com[0][0] or not com[0][1]:
|
||||
msgprint("You can set Default Bank Account in Company master.")
|
||||
|
||||
ret = {
|
||||
'def_bank_acc' : com and com[0][0] or '',
|
||||
'def_sal_acc' : com and com[0][1] or '',
|
||||
'amount' : amt
|
||||
}
|
||||
return ret
|
||||
@ -1,42 +1,37 @@
|
||||
# DocType, Salary Slip Control Panel
|
||||
# DocType, Salary Manager
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:20',
|
||||
'creation': '2011-08-11 16:40:04',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-29 18:02:38',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'modified': '2011-08-25 12:02:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1294312182',
|
||||
'_last_update': '1314179318',
|
||||
'allow_copy': 1,
|
||||
'allow_email': 1,
|
||||
'allow_print': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'hide_heading': 0,
|
||||
'hide_toolbar': 0,
|
||||
'in_create': 0,
|
||||
'document_type': 'Other',
|
||||
'issingle': 1,
|
||||
'module': 'HR',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'use_template': 0,
|
||||
'version': 113
|
||||
'show_in_menu': 1,
|
||||
'version': 29
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Salary Slip Control Panel',
|
||||
'parent': 'Salary Manager',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
@ -47,7 +42,7 @@
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Salary Slip Control Panel',
|
||||
'parent': 'Salary Manager',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
@ -55,10 +50,10 @@
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Salary Slip Control Panel
|
||||
# DocType, Salary Manager
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Salary Slip Control Panel'
|
||||
'name': 'Salary Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
@ -84,22 +79,76 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 1,
|
||||
'label': 'Salary Slip Control Panel'
|
||||
'label': 'Document Description',
|
||||
'options': '<div class="field_description">You can generate multiple salary slips based on the selected criteria, submit and mail those to the employee directly from here</div>'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'employee_type',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 2
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 3,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 2,
|
||||
'label': 'Employment Type',
|
||||
'oldfieldname': 'employee_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Employment Type'
|
||||
'idx': 4,
|
||||
'label': 'Company',
|
||||
'options': 'link:Company',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'branch',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 5,
|
||||
'label': 'Branch',
|
||||
'options': 'Branch'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'department',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 6,
|
||||
'label': 'Department',
|
||||
'options': 'Department'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'designation',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 7,
|
||||
'label': 'Designation',
|
||||
'options': 'Designation'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 8,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -107,180 +156,132 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'grade',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'idx': 9,
|
||||
'label': 'Grade',
|
||||
'oldfieldname': 'grade',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Grade'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'branch',
|
||||
'fieldname': 'employment_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'label': 'Branch',
|
||||
'oldfieldname': 'branch',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Branch'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'department',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 5,
|
||||
'label': 'Department',
|
||||
'oldfieldname': 'department',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Department'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'designation',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 6,
|
||||
'label': 'Designation',
|
||||
'oldfieldname': 'designation',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Designation'
|
||||
'idx': 10,
|
||||
'label': 'Employment Type',
|
||||
'options': 'link:Employment Type'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 7,
|
||||
'oldfieldtype': 'Column Break'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'Fiscal Year',
|
||||
'oldfieldname': 'fiscal_year',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Fiscal Year'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'month',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 9,
|
||||
'label': 'Month',
|
||||
'oldfieldname': 'month',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'year',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 10,
|
||||
'label': 'Year',
|
||||
'oldfieldname': 'year',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\n2009\n2010\n2011\n2012'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'week_off',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Week Off',
|
||||
'oldfieldname': 'week_off',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'arrear_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 12,
|
||||
'label': 'Arrear Amount',
|
||||
'oldfieldname': 'arrear_amount',
|
||||
'oldfieldtype': 'Currency'
|
||||
'label': 'Fiscal Year',
|
||||
'options': 'link:Fiscal Year',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'email_check',
|
||||
'fieldname': 'month',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 12,
|
||||
'label': 'Month',
|
||||
'options': '\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Check if you want to send salary slip in mail to each employee while submitting salary slip',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'send_email',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 13,
|
||||
'label': 'Email',
|
||||
'oldfieldname': 'email_check',
|
||||
'oldfieldtype': 'Check'
|
||||
'label': 'Send Email'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 14,
|
||||
'oldfieldtype': 'Section Break'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 15,
|
||||
'label': 'Process Payroll',
|
||||
'oldfieldtype': 'Button',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 16,
|
||||
'label': 'Salary Slip HTML'
|
||||
'idx': 14
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 17
|
||||
'idx': 15,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Creates salary slip for above mentioned criteria.',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 18,
|
||||
'label': 'Submit Salary Slip',
|
||||
'oldfieldtype': 'Button',
|
||||
'idx': 16,
|
||||
'label': 'Create Salary Slip',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 17,
|
||||
'width': '25%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Submit all salary slips for the above selected criteria',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 18,
|
||||
'label': 'Submit Salary Slip',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 19,
|
||||
'width': '25%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Create Bank Voucher for the total salary paid for the above selected criteria',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 20,
|
||||
'label': 'Make Bank Voucher',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 21
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 22,
|
||||
'label': 'Activity Log'
|
||||
}
|
||||
]
|
||||
199
hr/doctype/salary_manager/test_salary_manager.py
Normal file
199
hr/doctype/salary_manager/test_salary_manager.py
Normal file
@ -0,0 +1,199 @@
|
||||
import unittest
|
||||
import webnotes
|
||||
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes.model.code import get_obj
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
class TestSalarySlip(unittest.TestCase):
|
||||
def setUp(self):
|
||||
webnotes.conn.begin()
|
||||
for rec in [des1, dep1, branch1, grade1, comp1, emp1, emp2]:
|
||||
rec.save(1)
|
||||
|
||||
ss1[0].employee = emp1.name
|
||||
for s in ss1: s.save(1)
|
||||
for s in ss1[1:]:
|
||||
sql("update `tabEarning Detail` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
|
||||
sql("update `tabDeduction Detail` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
|
||||
|
||||
|
||||
ss2[0].employee = emp2.name
|
||||
for s in ss2: s.save(1)
|
||||
for s in ss2[1:]:
|
||||
sql("update `tabEarning Detail` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
|
||||
sql("update `tabDeduction Detail` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
|
||||
|
||||
sman.save()
|
||||
self.sm = get_obj('Salary Manager')
|
||||
leave.save(1)
|
||||
self.sm.create_sal_slip()
|
||||
|
||||
def test_creation(self):
|
||||
ssid = sql("""
|
||||
select name, department
|
||||
from `tabSalary Slip`
|
||||
where month = '08' and fiscal_year='2011-2012'""")
|
||||
|
||||
self.assertTrue(len(ssid)==1)
|
||||
self.assertTrue(ssid[0][1] == 'dep1')
|
||||
|
||||
|
||||
def test_lwp_calc(self):
|
||||
ss = sql("""
|
||||
select payment_days
|
||||
from `tabSalary Slip`
|
||||
where month = '08' and fiscal_year='2011-2012' and employee = '%s'
|
||||
""" % emp1.name)
|
||||
|
||||
self.assertTrue(ss[0][0]==27)
|
||||
|
||||
def test_net_pay(self):
|
||||
ss = webnotes.conn.sql("""
|
||||
select rounded_total
|
||||
from `tabSalary Slip`
|
||||
where month = '08'
|
||||
and fiscal_year='2011-2012' and employee = '%s'""" % emp1.name)
|
||||
self.assertTrue(ss[0][0]==67)
|
||||
|
||||
def test_submit(self):
|
||||
self.sm.submit_salary_slip()
|
||||
ss = webnotes.conn.sql("""
|
||||
select docstatus
|
||||
from `tabSalary Slip`
|
||||
where month = '08'
|
||||
and fiscal_year='2011-2012' and employee = '%s'""" % emp1.name)
|
||||
self.assertTrue(ss[0][0]==1)
|
||||
|
||||
def tearDown(self):
|
||||
webnotes.conn.rollback()
|
||||
|
||||
#--------------------------------------------
|
||||
# test data
|
||||
#--------------------------------------------
|
||||
des1 = Document(fielddata={
|
||||
'name':'des1',
|
||||
'doctype':'Designation',
|
||||
'designation_name':'des1'
|
||||
})
|
||||
|
||||
dep1 = Document(fielddata={
|
||||
'name':'dep1',
|
||||
'doctype':'Department',
|
||||
'department_name' : 'dep1'
|
||||
})
|
||||
|
||||
branch1 = Document(fielddata={
|
||||
'name':'branch1',
|
||||
'doctype':'Branch',
|
||||
'branch' : 'branch1'
|
||||
})
|
||||
|
||||
comp1 = Document(fielddata={
|
||||
'name':'comp1',
|
||||
'doctype':'Company',
|
||||
'abbr':'c1',
|
||||
'company_name' : 'comp1'
|
||||
})
|
||||
|
||||
grade1 = Document(fielddata={
|
||||
'name':'grade1',
|
||||
'doctype':'Grade',
|
||||
'grade_name' : 'grade1'
|
||||
})
|
||||
|
||||
emp1 = Document(fielddata={
|
||||
'doctype':'Employee',
|
||||
'employee_number':'emp1',
|
||||
'department':'dep1',
|
||||
'designation':'des1',
|
||||
'branch' : 'branch1',
|
||||
'company':'comp1',
|
||||
'grade':'grade1',
|
||||
'naming_series':'EMP/',
|
||||
'status':'Active',
|
||||
'docstatus':0,
|
||||
'employee_name':'emp1'
|
||||
})
|
||||
|
||||
emp2 = Document(fielddata={
|
||||
'doctype':'Employee',
|
||||
'employee_number':'emp2',
|
||||
'department':'dep1',
|
||||
'designation':'des2',
|
||||
'branch' : 'branch1',
|
||||
'company':'comp1',
|
||||
'naming_series':'EMP/',
|
||||
'grade':'grade1',
|
||||
'status':'Active',
|
||||
|
||||
})
|
||||
|
||||
ss1 = [
|
||||
Document(fielddata={
|
||||
'doctype':'Salary Structure',
|
||||
'docstatus':0,
|
||||
'employee':'emp1',
|
||||
'is_active':'Yes',
|
||||
'department': 'dep1',
|
||||
'designation' : 'des1',
|
||||
'employee_name': 'emp1'
|
||||
}),
|
||||
Document(fielddata={
|
||||
'parenttype':'Salary Structure',
|
||||
'parentfield':'earning_details',
|
||||
'doctype':'Earning Detail',
|
||||
'e_type' : 'Basic',
|
||||
'depend_on_lwp':1,
|
||||
'modified_value':100
|
||||
}),
|
||||
Document(fielddata={
|
||||
'parenttype':'Salary Structure',
|
||||
'parentfield':'earning_details',
|
||||
'doctype':'Deduction Detail',
|
||||
'd_type':'TDS',
|
||||
'd_modified_amt':20
|
||||
})
|
||||
]
|
||||
|
||||
ss2 = [
|
||||
Document(fielddata={
|
||||
'doctype':'Salary Structure',
|
||||
'is_active':'Yes',
|
||||
'docstatus':0,
|
||||
}),
|
||||
Document(fielddata={
|
||||
'parenttype':'Salary Structure',
|
||||
'parentfield':'deduction_details',
|
||||
'doctype':'Earning Detail',
|
||||
'e_type' : 'Basic',
|
||||
'modified_value':100
|
||||
}),
|
||||
Document(fielddata={
|
||||
'parenttype':'Salary Structure',
|
||||
'parentfield':'deduction_details',
|
||||
'doctype':'Deduction Detail',
|
||||
'd_type':'TDS',
|
||||
'd_modified_amt':20
|
||||
})
|
||||
]
|
||||
|
||||
sman = Document(fielddata={
|
||||
'name':'Salary Manager',
|
||||
'doctype':'Salary Manager',
|
||||
'company': 'comp1',
|
||||
'department':'dep1',
|
||||
'designation':'des1',
|
||||
'month': '08',
|
||||
'fiscal_year':'2011-2012'
|
||||
})
|
||||
|
||||
leave = Document(fielddata = {
|
||||
'doctype':'Leave Application',
|
||||
'employee':'emp1',
|
||||
'from_date':'2011-08-12',
|
||||
'to_date':'2011-08-15',
|
||||
'total_leave_days':'4',
|
||||
'leave_type':'Leave Without Pay',
|
||||
'docstatus':1
|
||||
})
|
||||
@ -29,7 +29,7 @@ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
|
||||
// Calculate total if lwp exists
|
||||
// ------------------------------------------------------------------------
|
||||
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
||||
doc.payment_days = cint(doc.total_days_in_month) - cint(doc.leave_without_pay);
|
||||
doc.payment_days = flt(doc.total_days_in_month) - flt(doc.leave_without_pay);
|
||||
refresh_field('payment_days');
|
||||
calculate_all(doc, dt, dn);
|
||||
}
|
||||
@ -68,7 +68,7 @@ var calculate_earning_total = function(doc, dt, dn) {
|
||||
var total_earn = 0;
|
||||
for(var i = 0; i < tbl.length; i++){
|
||||
if(cint(tbl[i].e_depends_on_lwp) == 1) {
|
||||
tbl[i].e_modified_amount = flt(tbl[i].e_amount)*(flt(doc.payment_days)/cint(doc.total_days_in_month));
|
||||
tbl[i].e_modified_amount = Math.round(tbl[i].e_amount)*(flt(doc.payment_days)/cint(doc.total_days_in_month)*100)/100;
|
||||
refresh_field('e_modified_amount', tbl[i].name, 'earning_details');
|
||||
}
|
||||
total_earn += flt(tbl[i].e_modified_amount);
|
||||
@ -85,7 +85,7 @@ var calculate_ded_total = function(doc, dt, dn) {
|
||||
var total_ded = 0;
|
||||
for(var i = 0; i < tbl.length; i++){
|
||||
if(cint(tbl[i].d_depends_on_lwp) == 1) {
|
||||
tbl[i].d_modified_amount = flt(tbl[i].d_amount)*(flt(doc.payment_days)/cint(doc.total_days_in_month));
|
||||
tbl[i].d_modified_amount = Math.round(tbl[i].d_amount)*(flt(doc.payment_days)/cint(doc.total_days_in_month)*100)/100;
|
||||
refresh_field('d_modified_amount', tbl[i].name, 'deduction_details');
|
||||
}
|
||||
total_ded += flt(tbl[i].d_modified_amount);
|
||||
|
||||
@ -101,8 +101,17 @@ class DocType(TransactionBase):
|
||||
for d in range(m[3]):
|
||||
dt = add_days(cstr(m[1]), d)
|
||||
if dt not in holidays:
|
||||
if sql("select t1.name from `tabLeave Application` t1, `tabLeave Type` t2 where t2.name = t1.leave_type and ifnull(t2.is_lwp, 0) = 1 and t1.docstatus = 1 and t1.employee = '%s' and '%s' between from_date and to_date"%(self.doc.employee, dt)):
|
||||
lwp += 1
|
||||
leave = sql("""
|
||||
select t1.name, t1.half_day
|
||||
from `tabLeave Application` t1, `tabLeave Type` t2
|
||||
where t2.name = t1.leave_type
|
||||
and ifnull(t2.is_lwp, 0) = 1
|
||||
and t1.docstatus = 1
|
||||
and t1.employee = '%s'
|
||||
and '%s' between from_date and to_date
|
||||
"""%(self.doc.employee, dt))
|
||||
if leave:
|
||||
lwp = cint(leave[0][1]) and lwp + 0.5 or lwp + 1
|
||||
return lwp
|
||||
|
||||
# Check existing
|
||||
@ -121,26 +130,58 @@ class DocType(TransactionBase):
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
self.doc.total_in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
|
||||
|
||||
|
||||
def calculate_earning_total(self):
|
||||
"""
|
||||
Calculates total earnings considering lwp
|
||||
"""
|
||||
self.doc.gross_pay = flt(self.doc.arrear_amount) + flt(self.doc.leave_encashment_amount)
|
||||
for d in getlist(self.doclist, 'earning_details'):
|
||||
if cint(d.e_depends_on_lwp) == 1:
|
||||
d.e_modified_amount = round(flt(d.e_amount)*flt(self.doc.payment_days)/cint(self.doc.total_days_in_month), 2)
|
||||
self.doc.gross_pay += d.e_modified_amount
|
||||
|
||||
def calculate_ded_total(self):
|
||||
"""
|
||||
Calculates total deduction considering lwp
|
||||
"""
|
||||
self.doc.total_deduction = 0
|
||||
for d in getlist(self.doclist, 'deduction_details'):
|
||||
if cint(d.d_depends_on_lwp) == 1:
|
||||
d.d_modified_amount = round(flt(d.d_amount)*flt(self.doc.payment_days)/cint(self.doc.total_days_in_month), 2)
|
||||
self.doc.total_deduction += d.d_modified_amount
|
||||
|
||||
def calculate_net_pay(self):
|
||||
"""
|
||||
Calculate net payment
|
||||
"""
|
||||
self.calculate_earning_total()
|
||||
self.calculate_ded_total()
|
||||
self.doc.net_pay = flt(self.doc.gross_pay) - flt(self.doc.total_deduction)
|
||||
self.doc.rounded_total = round(self.doc.net_pay)
|
||||
|
||||
# ON SUBMIT
|
||||
#=======================================================
|
||||
def on_submit(self):
|
||||
if(self.doc.email_check == 1):
|
||||
self.send_mail_funct()
|
||||
|
||||
|
||||
|
||||
|
||||
# Send mail
|
||||
#=======================================================
|
||||
def send_mail_funct(self):
|
||||
emailid_ret=sql("select company_email from `tabEmployee` where name = '%s'"%self.doc.employee)
|
||||
if emailid_ret:
|
||||
receiver = cstr(emailid_ret[0][0])
|
||||
subj = 'Salary Slip ' + cstr(self.doc.month) +' '+cstr(self.doc.year)
|
||||
earn_ret=sql("select e_type,e_amount from `tabSS Earning Detail` where parent = '%s'"%self.doc.name)
|
||||
ded_ret=sql("select d_type,d_amount from `tabSS Deduction Detail` where parent = '%s'"%self.doc.name)
|
||||
subj = 'Salary Slip - ' + cstr(self.doc.month) +'/'+cstr(self.doc.fiscal_year)
|
||||
earn_ret=sql("select e_type,e_modified_amount from `tabSS Earning Detail` where parent = '%s'"%self.doc.name)
|
||||
ded_ret=sql("select d_type,d_modified_amount from `tabSS Deduction Detail` where parent = '%s'"%self.doc.name)
|
||||
|
||||
earn_table = ''
|
||||
ded_table = ''
|
||||
if earn_ret:
|
||||
|
||||
earn_table += "<table cellspacing= '5' cellpadding='5' >"
|
||||
|
||||
for e in earn_ret:
|
||||
@ -166,25 +207,25 @@ class DocType(TransactionBase):
|
||||
if not letter_head:
|
||||
letter_head = ''
|
||||
|
||||
msg = ''' %s <br>
|
||||
msg = '''<div> %s <br>
|
||||
<table cellspacing= "5" cellpadding="5" width = "100%%">
|
||||
<tr>
|
||||
<td colspan = 4 width = "100%%"><h4>Salary Slip</h4></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan = 2 width = "50%%"><b>Employee Code : %s</b></td>
|
||||
<td colspan = 2 width = "50%%"><b>Employee Name : %s</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan = 2 width = "50%%">Month : %s</td>
|
||||
<td colspan = 2 width = "50%%">Fiscal Year : %s</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellspacing= "5" cellpadding="5" >
|
||||
<tr>
|
||||
<td colspan = 4><h4>Salary Slip</h4></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan = 2><b>Employee Code : %s</b></td>
|
||||
<td colspan = 2><b>Employee Name : %s</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Month : %s</td>
|
||||
<td>Year : %s</td>
|
||||
<td colspan = 2>Fiscal Year : %s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Department : %s</td>
|
||||
<td>Branch : %s</td>
|
||||
<td colspan = 2>Designation : %s</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Grade : %s</td>
|
||||
@ -193,35 +234,33 @@ class DocType(TransactionBase):
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PF No. : %s</td>
|
||||
<td>ESIC No. : %s</td>
|
||||
<td colspan = 2>Arrear Amount : <b>%s</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Total days in month : %s</td>
|
||||
<td>Leave Without Pay : %s</td>
|
||||
<td colspan = 2>Payment days : %s</td>
|
||||
|
||||
</tr>
|
||||
<br><br>
|
||||
</table>
|
||||
<table border="1px solid #CCC" width="100%%" cellpadding="0" cellspacing= "0" >
|
||||
<tr>
|
||||
<td colspan = 2><b>Earning</b></td>
|
||||
<td colspan = 2><b>Deduction</b></td>
|
||||
<td colspan = 2 width = "50%%"><b>Earning</b></td>
|
||||
<td colspan = 2 width = "50%%"><b>Deduction</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan = 2>%s</td>
|
||||
<td colspan = 2>%s</td>
|
||||
<td colspan = 2 width = "50%%">%s</td>
|
||||
<td colspan = 2 width = "50%%">%s</td>
|
||||
</tr>
|
||||
<br>
|
||||
</table>
|
||||
<table cellspacing= "5" cellpadding="5">
|
||||
<tr>
|
||||
<td colspan = 2><b>Gross Pay :</b> %s</td>
|
||||
<td colspan = 2><b>Total Deduction :</b> %s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Net Pay : %s</b></td>
|
||||
<td colspan = 3><b>Net Pay (in words) : %s</b></td>
|
||||
</tr>
|
||||
</table>'''%(cstr(letter_head[0][0]),cstr(self.doc.employee),self.doc.employee_name,cstr(self.doc.month),cstr(self.doc.year),cstr(self.doc.fiscal_year),self.doc.department,self.doc.branch,self.doc.designation,self.doc.grade,cstr(self.doc.bank_account_no),self.doc.bank_name,cstr(self.doc.pf_no),cstr(self.doc.esic_no),cstr(self.doc.arrear_amount),cstr(self.doc.total_days_in_month),cstr(self.doc.leave_without_pay),cstr(self.doc.payment_days),earn_table,ded_table,cstr(self.doc.gross_pay),cstr(self.doc.total_deduction),cstr(self.doc.net_pay),cstr(self.doc.net_pay_in_words))
|
||||
sendmail([receiver], sender='automail@webnotestech.com', subject=subj, parts=[['text/plain', msg]])
|
||||
<tr>
|
||||
<td><b>Net Pay(in words) : %s</b></td>
|
||||
</tr>
|
||||
</table></div>'''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(self.doc.gross_pay), cstr(self.doc.total_deduction), cstr(self.doc.net_pay), cstr(self.doc.total_in_words))
|
||||
sendmail([receiver], sender='automail@erpnext.com', subject=subj, parts=[['text/plain', msg]])
|
||||
else:
|
||||
msgprint("Company Email ID not found.")
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
alert("Salary Slip Control Panel is currently under re-development. It will take around a week time.");
|
||||
hide_field(['Process Payroll', 'Submit Salary Slip', 'Make Bank Voucher']);
|
||||
}
|
||||
|
||||
cur_frm.cscript['Process Payroll'] = function(doc,cdt,cdn){
|
||||
$c('runserverobj', args={'method':'process_payroll','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},function(r,rt){
|
||||
|
||||
if(!pscript.ss_html)
|
||||
pscript.ss_html = $a(cur_frm.fields_dict['Salary Slip HTML'].wrapper,'span','',{border:'1px solid #CCC', backgroundColor:'#DDD'});
|
||||
pscript.ss_html.innerHTML = '';
|
||||
pscript.ss_html.innerHTML = r.message;
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript['Submit Salary Slip'] = function(doc,cdt,cdn){
|
||||
if(doc.month && doc.fiscal_year && doc.year){
|
||||
var check = confirm("DO you really want to Submit all Salary Slip for month : " + doc.month+" and year : "+doc.year);
|
||||
if(check){
|
||||
$c('runserverobj', args={'method':'submit_sal_slip','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},function(r,rt){
|
||||
|
||||
if(!pscript.ss_html)
|
||||
pscript.ss_html = $a(cur_frm.fields_dict['Salary Slip HTML'].wrapper,'span','',{border:'1px solid #CCC', backgroundColor:'#DDD'});
|
||||
pscript.ss_html.innerHTML = '';
|
||||
pscript.ss_html.innerHTML = r.message;
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
alert("Please select month, fiscal year and year");
|
||||
}
|
||||
|
||||
// Make JV
|
||||
// --------
|
||||
cur_frm.cscript.make_jv = function(doc, dt, dn) {
|
||||
var call_back = function(r,rt){
|
||||
var jv = LocalDB.create('Journal Voucher');
|
||||
jv = locals['Journal Voucher'][jv];
|
||||
jv.voucher_type = 'Bank Voucher';
|
||||
jv.remark = 'Salary - Bank Voucher';
|
||||
jv.fiscal_year = doc.fiscal_year;
|
||||
jv.company = doc.company;
|
||||
|
||||
// credit to bank
|
||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||
d1.account = r.message['default_bank_account'];
|
||||
|
||||
// debit to salary account
|
||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||
d1.account = r.message['default_salary_account'];
|
||||
if(!r.message['default_salary_account'] && !r.message['default_bank_account']) alert("To debit salary amount in salary head and credit amount from bank, you need to specify default salary account and default bank account in Global Defaults.\nGo to Setup, click on Company. Select a company.\nSelect Default Salary Account, Default Bank Account from Accounting tab.");
|
||||
else if(!r.message['default_salary_account']) alert("To debit salary amount you need to specify default salary account in Global Defaults.\nGo to Setup, click on Company. Select a company.\nSelect Default Salary Account from Accounting tab.");
|
||||
else if(!r.message['default_bank_account']) alert("To credit salary amount you need to specify default bank account in Global Defaults.\nGo to Setup, click on Company. Select a company.\nSelect Default Bank Account from Accounting tab.");
|
||||
loaddoc('Journal Voucher', jv.name);
|
||||
}
|
||||
$c_obj(make_doclist(dt,dn),'get_acct_dtl','',call_back);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Make Journal Voucher
|
||||
// --------------------
|
||||
cur_frm.cscript['Make Bank Voucher'] = function(doc, dt, dn) {
|
||||
cur_frm.cscript.make_jv(doc,dt,dn);
|
||||
}
|
||||
@ -1,137 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# Get Employees
|
||||
# **********************************************************************
|
||||
def get_employee(self):
|
||||
e1 = self.emp_fr_memp() #get employee list from employee where employee is active
|
||||
e2 = self.emp_fr_salstr(e1) #get employee list from salary structure whose salary structure is created and is active
|
||||
e3 = self.emp_fr_salslip(e2) #get employee list from salary slip whose salary slip not yet created for this month and year
|
||||
return e3
|
||||
|
||||
# **********************************************************************
|
||||
def emp_fr_memp(self):
|
||||
lst1 = [[self.doc.employee_type,"employment_type"],[self.doc.branch,"branch"],[self.doc.designation,"designation"],[self.doc.department, "department"],[self.doc.grade,"grade"]]
|
||||
|
||||
condition = ""
|
||||
#flag = 0
|
||||
for l in lst1:
|
||||
|
||||
if(l[0]):
|
||||
#if flag == 0:
|
||||
# condition += l[1] + "= '" + l[0] +"'"
|
||||
#else:
|
||||
condition += " and " + l[1]+ "= '" +l[0] +"'"
|
||||
#flag = 1
|
||||
|
||||
emp_query = "select name from `tabEmployee` where status = 'Active'"
|
||||
#if flag == 1:
|
||||
emp_query += condition
|
||||
|
||||
e = sql(emp_query)
|
||||
return e
|
||||
|
||||
# **********************************************************************
|
||||
def emp_fr_salstr(self,e1):
|
||||
lst = []
|
||||
for r in e1:
|
||||
lst.append(r[0])
|
||||
|
||||
|
||||
e_lst = "%s"%lst
|
||||
e_lst=e_lst.replace("[","(")
|
||||
e_lst=e_lst.replace("]",")")
|
||||
cond = ''
|
||||
|
||||
if e1:
|
||||
cond = " and employee in %s"%e_lst
|
||||
|
||||
el=sql("select employee from `tabSalary Structure` where is_active = 'Yes'"+cond)
|
||||
|
||||
return el
|
||||
|
||||
# **********************************************************************
|
||||
def emp_fr_salslip(self,e2):
|
||||
e3 = []
|
||||
for i in e2:
|
||||
ret = sql("select name from `tabSalary Slip` where month = '%s' and year = '%s' and employee = '%s' and docstatus !=2 "%(self.doc.month,self.doc.year,i[0]))
|
||||
|
||||
if not ret:
|
||||
e3.append(i[0])
|
||||
return e3
|
||||
|
||||
# **********************************************************************
|
||||
def process_payroll(self):
|
||||
sal_slip_str = ''
|
||||
if self.doc.month and self.doc.fiscal_year and self.doc.year:
|
||||
e = self.get_employee()
|
||||
if e:
|
||||
self.doc.emp_lst=e
|
||||
sal_slip_str += 'Sucessfully created following salary slips:'
|
||||
for i in e:
|
||||
ss = Document('Salary Slip')
|
||||
ss.fiscal_year = self.doc.fiscal_year
|
||||
ss.employee = i
|
||||
ss.month = self.doc.month
|
||||
ss.year= self.doc.year
|
||||
ss.arrear_amount = self.doc.arrear_amount
|
||||
ss.email_check = self.doc.email_check
|
||||
ss.save(1)
|
||||
salary_obj=get_obj("Salary Slip",ss.name,with_children=1)
|
||||
salary_obj.process_payroll_all()
|
||||
sal_slip_str += "<br/>"+ss.name
|
||||
|
||||
else:
|
||||
|
||||
msgprint("For Process Payroll Fiscal Year, Month, Year fields are mandatory.")
|
||||
if not sal_slip_str:
|
||||
|
||||
sal_slip_str = "No record found."
|
||||
return cstr(sal_slip_str)
|
||||
|
||||
# **********************************************************************
|
||||
def submit_sal_slip(self):
|
||||
|
||||
sal_slip_str = ''
|
||||
r = sql("select name from `tabSalary Slip` where month='%s' and year = '%s' and fiscal_year = '%s' and docstatus = 0"%(self.doc.month,self.doc.year,self.doc.fiscal_year))
|
||||
|
||||
|
||||
ret = sql("update `tabSalary Slip` set docstatus = 1 where month='%s' and year = '%s' and fiscal_year = '%s' and docstatus = 0"%(self.doc.month,self.doc.year,self.doc.fiscal_year))
|
||||
if r:
|
||||
sal_slip_str += 'Sucessfully updated following salary slips:'
|
||||
for i in r:
|
||||
|
||||
salary_obj=get_obj("Salary Slip",i[0],with_children=1)
|
||||
salary_obj.on_submit()
|
||||
sal_slip_str += "<br/>"+cstr(i[0])
|
||||
if not sal_slip_str:
|
||||
|
||||
sal_slip_str = "No record found."
|
||||
return cstr(sal_slip_str)
|
||||
|
||||
# **********************************************************************
|
||||
#get default bank account,default salary acount from company.
|
||||
def get_acct_dtl(self):
|
||||
res = sql("select default_bank_account,default_salary_acount from `tabCompany` where name = '%s'"%get_defaults()['company'], as_dict=1)
|
||||
return res[0]
|
||||
@ -42,7 +42,7 @@ class DocType:
|
||||
'grade' : cstr(det[0][4]),
|
||||
'backup_employee': cstr(self.doc.employee)
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
|
||||
# Set Salary structure field values
|
||||
@ -53,7 +53,7 @@ class DocType:
|
||||
'bank_ac_no' : basic_info and basic_info[0][1] or '',
|
||||
'esic_no' : basic_info and basic_info[0][2] or '',
|
||||
'pf_no' : basic_info and basic_info[0][3] or ''}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# Make earning and deduction table
|
||||
#---------------------------------------------------------
|
||||
|
||||
@ -5,14 +5,14 @@
|
||||
{
|
||||
'creation': '2010-12-14 16:50:05',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-06-27 14:39:11',
|
||||
'modified': '2011-08-11 16:56:38',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1308808105',
|
||||
'_last_update': '1311621379',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'HR',
|
||||
@ -21,7 +21,7 @@
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': 'For %(employee_name)s',
|
||||
'version': 586
|
||||
'version': 587
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -39,7 +39,8 @@
|
||||
'name': '__common__',
|
||||
'parent': 'Salary Structure',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType'
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Salary Structure
|
||||
@ -54,9 +55,9 @@
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'match': 'owner',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Employee',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
@ -66,97 +67,40 @@
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'match': 'owner',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'match': 'owner',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'match': 'owner',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'Sales User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'read': 1,
|
||||
'role': 'All',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'HR User',
|
||||
'write': 1
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'HR Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 1,
|
||||
'read': 1,
|
||||
'role': 'HR Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 1,
|
||||
'read': 1,
|
||||
'role': 'HR User'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
|
||||
@ -174,4 +174,4 @@ KBAnswer = function(body, data) {
|
||||
}
|
||||
|
||||
|
||||
$import(knowledge_base.kb_common);
|
||||
$import(knowledge_base/page/kb_common/kb_common.js);
|
||||
@ -203,4 +203,4 @@ KBQuestion = function(parent, det, kb) {
|
||||
this.make()
|
||||
}
|
||||
|
||||
$import(knowledge_base.kb_common);
|
||||
$import(knowledge_base/page/kb_common/kb_common.js);
|
||||
@ -15,7 +15,7 @@
|
||||
'doctype': 'Page',
|
||||
'module': 'Knowledge Base',
|
||||
'name': '__common__',
|
||||
'page_name': 'Questions',
|
||||
'page_name': 'questions',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ from webnotes import msgprint, errprint
|
||||
|
||||
def make_address():
|
||||
from webnotes.modules.module_manager import reload_doc
|
||||
reload_doc('tools','doctype','address')
|
||||
reload_doc('utilities','doctype','address')
|
||||
|
||||
from webnotes.model.db_schema import updatedb
|
||||
updatedb('Address')
|
||||
@ -113,24 +113,24 @@ def delete_unwanted_fields():
|
||||
|
||||
def reload_doc_files():
|
||||
from webnotes.modules.module_manager import reload_doc
|
||||
reload_doc('tools', 'doctype', 'contact')
|
||||
reload_doc('crm', 'doctype', 'customer')
|
||||
reload_doc('maintenance', 'doctype', 'customer_issue')
|
||||
reload_doc('material_management', 'doctype', 'delivery_note')
|
||||
reload_doc('crm', 'doctype', 'enquiry')
|
||||
reload_doc('crm', 'doctype', 'installation_note')
|
||||
reload_doc('crm', 'doctype', 'lead')
|
||||
reload_doc('maintenance', 'doctype', 'maintenance_schedule')
|
||||
reload_doc('maintenance', 'doctype', 'maintenance_visit')
|
||||
reload_doc('srm', 'doctype', 'purchase_order')
|
||||
reload_doc('material_management', 'doctype', 'purchase_receipt')
|
||||
reload_doc('crm', 'doctype', 'quotation')
|
||||
reload_doc('utilities', 'doctype', 'contact')
|
||||
reload_doc('selling', 'doctype', 'customer')
|
||||
reload_doc('support', 'doctype', 'customer_issue')
|
||||
reload_doc('stock', 'doctype', 'delivery_note')
|
||||
reload_doc('selling', 'doctype', 'enquiry')
|
||||
reload_doc('selling', 'doctype', 'installation_note')
|
||||
reload_doc('selling', 'doctype', 'lead')
|
||||
reload_doc('support', 'doctype', 'maintenance_schedule')
|
||||
reload_doc('support', 'doctype', 'maintenance_visit')
|
||||
reload_doc('buying', 'doctype', 'purchase_order')
|
||||
reload_doc('stock', 'doctype', 'purchase_receipt')
|
||||
reload_doc('selling', 'doctype', 'quotation')
|
||||
reload_doc('accounts', 'doctype', 'receivable_voucher')
|
||||
reload_doc('accounts', 'doctype', 'payable_voucher')
|
||||
reload_doc('crm', 'doctype', 'sales_order')
|
||||
reload_doc('selling', 'doctype', 'sales_order')
|
||||
reload_doc('setup', 'doctype', 'sales_partner')
|
||||
reload_doc('material_management', 'doctype', 'serial_no')
|
||||
reload_doc('srm', 'doctype', 'supplier')
|
||||
reload_doc('stock', 'doctype', 'serial_no')
|
||||
reload_doc('buying', 'doctype', 'supplier')
|
||||
|
||||
def reload_mapper_files():
|
||||
from webnotes.modules.module_manager import reload_doc
|
||||
|
||||
@ -98,6 +98,5 @@ def support_patch():
|
||||
|
||||
webnotes.model.delete_doc('DocType','Support Ticket')
|
||||
reload_doc('setup','doctype','support_email_settings')
|
||||
reload_doc('maintenance','doctype','support_ticket')
|
||||
reload_doc('maintenance','doctype','support_ticket_response')
|
||||
|
||||
reload_doc('support','doctype','support_ticket')
|
||||
reload_doc('support','doctype','support_ticket_response')
|
||||
|
||||
1180
patches/old_patches/patch_1.py
Normal file
1180
patches/old_patches/patch_1.py
Normal file
File diff suppressed because it is too large
Load Diff
1282
patches/patch.py
1282
patches/patch.py
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
$import(Production Tips Common)
|
||||
//$import(Production Tips Common)
|
||||
|
||||
// ONLOAD
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
@ -14,6 +14,8 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
// Hide - Un Hide Buttons
|
||||
if (!doc.is_default && doc.__islocal!=1) unhide_field('Set as Default BOM');
|
||||
else hide_field('Set as Default BOM');
|
||||
if (doc.is_default && doc.__islocal!=1) unhide_field('Unset as Default BOM');
|
||||
else hide_field('Unset as Default BOM');
|
||||
|
||||
if(doc.__islocal!=1){
|
||||
set_field_permlevel('item',1);
|
||||
@ -76,12 +78,23 @@ cur_frm.cscript['Set as Default BOM'] = function(doc,cdt,cdn) {
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'set_as_default_bom', 'docs': compress_doclist([doc])}, function(r,rt) {
|
||||
refresh_field('is_default');
|
||||
hide_field('Set as Default BOM');
|
||||
hide_field('Set as Default BOM');unhide_field('Unset as Default BOM');
|
||||
refresh_field('Set as Default BOM');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Unset as Default BOM'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("Do you Really want to Unset BOM " + doc.name + " as default for Item " + doc.item);
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'unset_as_default_bom', 'docs': compress_doclist([doc])}, function(r,rt) {
|
||||
refresh_field('is_default');
|
||||
hide_field('Unset as Default BOM');unhide_field('Set as Default BOM');
|
||||
refresh_field('Unset as Default BOM');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Activate BOM'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("DO YOU REALLY WANT TO ACTIVATE BOM : " + doc.name);
|
||||
|
||||
@ -92,6 +105,13 @@ cur_frm.cscript['Activate BOM'] = function(doc,cdt,cdn) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Test Flat BOM'] = function(doc,cdt,cdn) {
|
||||
|
||||
$c('runserverobj', args={'method':'get_current_flat_bom_items', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Inactivate BOM'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("DO YOU REALLY WANT TO INACTIVATE BOM : " + doc.name);
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class DocType:
|
||||
ret={
|
||||
'description' : item and item[0]['description'] or ''
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def get_workstation_details(self,workstation):
|
||||
ws = sql("select hour_rate, capacity from `tabWorkstation` where name = %s",workstation , as_dict = 1)
|
||||
@ -44,7 +44,7 @@ class DocType:
|
||||
'hour_rate' : ws and flt(ws[0]['hour_rate']) or '',
|
||||
'workstation_capacity' : ws and flt(ws[0]['capacity']) or ''
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def get_bom_material_detail(self, arg):
|
||||
arg = eval(arg)
|
||||
@ -106,7 +106,7 @@ class DocType:
|
||||
'standard_rate' : 0
|
||||
}
|
||||
ret_item.update(ret_bom_rates)
|
||||
return cstr(ret_item)
|
||||
return ret_item
|
||||
|
||||
def set_as_default_bom(self):
|
||||
# set Is Default as 1
|
||||
@ -124,6 +124,14 @@ class DocType:
|
||||
sql("update `tabItem` set default_bom = '%s' where name = '%s'" % (self.doc.name,self.doc.item))
|
||||
msgprint(cstr(self.doc.name) + "has been set as Default BOM for Item "+cstr(self.doc.item))
|
||||
|
||||
def unset_as_default_bom(self):
|
||||
# set Is Default as 1
|
||||
set(self.doc,'is_default', flt(0))
|
||||
|
||||
# update current BOM as default bom in Item Master
|
||||
sql("update `tabItem` set default_bom = null where name = '%s'" % (self.doc.item))
|
||||
msgprint(cstr(self.doc.name) + "has been unset as Default BOM for Item "+cstr(self.doc.item))
|
||||
|
||||
def check_active_parent_boms(self):
|
||||
act_pbom = sql("select distinct t1.parent from `tabBOM Material` t1, `tabBill Of Materials` t2 where t1.bom_no ='%s' and t2.name = t1.parent and t2.is_active = 'Yes' and t2.docstatus = 1 and t1.docstatus =1 " % self.doc.name )
|
||||
if act_pbom and act_pbom[0][0]:
|
||||
@ -248,6 +256,7 @@ class DocType:
|
||||
o.operating_cost = flt(flt(o.time_in_mins)/60) * flt(o.hour_rate)
|
||||
if validate != 1:
|
||||
o.save()
|
||||
msgprint('Operation saved')
|
||||
|
||||
op_cost = flt(op_cost) + flt(o.operating_cost)
|
||||
|
||||
@ -443,6 +452,7 @@ class DocType:
|
||||
|
||||
#----- Document on Save function------
|
||||
def validate(self):
|
||||
#msgprint(len(getlist(self.doclist, 'bom_materials')))
|
||||
self.validate_main_item()
|
||||
self.validate_duplicate_items()
|
||||
self.calculate_cost(validate = 1)
|
||||
@ -487,8 +497,10 @@ class DocType:
|
||||
#Get Child Flat BOM Items
|
||||
#----------------------------------------
|
||||
def get_child_flat_bom_items(self, item, d):
|
||||
|
||||
child_flat_bom_items=[]
|
||||
if item and (item[0]['is_sub_contracted_item'] == 'Yes' or item[0]['is_pro_applicable'] == 'Yes'):
|
||||
|
||||
child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, '%s' as parent_bom, bom_mat_no, 'No' as is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and is_pro_applicable = 'No' and docstatus = 1" % ( d.bom_no, cstr(d.bom_no)))
|
||||
self.cur_flat_bom_items.append([d.item_code, d.description, flt(d.qty), d.stock_uom, flt(d.moving_avg_rate), flt(d.amount_as_per_mar), flt(d.last_purchase_rate), flt(d.amount_as_per_lpr), flt(d.standard_rate), flt(d.amount_as_per_sr), flt(d.qty_consumed_per_unit), (item[0]['is_sub_contracted_item'] == 'Yes') and d.parent or d.bom_no, d.name, (item[0]['is_sub_contracted_item'] == 'Yes') and 'No' or 'Yes'])
|
||||
|
||||
@ -505,11 +517,13 @@ class DocType:
|
||||
# Get Current Flat BOM Items
|
||||
# -----------------------------
|
||||
def get_current_flat_bom_items(self):
|
||||
|
||||
self.cur_flat_bom_items = []
|
||||
|
||||
cfb_lbl = {'item_code': 0, 'description': 1, 'qty_consumed_per_unit': 2, 'stock_uom': 3, 'moving_avg_rate': 4, 'last_purchase_rate': 5, 'standard_rate': 6, 'parent_bom': 7, 'bom_mat_no': 8, 'is_pro_applicable': 9}
|
||||
|
||||
for d in getlist(self.doclist, 'bom_materials'):
|
||||
|
||||
if d.bom_no:
|
||||
item = sql("select is_sub_contracted_item, is_pro_applicable from `tabItem` where name = '%s'" % d.item_code, as_dict = 1)
|
||||
child_flat_bom_items = self.get_child_flat_bom_items(item,d)
|
||||
@ -533,7 +547,7 @@ class DocType:
|
||||
# On Submit
|
||||
# -----------
|
||||
def on_submit(self):
|
||||
self.update_flat_bom_engine()
|
||||
self.update_flat_bom_engine(1)
|
||||
|
||||
|
||||
def get_parent_bom_list(self, bom_no):
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': '%(item_code)s',
|
||||
'subject': '%(item)s',
|
||||
'version': 170
|
||||
},
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# 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.utils import cint, flt
|
||||
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
|
||||
@ -44,18 +44,20 @@ class DocType:
|
||||
def get_operations(self,bom_no):
|
||||
# reply = [ 'Operation',operation_no, opn_description,BOM NO , workstation, hour_rate, time_in_minutes, Total Direct Material, Total Operating Cost, Cost]
|
||||
# reply = [ 0 , 1 , 2 ,3 , 4 , 5 , 6 , 7 , 8 ,9 , 10 , 11 ]
|
||||
|
||||
ret = sql("select operation_no,opn_description,workstation,hour_rate,time_in_mins from `tabBOM Operation` where parent = %s", bom_no, as_dict = 1)
|
||||
cost = sql("select dir_mat_as_per_mar , operating_cost , cost_as_per_mar from `tabBill Of Materials` where name = %s", bom_no, as_dict = 1)
|
||||
|
||||
# Validate the BOM ENTRIES
|
||||
#check = get_obj('Bill Of Materials', bom_no, with_children =1).validate()
|
||||
reply = []
|
||||
|
||||
if ret:
|
||||
for r in ret:
|
||||
reply.append(['operation',cint(r['operation_no']), r['opn_description'] or '','%s'% bom_no,r['workstation'],flt(r['hour_rate']),flt(r['time_in_mins']),0,0,0])
|
||||
|
||||
reply[0][7]= flt(cost[0]['dir_mat_as_per_mar'])
|
||||
reply[0][8]=flt(cost[0]['operating_cost'])
|
||||
reply[0][9]=flt(cost[0]['cost_as_per_mar'])
|
||||
#msgprint(bom_no)
|
||||
return reply
|
||||
|
||||
def get_item_bom(self,data):
|
||||
@ -78,7 +80,6 @@ class DocType:
|
||||
return reply
|
||||
|
||||
|
||||
|
||||
#------------- Wrapper Code --------------
|
||||
# BOM TREE
|
||||
def calculate_cost( self, bom_no):
|
||||
|
||||
@ -34,7 +34,7 @@ class DocType:
|
||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||
'default_bom' : item and item[0]['default_bom'] or ''
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def validate(self):
|
||||
if not self.doc.production_item :
|
||||
|
||||
@ -32,7 +32,7 @@ class DocType:
|
||||
'stock_uom' : item and item[0]['stock_uom'],
|
||||
'bom_no' : item and item[0]['default_bom']
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
else:
|
||||
msgprint("Item %s does not exist in system." %(args['item_code']))
|
||||
raise Exception
|
||||
|
||||
@ -25,7 +25,7 @@ class DocType:
|
||||
def update_bom_operation(self):
|
||||
bom_list = sql(" select DISTINCT parent from `tabBOM Operation` where workstation = '%s'" % self.doc.name)
|
||||
for bom_no in bom_list:
|
||||
sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no, self.doc.name))
|
||||
sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no[0], self.doc.name))
|
||||
|
||||
def on_update(self):
|
||||
set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent))
|
||||
|
||||
@ -38,7 +38,7 @@ class DocType:
|
||||
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
||||
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
|
||||
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
|
||||
return cstr(ret)
|
||||
return ret
|
||||
else:
|
||||
msgprint("Customer : %s does not exist in system." % (self.doc.customer))
|
||||
raise Exception
|
||||
@ -52,7 +52,7 @@ class DocType:
|
||||
'contact_no' : contact and contact[0]['contact_no'] or '',
|
||||
'email_id' : contact and contact[0]['email_id'] or ''
|
||||
}
|
||||
return str(ret)
|
||||
return ret
|
||||
else:
|
||||
msgprint("Contact Person : %s does not exist in the system." % (self.doc,contact_person))
|
||||
raise Exception
|
||||
@ -65,7 +65,7 @@ class DocType:
|
||||
#if pft > 0:
|
||||
per_pft = (flt(pft) / flt(self.doc.project_value)) * 100
|
||||
ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# validate
|
||||
#================================================
|
||||
|
||||
@ -22,18 +22,18 @@ class DocType:
|
||||
cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
|
||||
if cust:
|
||||
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def get_customer_details(self):
|
||||
cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
|
||||
if cust:
|
||||
ret = {'customer_name': cust and cust[0][0] or ''}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def get_allocated_to_name(self):
|
||||
as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to)
|
||||
ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# validate
|
||||
#--------------------------------------------
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user