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

Conflicts:
	erpnext/hr/doctype/expense_claim/expense_claim.js
	erpnext/patches/patch_list.py
This commit is contained in:
Anand Doshi 2012-07-31 17:30:49 +05:30
commit 59d37c4bcb
7 changed files with 41 additions and 62 deletions

View File

@ -27,23 +27,23 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
for(var i = 0; i<val.length; i++){
val[i].sanctioned_amount ='';
}
//doc.total_claimed_amount = '';
doc.total_sanctioned_amount = '';
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
}
}
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('calculate_total_amount');
else hide_field('calculate_total_amount');
if(user == doc.exp_approver && doc.approval_status == 'Submitted') unhide_field(['update_voucher', 'approve', 'reject']);
else hide_field(['update_voucher', 'approve', 'reject']);
if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
else set_field_permlevel('remark', 1);
hide_field('calculate_total_amount');
if(user == doc.exp_approver && doc.approval_status == 'Submitted'){
unhide_field(['update_voucher', 'approve', 'reject', 'calculate_total_amount']);
cur_frm.fields_dict['expense_voucher_details'].grid.set_column_disp('sanctioned_amount', true);
set_field_permlevel('remark', 0);
} else {
hide_field(['update_voucher', 'approve', 'reject']);
cur_frm.fields_dict['expense_voucher_details'].grid.set_column_disp('sanctioned_amount', false);
set_field_permlevel('remark', 1);
}
if (doc.docstatus == 0) unhide_field('calculate_total_amount');
}
cur_frm.cscript.employee = function(doc,cdt,cdn){
@ -63,27 +63,21 @@ cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
var total_claim =0;
for(var i = 0; i<val.length; i++){
if(!doc.claim_amount) val[i].sanctioned_amount = val[i].claim_amount;
total_claim = flt(total_claim)+flt(val[i].claim_amount);
refresh_field('sactioned_amount', val[i].name, 'expense_voucher_details');
}
doc.total_claimed_amount = flt(total_claim);
refresh_field('total_claimed_amount');
$c_obj(make_doclist(doc.doctype, doc.name),'validate_approver','', function(r,rt){
if(r.message){
if(r.message['valid_approver'] == 'No'){
doc.exp_approver ='';
}
wn.meta.get_docfield(doc.doctype, 'exp_approver' , doc.name).options = '';
wn.meta.get_docfield(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
refresh_field('exp_approver');
}
});
}
else if(doc.approval_status == 'Submitted'){
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
var total_sanctioned = 0;
for(var i = 0; i<val.length; i++){
if(!doc.claim_amount) val[i].sanctioned_amount = val[i].claim_amount;
total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
refresh_field('sactioned_amount', val[i].name, 'expense_voucher_details');
}
doc.total_sanctioned_amount = flt(total_sanctioned);
refresh_field('total_sanctioned_amount');

View File

@ -99,20 +99,8 @@ class DocType:
set(self.doc, 'remark', self.doc.remark)
set(self.doc, 'approval_status', 'Rejected')
# on approval notification
#get_obj('Notification Control').notify_contact('Expense Claim Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
return cstr('Rejected')
def validate_curr_exp(self):
for d in getlist(self.doclist, 'expense_voucher_details'):
if flt(d.sanctioned_amount) > 0:
if self.doc.approval_status == 'Draft':
msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Claim")
raise Exception
elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
msgprint("Sanctioned amount can be added only by expense voucher Approver")
raise Exception
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
@ -123,7 +111,6 @@ class DocType:
raise Exception
def validate(self):
self.validate_curr_exp()
self.validate_fiscal_year()
def on_update(self):
@ -141,17 +128,7 @@ class DocType:
if not self.doc.exp_approver:
msgprint("Please select Expense Claim approver")
raise Exception
def validate_approver(self):
app_lst = self.get_approver_lst()
if self.doc.exp_approver and self.doc.exp_approver not in app_lst:
msgprint("Approver "+self.doc.exp_approver+" is not authorized to approve this expense voucher. Please select another approver")
valid_app = 'No'
else:
valid_app = 'Yes'
ret = {'app_lst':("\n" + "\n".join(app_lst)), 'valid_approver':valid_app}
return ret
def on_submit(self):
self.validate_exp_details()
set(self.doc, 'approval_status', 'Submitted')

View File

@ -0,0 +1,3 @@
def execute():
import webnotes
webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Bin'")

View File

@ -525,4 +525,8 @@ patch_list = [
'patch_module': 'patches.july_2012',
'patch_file': 'blog_guest_permission',
},
]
{
'patch_module': 'patches.july_2012',
'patch_file': 'bin_permission',
},
]

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:27',
'creation': '2012-05-15 12:15:04',
'docstatus': 0,
'modified': '2012-03-27 14:36:27',
'modified': '2012-07-31 17:23:42',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -26,7 +26,7 @@
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 115
'version': 1
},
# These values are common for all DocField
@ -36,7 +36,7 @@
'parent': u'Bin',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 1
'permlevel': 0
},
# These values are common for all DocPerm
@ -46,6 +46,7 @@
'parent': u'Bin',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1
},
@ -58,28 +59,24 @@
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Purchase Manager'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Purchase User'
},
@ -89,7 +86,6 @@
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material User',
'submit': 0,
'write': 0
@ -101,7 +97,6 @@
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Manager',
'submit': 0,
'write': 0
@ -162,7 +157,7 @@
'doctype': u'DocField',
'fieldname': u'actual_qty',
'fieldtype': u'Currency',
'in_filter': 0,
'in_filter': 1,
'label': u'Actual Quantity',
'oldfieldname': u'actual_qty',
'oldfieldtype': u'Currency',

View File

@ -83,13 +83,17 @@ class DocType:
for d in getlist(obj.doclist, fname):
is_stock_item = get_value('Item', d.item_code, 'is_stock_item')
ar_required = get_value('Item', d.item_code, 'has_serial_no')
if cstr(d.serial_no).strip():
# [bug fix] need to strip serial nos of all spaces and new lines for validation
serial_no = cstr(d.serial_no).strip()
if serial_no:
if is_stock_item != 'Yes':
msgprint("Serial No is not required for non-stock item: %s" % d.item_code, raise_exception=1)
elif ar_required != 'Yes':
msgprint("If serial no required, please select 'Yes' in 'Has Serial No' in Item :" + d.item_code + \
', otherwise please remove serial no', raise_exception=1)
elif ar_required == 'Yes' and not d.serial_no:
elif ar_required == 'Yes' and not serial_no:
msgprint("Serial no is mandatory for item: "+ d.item_code, raise_exception = 1)
# validate rejected serial nos

View File

@ -15,6 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
report.customize_filters = function() {
this.add_filter({fieldname:'item_name', label:'Item Name', fieldtype:'Data', options:'', parent:'Item', in_first_page : 1});
this.add_filter({fieldname:'description', label:'Description', fieldtype:'Small Text', options: '', parent:'Item', in_first_page : 1});
this.add_filter({fieldname:'item_name', label:'Item Name', fieldtype:'Data', options:'', parent:'Item', in_first_page : 0});
this.add_filter({fieldname:'description', label:'Description', fieldtype:'Small Text', options: '', parent:'Item', in_first_page : 0});
this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'link', options: 'Item Group', parent:'Item', in_first_page : 1});
this.add_filter({fieldname:'brand', label:'Brand', fieldtype:'link', options: 'Brand', parent:'Item', in_first_page : 1});
}