Merge branch 'stable' of github.com:webnotes/erpnext into stable

This commit is contained in:
Rushabh Mehta 2011-08-30 16:02:51 +05:30
commit d8cae39a8b
9 changed files with 143 additions and 170 deletions

View File

@ -1,17 +1,15 @@
report.customize_filters = function() { 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:'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 +'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 +'Period'].df.in_first_page = 1;
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year; this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
} }
report.aftertableprint = function(t) { report.aftertableprint = function(t) {
$yt(t,'*',1,{whiteSpace:'pre'}); $yt(t,'*',1,{whiteSpace:'pre'});
} }
this.mytabs.items['More Filters'].hide();
this.mytabs.items['Select Columns'].hide(); this.mytabs.items['Select Columns'].hide();

View File

@ -131,11 +131,6 @@ def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
col_idx[str(c) + n ] = len(colnames) - 1 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 # get start date
start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date') start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
if not start_date: if not start_date:
@ -162,7 +157,7 @@ for r in res:
ch = make_child_lst(based_on,r[0].strip()) 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]) actual = flt(actual[0][0])

View File

@ -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

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2011-02-17 11:16:08', 'creation': '2010-08-08 17:08:59',
'docstatus': 0, 'docstatus': 0,
'modified': '2011-06-27 14:39:04', 'modified': '2011-08-11 17:27:12',
'modified_by': 'Administrator', 'modified_by': 'Administrator',
'owner': 'Administrator' 'owner': 'Administrator'
}, },
@ -26,7 +26,7 @@
'show_in_menu': 0, 'show_in_menu': 0,
'subject': '%(employee_name)s', 'subject': '%(employee_name)s',
'tag_fields': 'status', 'tag_fields': 'status',
'version': 443 'version': 444
}, },
# These values are common for all DocField # These values are common for all DocField
@ -40,12 +40,14 @@
# These values are common for all DocPerm # These values are common for all DocPerm
{ {
'amend': 0,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'name': '__common__', 'name': '__common__',
'parent': 'Employee', 'parent': 'Employee',
'parentfield': 'permissions', 'parentfield': 'permissions',
'parenttype': 'DocType', 'parenttype': 'DocType',
'read': 1 'read': 1,
'submit': 0
}, },
# DocType, Employee # DocType, Employee
@ -56,21 +58,24 @@
# DocPerm # DocPerm
{ {
'cancel': 1, 'cancel': 0,
'create': 1, 'create': 0,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 1, 'idx': 1,
'permlevel': 0, 'permlevel': 0,
'role': 'System Manager', 'role': 'Employee',
'write': 1 'write': 0
}, },
# DocPerm # DocPerm
{ {
'cancel': 0,
'create': 0,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 2, 'idx': 2,
'permlevel': 1, 'permlevel': 1,
'role': 'All' 'role': 'All',
'write': 0
}, },
# DocPerm # DocPerm
@ -95,22 +100,6 @@
'write': 1 'write': 1
}, },
# DocPerm
{
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 1,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 6,
'permlevel': 1,
'role': 'HR Manager'
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
@ -141,7 +130,7 @@
'no_copy': 1, 'no_copy': 1,
'oldfieldname': 'naming_series', 'oldfieldname': 'naming_series',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
'options': 'WN-EMP\nEMP/', 'options': 'EMP/',
'permlevel': 0, 'permlevel': 0,
'reqd': 0 'reqd': 0
}, },
@ -173,8 +162,7 @@
'oldfieldname': 'employee_name', 'oldfieldname': 'employee_name',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
'permlevel': 0, 'permlevel': 0,
'reqd': 1, 'reqd': 1
'search_index': 1
}, },
# DocField # DocField
@ -276,7 +264,7 @@
'options': '\nActive\nLeft', 'options': '\nActive\nLeft',
'permlevel': 0, 'permlevel': 0,
'reqd': 1, 'reqd': 1,
'search_index': 0 'search_index': 1
}, },
# DocField # DocField
@ -409,8 +397,7 @@
'oldfieldtype': 'Link', 'oldfieldtype': 'Link',
'options': 'Department', 'options': 'Department',
'permlevel': 0, 'permlevel': 0,
'reqd': 1, 'reqd': 1
'search_index': 1
}, },
# DocField # DocField
@ -474,21 +461,11 @@
'reqd': 0 'reqd': 0
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'is_sales_person',
'fieldtype': 'Check',
'idx': 27,
'label': 'Is Sales Person',
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 28, 'idx': 27,
'label': 'Salary Information', 'label': 'Salary Information',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0, 'permlevel': 0,
@ -501,11 +478,11 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'salary_mode', 'fieldname': 'salary_mode',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 29, 'idx': 28,
'label': 'Salary Mode', 'label': 'Salary Mode',
'oldfieldname': 'salary_mode', 'oldfieldname': 'salary_mode',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
'options': '\nBank\nCash \nCheque', 'options': '\nBank\nCash\nCheque',
'permlevel': 0, 'permlevel': 0,
'trigger': 'Client' 'trigger': 'Client'
}, },
@ -518,7 +495,7 @@
'fieldname': 'bank_name', 'fieldname': 'bank_name',
'fieldtype': 'Data', 'fieldtype': 'Data',
'hidden': 0, 'hidden': 0,
'idx': 30, 'idx': 29,
'in_filter': 1, 'in_filter': 1,
'label': 'Bank Name', 'label': 'Bank Name',
'oldfieldname': 'bank_name', 'oldfieldname': 'bank_name',
@ -535,7 +512,7 @@
'fieldname': 'bank_ac_no', 'fieldname': 'bank_ac_no',
'fieldtype': 'Data', 'fieldtype': 'Data',
'hidden': 0, 'hidden': 0,
'idx': 31, 'idx': 30,
'label': 'Bank A/C No.', 'label': 'Bank A/C No.',
'oldfieldname': 'bank_ac_no', 'oldfieldname': 'bank_ac_no',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -547,7 +524,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'esic_card_no', 'fieldname': 'esic_card_no',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 32, 'idx': 31,
'label': 'ESIC CARD No', 'label': 'ESIC CARD No',
'oldfieldname': 'esic_card_no', 'oldfieldname': 'esic_card_no',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -559,7 +536,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'pf_number', 'fieldname': 'pf_number',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 33, 'idx': 32,
'label': 'PF Number', 'label': 'PF Number',
'oldfieldname': 'pf_number', 'oldfieldname': 'pf_number',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -571,7 +548,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'gratuity_lic_id', 'fieldname': 'gratuity_lic_id',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 34, 'idx': 33,
'label': 'Gratuity LIC ID', 'label': 'Gratuity LIC ID',
'oldfieldname': 'gratuity_lic_id', 'oldfieldname': 'gratuity_lic_id',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -582,7 +559,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 35, 'idx': 34,
'label': 'Contact Details', 'label': 'Contact Details',
'permlevel': 0 'permlevel': 0
}, },
@ -591,7 +568,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 36, 'idx': 35,
'permlevel': 0, 'permlevel': 0,
'width': '50%' 'width': '50%'
}, },
@ -601,7 +578,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'cell_number', 'fieldname': 'cell_number',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 37, 'idx': 36,
'label': 'Cell Number', 'label': 'Cell Number',
'permlevel': 0 'permlevel': 0
}, },
@ -611,7 +588,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'personal_email', 'fieldname': 'personal_email',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 38, 'idx': 37,
'label': 'Personal Email', 'label': 'Personal Email',
'permlevel': 0 'permlevel': 0
}, },
@ -621,7 +598,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'notice_number_of_days', 'fieldname': 'notice_number_of_days',
'fieldtype': 'Int', 'fieldtype': 'Int',
'idx': 39, 'idx': 38,
'label': 'Notice - Number of Days', 'label': 'Notice - Number of Days',
'oldfieldname': 'notice_number_of_days', 'oldfieldname': 'notice_number_of_days',
'oldfieldtype': 'Int', 'oldfieldtype': 'Int',
@ -632,7 +609,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'HTML', 'fieldtype': 'HTML',
'idx': 40, 'idx': 39,
'label': 'Emergency Contact Details', 'label': 'Emergency Contact Details',
'options': '<b>Emergency Contact Details</b>', 'options': '<b>Emergency Contact Details</b>',
'permlevel': 0 'permlevel': 0
@ -643,7 +620,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'person_to_be_contacted', 'fieldname': 'person_to_be_contacted',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 41, 'idx': 40,
'label': 'Person To Be Contacted', 'label': 'Person To Be Contacted',
'permlevel': 0 'permlevel': 0
}, },
@ -653,7 +630,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'relation', 'fieldname': 'relation',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 42, 'idx': 41,
'label': 'Relation', 'label': 'Relation',
'permlevel': 0 'permlevel': 0
}, },
@ -663,7 +640,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'emergency_phone_number', 'fieldname': 'emergency_phone_number',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 43, 'idx': 42,
'label': 'Emergency Phone Number', 'label': 'Emergency Phone Number',
'permlevel': 0 'permlevel': 0
}, },
@ -672,7 +649,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 44, 'idx': 43,
'permlevel': 0, 'permlevel': 0,
'width': '50%' 'width': '50%'
}, },
@ -682,7 +659,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'permanent_accommodation_type', 'fieldname': 'permanent_accommodation_type',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 45, 'idx': 44,
'label': 'Permanent Accommodation Type', 'label': 'Permanent Accommodation Type',
'options': '\nRented\nOwned', 'options': '\nRented\nOwned',
'permlevel': 0 'permlevel': 0
@ -693,7 +670,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'permanent_address', 'fieldname': 'permanent_address',
'fieldtype': 'Small Text', 'fieldtype': 'Small Text',
'idx': 46, 'idx': 45,
'label': 'Permanent Address', 'label': 'Permanent Address',
'permlevel': 0 'permlevel': 0
}, },
@ -703,7 +680,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'current_accommodation_type', 'fieldname': 'current_accommodation_type',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 47, 'idx': 46,
'label': 'Current Accommodation Type', 'label': 'Current Accommodation Type',
'options': '\nRented\nOwned', 'options': '\nRented\nOwned',
'permlevel': 0 'permlevel': 0
@ -714,7 +691,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'current_address', 'fieldname': 'current_address',
'fieldtype': 'Small Text', 'fieldtype': 'Small Text',
'idx': 48, 'idx': 47,
'label': 'Current Address', 'label': 'Current Address',
'permlevel': 0 'permlevel': 0
}, },
@ -723,7 +700,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 49, 'idx': 48,
'label': 'Personal Details', 'label': 'Personal Details',
'permlevel': 0 'permlevel': 0
}, },
@ -732,7 +709,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 50, 'idx': 49,
'permlevel': 0, 'permlevel': 0,
'width': '50%' 'width': '50%'
}, },
@ -742,7 +719,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'pan_number', 'fieldname': 'pan_number',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 51, 'idx': 50,
'label': 'PAN Number', 'label': 'PAN Number',
'permlevel': 0 'permlevel': 0
}, },
@ -752,7 +729,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'passport_number', 'fieldname': 'passport_number',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 52, 'idx': 51,
'label': 'Passport Number', 'label': 'Passport Number',
'permlevel': 0 'permlevel': 0
}, },
@ -763,7 +740,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'hidden': 1, 'hidden': 1,
'idx': 53, 'idx': 52,
'label': 'Employee Profile', 'label': 'Employee Profile',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'permlevel': 0, 'permlevel': 0,
@ -775,7 +752,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'date_of_issue', 'fieldname': 'date_of_issue',
'fieldtype': 'Date', 'fieldtype': 'Date',
'idx': 54, 'idx': 53,
'label': 'Date of Issue', 'label': 'Date of Issue',
'permlevel': 0 'permlevel': 0
}, },
@ -785,7 +762,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'valid_upto', 'fieldname': 'valid_upto',
'fieldtype': 'Date', 'fieldtype': 'Date',
'idx': 55, 'idx': 54,
'label': 'Valid Upto', 'label': 'Valid Upto',
'permlevel': 0 'permlevel': 0
}, },
@ -796,7 +773,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'hidden': 1, 'hidden': 1,
'idx': 56, 'idx': 55,
'label': 'Salary Structure', 'label': 'Salary Structure',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'permlevel': 0, 'permlevel': 0,
@ -808,7 +785,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'place_of_issue', 'fieldname': 'place_of_issue',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 57, 'idx': 56,
'label': 'Place of Issue', 'label': 'Place of Issue',
'permlevel': 0 'permlevel': 0
}, },
@ -818,7 +795,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'marital_status', 'fieldname': 'marital_status',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 58, 'idx': 57,
'label': 'Marital Status', 'label': 'Marital Status',
'options': '\nSingle\nMarried\nDivorced\nWidowed', 'options': '\nSingle\nMarried\nDivorced\nWidowed',
'permlevel': 0 'permlevel': 0
@ -829,7 +806,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'blood_group', 'fieldname': 'blood_group',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 59, 'idx': 58,
'label': 'Blood Group', 'label': 'Blood Group',
'options': '\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-', 'options': '\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-',
'permlevel': 0 'permlevel': 0
@ -839,7 +816,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 60, 'idx': 59,
'permlevel': 0, 'permlevel': 0,
'width': '50%' 'width': '50%'
}, },
@ -851,7 +828,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'family_background', 'fieldname': 'family_background',
'fieldtype': 'Small Text', 'fieldtype': 'Small Text',
'idx': 61, 'idx': 60,
'label': 'Family Background', 'label': 'Family Background',
'permlevel': 0 'permlevel': 0
}, },
@ -863,7 +840,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'health_details', 'fieldname': 'health_details',
'fieldtype': 'Small Text', 'fieldtype': 'Small Text',
'idx': 62, 'idx': 61,
'label': 'Health Details', 'label': 'Health Details',
'permlevel': 0 'permlevel': 0
}, },
@ -872,7 +849,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 63, 'idx': 62,
'label': 'Educational Qualification', 'label': 'Educational Qualification',
'permlevel': 0 'permlevel': 0
}, },
@ -882,7 +859,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'educational_qualification_details', 'fieldname': 'educational_qualification_details',
'fieldtype': 'Table', 'fieldtype': 'Table',
'idx': 64, 'idx': 63,
'label': 'Educational Qualification Details', 'label': 'Educational Qualification Details',
'options': 'Educational Qualifications Detail', 'options': 'Educational Qualifications Detail',
'permlevel': 0 'permlevel': 0
@ -892,7 +869,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 65, 'idx': 64,
'label': 'Career History', 'label': 'Career History',
'permlevel': 0 'permlevel': 0
}, },
@ -901,7 +878,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 66, 'idx': 65,
'label': 'Previous Work Experience', 'label': 'Previous Work Experience',
'options': 'Simple', 'options': 'Simple',
'permlevel': 0 'permlevel': 0
@ -912,7 +889,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'previous_experience_details', 'fieldname': 'previous_experience_details',
'fieldtype': 'Table', 'fieldtype': 'Table',
'idx': 67, 'idx': 66,
'label': 'Previous Experience Details', 'label': 'Previous Experience Details',
'options': 'Previous Experience Detail', 'options': 'Previous Experience Detail',
'permlevel': 0 'permlevel': 0
@ -922,7 +899,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 68, 'idx': 67,
'label': 'History In Company', 'label': 'History In Company',
'options': 'Simple', 'options': 'Simple',
'permlevel': 0 'permlevel': 0
@ -933,7 +910,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'experience_in_company_details', 'fieldname': 'experience_in_company_details',
'fieldtype': 'Table', 'fieldtype': 'Table',
'idx': 69, 'idx': 68,
'label': 'Experience In Company Details', 'label': 'Experience In Company Details',
'options': 'Experience In Company Detail', 'options': 'Experience In Company Detail',
'permlevel': 0 'permlevel': 0
@ -943,7 +920,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 70, 'idx': 69,
'label': 'Exit', 'label': 'Exit',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0 'permlevel': 0
@ -953,7 +930,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 71, 'idx': 70,
'permlevel': 0, 'permlevel': 0,
'width': '50%' 'width': '50%'
}, },
@ -963,7 +940,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'resignation_letter_date', 'fieldname': 'resignation_letter_date',
'fieldtype': 'Date', 'fieldtype': 'Date',
'idx': 72, 'idx': 71,
'label': 'Resignation Letter Date', 'label': 'Resignation Letter Date',
'oldfieldname': 'resignation_letter_date', 'oldfieldname': 'resignation_letter_date',
'oldfieldtype': 'Date', 'oldfieldtype': 'Date',
@ -975,7 +952,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'relieving_date', 'fieldname': 'relieving_date',
'fieldtype': 'Date', 'fieldtype': 'Date',
'idx': 73, 'idx': 72,
'in_filter': 1, 'in_filter': 1,
'label': 'Relieving Date', 'label': 'Relieving Date',
'oldfieldname': 'relieving_date', 'oldfieldname': 'relieving_date',
@ -988,7 +965,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'reason_for_leaving', 'fieldname': 'reason_for_leaving',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 74, 'idx': 73,
'label': 'Reason for Leaving', 'label': 'Reason for Leaving',
'oldfieldname': 'reason_for_leaving', 'oldfieldname': 'reason_for_leaving',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -1000,7 +977,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'leave_encashed', 'fieldname': 'leave_encashed',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 75, 'idx': 74,
'label': 'Leave Encashed?', 'label': 'Leave Encashed?',
'oldfieldname': 'leave_encashed', 'oldfieldname': 'leave_encashed',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
@ -1013,7 +990,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'encashment_date', 'fieldname': 'encashment_date',
'fieldtype': 'Date', 'fieldtype': 'Date',
'idx': 76, 'idx': 75,
'label': 'Encashment Date', 'label': 'Encashment Date',
'oldfieldname': 'encashment_date', 'oldfieldname': 'encashment_date',
'oldfieldtype': 'Date', 'oldfieldtype': 'Date',
@ -1024,7 +1001,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 77, 'idx': 76,
'label': 'Exit Interview Details', 'label': 'Exit Interview Details',
'oldfieldname': 'col_brk6', 'oldfieldname': 'col_brk6',
'oldfieldtype': 'Column Break', 'oldfieldtype': 'Column Break',
@ -1037,7 +1014,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'held_on', 'fieldname': 'held_on',
'fieldtype': 'Date', 'fieldtype': 'Date',
'idx': 78, 'idx': 77,
'label': 'Held On', 'label': 'Held On',
'oldfieldname': 'held_on', 'oldfieldname': 'held_on',
'oldfieldtype': 'Date', 'oldfieldtype': 'Date',
@ -1049,7 +1026,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'reason_for_resignation', 'fieldname': 'reason_for_resignation',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 79, 'idx': 78,
'label': 'Reason for Resignation', 'label': 'Reason for Resignation',
'oldfieldname': 'reason_for_resignation', 'oldfieldname': 'reason_for_resignation',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
@ -1062,7 +1039,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'new_workplace', 'fieldname': 'new_workplace',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 80, 'idx': 79,
'label': 'New Workplace', 'label': 'New Workplace',
'oldfieldname': 'new_workplace', 'oldfieldname': 'new_workplace',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -1074,7 +1051,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'feedback', 'fieldname': 'feedback',
'fieldtype': 'Small Text', 'fieldtype': 'Small Text',
'idx': 81, 'idx': 80,
'label': 'Feedback', 'label': 'Feedback',
'oldfieldname': 'feedback', 'oldfieldname': 'feedback',
'oldfieldtype': 'Text', 'oldfieldtype': 'Text',
@ -1087,7 +1064,7 @@
'fieldname': 'file_list', 'fieldname': 'file_list',
'fieldtype': 'Text', 'fieldtype': 'Text',
'hidden': 1, 'hidden': 1,
'idx': 82, 'idx': 81,
'label': 'File List', 'label': 'File List',
'permlevel': 0, 'permlevel': 0,
'print_hide': 1 'print_hide': 1
@ -1098,7 +1075,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'trash_reason', 'fieldname': 'trash_reason',
'fieldtype': 'Small Text', 'fieldtype': 'Small Text',
'idx': 83, 'idx': 82,
'label': 'Trash Reason', 'label': 'Trash Reason',
'oldfieldname': 'trash_reason', 'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text', 'oldfieldtype': 'Small Text',

View File

@ -37,9 +37,13 @@ class DocType:
self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + flt(self.doc.indented_qty) + flt(self.doc.planned_qty) - flt(self.doc.reserved_qty) self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + flt(self.doc.indented_qty) + flt(self.doc.planned_qty) - flt(self.doc.reserved_qty)
self.doc.save() self.doc.save()
# update valuation for post dated entry # update valuation for post dated entry
if actual_qty: if actual_qty:
# check actual qty with total number of serial no
self.check_qty_with_serial_no()
prev_sle = self.get_prev_sle(dt, posting_time, sle_id) prev_sle = self.get_prev_sle(dt, posting_time, sle_id)
cqty = flt(prev_sle.get('bin_aqat', 0)) cqty = flt(prev_sle.get('bin_aqat', 0))
# Block if actual qty becomes negative # Block if actual qty becomes negative
@ -48,6 +52,18 @@ class DocType:
self.update_item_valuation(sle_id, dt, posting_time, serial_no, prev_sle) self.update_item_valuation(sle_id, dt, posting_time, serial_no, prev_sle)
def check_qty_with_serial_no(self):
"""
check actual qty with total number of serial no in store
Temporary validation added on: 18-07-2011
"""
if sql("select name from `tabItem` where ifnull(has_serial_no, 'No') = 'Yes' and name = '%s'" % self.doc.item_code):
sr_count = sql("select count(name) from `tabSerial No` where item_code = '%s' and warehouse = '%s' and status ='In Store' and docstatus != 2" % (self.doc.item_code, self.doc.warehouse))[0][0]
if sr_count != self.doc.actual_qty:
msg = "Actual Qty(%s) in Bin is mismatched with total number(%s) of serial no in store for item: '%s' and warehouse: '%s'" % (self.doc.actual_qty, sr_count, self.doc.item_code, self.doc.warehouse)
msgprint(msg, raise_exception=1)
sendmail(['developer@iwebnotes.com'], sender='automail@webnotestech.com', subject='Serial No Count vs Bin Actual Qty', parts=[['text/plain', msg]])
# -------------------------------- # --------------------------------
# get first stock ledger entry # get first stock ledger entry
# -------------------------------- # --------------------------------

View File

@ -7,15 +7,16 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
// ************************************** refresh *************************************************** // ************************************** refresh ***************************************************
cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(!doc.__islocal && doc.warehouse) set_field_permlevel('warehouse', 1); if(!doc.__islocal) {
if(!doc.__islocal && doc.item_code) set_field_permlevel('item_code', 1); flds = ['item_code', 'warehouse', 'purchase_document_type', 'purchase_document_no', 'purchase_date', 'purchase_time', 'purchase_rate', 'supplier']
if(doc.__islocal) set_field_permlevel('status', 0); for(i=0;i<flds.length;i++)
set_field_permlevel(flds[i], 1);
}
} }
// ************************************** triggers ************************************************** // ************************************** triggers **************************************************
// -------------
// item details // item details
// ------------- // -------------
cur_frm.add_fetch('item_code', 'item_name', 'item_name') cur_frm.add_fetch('item_code', 'item_name', 'item_name')
@ -24,23 +25,12 @@ cur_frm.add_fetch('item_code', 'brand', 'brand')
cur_frm.add_fetch('item_code', 'description', 'description') cur_frm.add_fetch('item_code', 'description', 'description')
cur_frm.add_fetch('item_code', 'warranty_period', 'warranty_period') cur_frm.add_fetch('item_code', 'warranty_period', 'warranty_period')
// ---------
// customer // customer
// --------- // ---------
cur_frm.add_fetch('customer', 'customer_name', 'customer_name') cur_frm.add_fetch('customer', 'customer_name', 'customer_name')
cur_frm.add_fetch('customer', 'address', 'delivery_address') cur_frm.add_fetch('customer', 'address', 'delivery_address')
cur_frm.add_fetch('customer', 'territory', 'territory') cur_frm.add_fetch('customer', 'territory', 'territory')
// ---------
// supplier
// ---------
//cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name')
//cur_frm.add_fetch('customer', 'address', 'supplier_address')
// ----------
// territory // territory
// ---------- // ----------
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
@ -48,10 +38,8 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
} }
// Supplier // Supplier
//-------------
cur_frm.cscript.supplier = function(doc,dt,dn) { cur_frm.cscript.supplier = function(doc,dt,dn) {
if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1); if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
if(doc.supplier) unhide_field(['supplier_name','address_display']); if(doc.supplier) unhide_field(['supplier_name','address_display']);
} }

View File

@ -16,39 +16,19 @@ class DocType(TransactionBase):
self.doc = doc self.doc = doc
self.doclist = doclist self.doclist = doclist
# ********************************* validate warranty / amc status ***************************************
# --------------------
# validate amc status
# --------------------
def validate_amc_status(self): def validate_amc_status(self):
if self.doc.amc_expiry_date and getdate(self.doc.amc_expiry_date) >= datetime.date.today() and self.doc.maintenance_status == 'Out of AMC': """
msgprint("AMC expiry date and maintenance status mismatch. Please verify") validate amc status
raise Exception """
elif (not self.doc.amc_expiry_date or getdate(self.doc.amc_expiry_date) < datetime.date.today()) and self.doc.maintenance_status == 'Under AMC': if (self.doc.maintenance_status == 'Out of AMC' and self.doc.amc_expiry_date and getdate(self.doc.amc_expiry_date) >= datetime.date.today()) or (self.doc.maintenance_status == 'Under AMC' and (not self.doc.amc_expiry_date or getdate(self.doc.amc_expiry_date) < datetime.date.today())):
msgprint("AMC expiry date and maintenance status mismatch. Please verify") msgprint("AMC expiry date and maintenance status mismatch. Please verify", raise_exception=1)
raise Exception
# -------------------------
# validate warranty status
# -------------------------
def validate_warranty_status(self): def validate_warranty_status(self):
if self.doc.warranty_expiry_date and getdate(self.doc.warranty_expiry_date) >= datetime.date.today() and self.doc.maintenance_status == 'Out of Warranty': """
msgprint("Warranty expiry date and maintenance status mismatch. Please verify") validate warranty status
raise Exception """
elif (not self.doc.warranty_expiry_date or getdate(self.doc.warranty_expiry_date) < datetime.date.today()) and self.doc.maintenance_status == 'Under Warranty': if (self.doc.maintenance_status == 'Out of Warranty' and self.doc.warranty_expiry_date and getdate(self.doc.warranty_expiry_date) >= datetime.date.today()) or (self.doc.maintenance_status == 'Under Warranty' and (not self.doc.warranty_expiry_date or getdate(self.doc.warranty_expiry_date) < datetime.date.today())):
msgprint("Warranty expiry date and maintenance status mismatch. Please verify") msgprint("Warranty expiry date and maintenance status mismatch. Please verify", raise_exception=1)
raise Exception
# -------------------------------
# validate warranty / amc status
# -------------------------------
def validate_warranty_amc_status(self):
self.validate_warranty_status()
self.validate_amc_status()
def validate_warehouse(self): def validate_warehouse(self):
@ -56,6 +36,9 @@ class DocType(TransactionBase):
msgprint("Warehouse is mandatory if this Serial No is <b>In Store</b>", raise_exception=1) msgprint("Warehouse is mandatory if this Serial No is <b>In Store</b>", raise_exception=1)
def validate_item(self): def validate_item(self):
"""
Validate whether serial no is required for this item
"""
item = sql("select name, has_serial_no from tabItem where name = '%s'" % self.doc.item_code) item = sql("select name, has_serial_no from tabItem where name = '%s'" % self.doc.item_code)
if not item: if not item:
msgprint("Item is not exists in the system", raise_exception=1) msgprint("Item is not exists in the system", raise_exception=1)
@ -67,7 +50,8 @@ class DocType(TransactionBase):
# validate # validate
# --------- # ---------
def validate(self): def validate(self):
self.validate_warranty_amc_status() self.validate_warranty_status()
self.validate_amc_status()
self.validate_warehouse() self.validate_warehouse()
self.validate_item() self.validate_item()
@ -102,7 +86,7 @@ class DocType(TransactionBase):
# on update # on update
# ---------- # ----------
def on_update(self): def on_update(self):
if self.doc.warehouse and not sql("select name from `tabStock Ledger Entry` where serial_no = '%s'" % (self.doc.name)) and self.doc.status == 'In Store': if self.doc.localname and self.doc.warehouse and self.doc.status == 'In Store' and not sql("select name from `tabStock Ledger Entry` where serial_no = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name)):
self.make_stock_ledger_entry(update_stock = 1) self.make_stock_ledger_entry(update_stock = 1)

View File

@ -355,6 +355,9 @@ class DocType:
# ---------------------------------- # ----------------------------------
def update_serial_no(self, is_submit): def update_serial_no(self, is_submit):
sl_obj = get_obj('Stock Ledger') sl_obj = get_obj('Stock Ledger')
if is_submit:
sl_obj.validate_serial_no_warehouse(self, 'mtn_details')
for d in getlist(self.doclist, 'mtn_details'): for d in getlist(self.doclist, 'mtn_details'):
if d.serial_no: if d.serial_no:
serial_nos = sl_obj.get_sr_no_list(d.serial_no) serial_nos = sl_obj.get_sr_no_list(d.serial_no)
@ -363,7 +366,7 @@ class DocType:
if d.s_warehouse: if d.s_warehouse:
sl_obj.update_serial_delivery_details(self, d, serial_no, is_submit) sl_obj.update_serial_delivery_details(self, d, serial_no, is_submit)
if d.t_warehouse: if d.t_warehouse:
sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, (self.doc.purpose in ['Material Transfer', 'Sales Return']) and 1 or 0) sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, self.doc.purpose)
if self.doc.purpose == 'Purchase Return': if self.doc.purpose == 'Purchase Return':
delete_doc("Serial No", serial_no) delete_doc("Serial No", serial_no)

View File

@ -57,11 +57,11 @@ class DocType:
s = s.strip() s = s.strip()
sr_war = sql("select warehouse,name from `tabSerial No` where name = '%s'" % (s)) sr_war = sql("select warehouse,name from `tabSerial No` where name = '%s'" % (s))
if not sr_war: if not sr_war:
msgprint("Serial No %s does not exists",s, raise_exception = 1) msgprint("Serial No %s does not exists"%s, raise_exception = 1)
elif not sr_war[0][0]: elif not sr_war[0][0]:
msgprint("Please set a warehouse in the Serial No <b>%s</b>" % s, raise_exception = 1) msgprint("Warehouse not mentioned in the Serial No <b>%s</b>" % s, raise_exception = 1)
elif sr_war[0][0] != d.warehouse: elif (d.warehouse and sr_war[0][0] != d.warehouse) or (d.s_warehouse and sr_war[0][0] != d.s_warehouse):
msgprint("Serial No : %s for Item : %s doesn't exists in Warehouse : %s" % (s, d.item_code, d.warehouse), raise_exception = 1) msgprint("Serial No : %s for Item : %s doesn't exists in Warehouse : %s" % (s, d.item_code, d.warehouse or d.s_warehouse), raise_exception = 1)
# ------------------------------------ # ------------------------------------
@ -119,10 +119,10 @@ class DocType:
# ---------------------------------- # ----------------------------------
# update serial no purchase details # update serial no purchase details
# ---------------------------------- # ----------------------------------
def update_serial_purchase_details(self, obj, d, serial_no, is_submit, is_transfer = 0): def update_serial_purchase_details(self, obj, d, serial_no, is_submit, purpose = ''):
exists = sql("select name, status, docstatus from `tabSerial No` where name = '%s'" % (serial_no)) exists = sql("select name, status, docstatus from `tabSerial No` where name = '%s'" % (serial_no))
if is_submit: if is_submit:
if exists and exists[0][2] != 2 and not is_transfer: if exists and exists[0][2] != 2 and purpose not in ['Material Transfer', 'Sales Return']:
msgprint("Serial No: %s already %s" % (serial_no, exists and exists[0][1]), raise_exception = 1) msgprint("Serial No: %s already %s" % (serial_no, exists and exists[0][1]), raise_exception = 1)
elif exists: elif exists:
s = Document('Serial No', exists and exists[0][0]) s = Document('Serial No', exists and exists[0][0])
@ -133,8 +133,10 @@ class DocType:
else: else:
if exists and exists[0][1] == 'Delivered' and exists[0][2] != 2: if exists and exists[0][1] == 'Delivered' and exists[0][2] != 2:
msgprint("Serial No: %s is already delivered, you can not cancel the document." % serial_no, raise_exception=1) msgprint("Serial No: %s is already delivered, you can not cancel the document." % serial_no, raise_exception=1)
elif purpose in ['Material Transfer', 'Sales Return']:
sql("update `tabSerial No` set status = '%s', purchase_document_type = '', purchase_document_no = '', warehouse = '%s' where name = '%s'" % (purpose == 'Material Transfer' and 'In Store' or 'Delivered', d.s_warehouse, serial_no))
else: else:
sql("update `tabSerial No` set docstatus = '%s', status = '%s', purchase_document_type = '', purchase_document_no = '', purchase_date = '', purchase_rate = '', supplier = null, supplier_name = '', supplier_address = '', warehouse = null where name = '%s'" % (not is_transfer and 2 or 0, is_transfer and 'In Store' or 'Not in Use', serial_no)) sql("update `tabSerial No` set docstatus = 2, status = 'Not in Use', purchase_document_type = '', purchase_document_no = '', purchase_date = '', purchase_rate = '', supplier = null, supplier_name = '', supplier_address = '', warehouse = '' where name = '%s'" % serial_no)
# ------------------------------- # -------------------------------
@ -233,6 +235,7 @@ class DocType:
sle.fields['warehouse_type'] = get_value('Warehouse' , args[k], 'warehouse_type') sle.fields['warehouse_type'] = get_value('Warehouse' , args[k], 'warehouse_type')
sle.fields[k] = args[k] sle.fields[k] = args[k]
sle_obj = get_obj(doc=sle) sle_obj = get_obj(doc=sle)
# validate # validate
sle_obj.validate() sle_obj.validate()
sle.save(new = 1) sle.save(new = 1)