This commit is contained in:
Rushabh Mehta 2012-03-22 11:37:56 +05:30
commit 27cf13b541
7 changed files with 19 additions and 12 deletions

View File

@ -162,7 +162,7 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) {
// Recalculate Button // Recalculate Button
// ------------------- // -------------------
cur_frm.cscript['Recalculate'] = function(doc, dt, dn) { cur_frm.cscript['Recalculate'] = function(doc, cdt, cdn) {
cur_frm.cscript['Calculate Tax'](doc,cdt,cdn); cur_frm.cscript['Calculate Tax'](doc,cdt,cdn);
calc_total_advance(doc,cdt,cdn); calc_total_advance(doc,cdt,cdn);
} }

View File

@ -111,6 +111,7 @@ fld.get_query = function(doc, cdt, cdn) {
+'AND ifnull(`tabBin`.`actual_qty`,0) > 0 ' +'AND ifnull(`tabBin`.`actual_qty`,0) > 0 '
+'AND tabBin.warehouse="'+ d.s_warehouse +'" ' +'AND tabBin.warehouse="'+ d.s_warehouse +'" '
+'AND tabItem.docstatus < 2 ' +'AND tabItem.docstatus < 2 '
+'AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") '
+'AND tabItem.%(key)s LIKE "%s" ' +'AND tabItem.%(key)s LIKE "%s" '
+'ORDER BY tabItem.name ASC ' +'ORDER BY tabItem.name ASC '
+'LIMIT 50' +'LIMIT 50'
@ -118,6 +119,7 @@ fld.get_query = function(doc, cdt, cdn) {
return 'SELECT tabItem.name, tabItem.description ' return 'SELECT tabItem.name, tabItem.description '
+'FROM tabItem ' +'FROM tabItem '
+'WHERE tabItem.docstatus < 2 ' +'WHERE tabItem.docstatus < 2 '
+'AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") '
+'AND tabItem.%(key)s LIKE "%s" ' +'AND tabItem.%(key)s LIKE "%s" '
+'ORDER BY tabItem.name ASC ' +'ORDER BY tabItem.name ASC '
+'LIMIT 50' +'LIMIT 50'

View File

@ -21,7 +21,7 @@
.todoitem .ref_link { .todoitem .ref_link {
float: left; float: left;
margin-left: 14px; margin-left: 10px;
display: inline-block; display: inline-block;
line-height: 18px; line-height: 18px;
} }

View File

@ -45,10 +45,15 @@ erpnext.todo.ToDoItem = Class.extend({
'Low':'' 'Low':''
} }
todo.labelclass = label_map[todo.priority]; todo.labelclass = label_map[todo.priority];
todo.userdate = dateutil.str_to_user(todo.date); todo.userdate = dateutil.str_to_user(todo.date) || '';
if(todo.assigned_by) {
todo.fullname = repl("[By %(fullname)s] ", {
fullname: wn.boot.user_info[todo.assigned_by].fullname
})
}
if(todo.reference_name && todo.reference_type) { if(todo.reference_name && todo.reference_type) {
todo.link = repl('<a href="#!Form/%(reference_type)s/%(reference_name)s">\ todo.link = repl('<a href="#!Form/%(reference_type)s/%(reference_name)s">\
%(reference_name)s</a>', todo); %(reference_type)s: %(reference_name)s</a>', todo);
} else if(todo.reference_type) { } else if(todo.reference_type) {
todo.link = repl('<a href="#!List/%(reference_type)s">\ todo.link = repl('<a href="#!List/%(reference_type)s">\
%(reference_type)s</a>', todo); %(reference_type)s</a>', todo);
@ -59,8 +64,8 @@ erpnext.todo.ToDoItem = Class.extend({
<span class="description">\ <span class="description">\
<span class="label %(labelclass)s">%(priority)s</span>\ <span class="label %(labelclass)s">%(priority)s</span>\
<span class="help" style="margin-right: 7px">%(userdate)s</span>\ <span class="help" style="margin-right: 7px">%(userdate)s</span>\
%(description)s</span>\ %(fullname)s%(description)s</span>\
<span class="ref_link">&rarr;\ <span class="ref_link">&rarr; &nbsp;\
%(link)s</span>\ %(link)s</span>\
<a href="#" class="close">&times;</a>\ <a href="#" class="close">&times;</a>\
</div>', todo)); </div>', todo));

View File

@ -81,12 +81,12 @@ class TransactionBase:
cond = 'name="%s"' % address_name cond = 'name="%s"' % address_name
if is_shipping_address: if is_shipping_address:
details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1) details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1)
else: else:
details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1) details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1)
extract = lambda x: details and details[0] and details[0].get(x,'') or '' extract = lambda x: details and details[0] and details[0].get(x,'') or ''
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone')] address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone'),('\nFax: ', 'fax')]
address_display = ''.join([a[0]+extract(a[1]) for a in address_fields if extract(a[1])]) address_display = ''.join([a[0]+extract(a[1]) for a in address_fields if extract(a[1])])
if address_display.startswith('\n'): address_display = address_display[1:] if address_display.startswith('\n'): address_display = address_display[1:]

View File

@ -2148,7 +2148,7 @@ wn.widgets.form.sidebar.AssignTo=Class.extend({init:function(parent,sidebar,doct
this.refresh();},refresh:function(){var me=this;$c('webnotes.widgets.form.assign_to.get',{doctype:me.doctype,name:me.name},function(r,rt){me.render(r.message)})},render:function(d){var me=this;$(this.body).empty();if(this.dialog){this.dialog.hide();} this.refresh();},refresh:function(){var me=this;$c('webnotes.widgets.form.assign_to.get',{doctype:me.doctype,name:me.name},function(r,rt){me.render(r.message)})},render:function(d){var me=this;$(this.body).empty();if(this.dialog){this.dialog.hide();}
for(var i=0;i<d.length;i++){$(this.body).append(repl('<div>%(owner)s \ for(var i=0;i<d.length;i++){$(this.body).append(repl('<div>%(owner)s \
<a class="close" href="#" data-owner="%(owner)s">&#215</a></div>',d[i]))} <a class="close" href="#" data-owner="%(owner)s">&#215</a></div>',d[i]))}
$(this.body).find('a.close').click(function(){$c('webnotes.widgets.form.assign_to.remove',{doctype:me.doctype,name:me.name,assign_to:$(this).attr('data-owner')},function(r,rt){me.render(r.message);});return false;});},add:function(){var me=this;if(!me.dialog){me.dialog=new wn.widgets.Dialog({title:'Add to To Do',width:350,fields:[{fieldtype:'Link',fieldname:'assign_to',options:'Profile',label:'Assign To',description:'Add to To Do List of',reqd:true},{fieldtype:'Data',fieldname:'description',label:'Comment','default':'Assigned by '+user},{fieldtype:'Date',fieldname:'date',label:'Complete By'},{fieldtype:'Select',fieldname:'priority',label:'Priority',options:'Low\nMedium\nHigh','default':'Medium'},{fieldtype:'Check',fieldname:'notify',label:'Notify By Email'},{fieldtype:'Button',label:'Add',fieldname:'add_btn'}]});me.dialog.fields_dict.add_btn.input.onclick=function(){var assign_to=me.dialog.fields_dict.assign_to.get_value();if(assign_to){$c('webnotes.widgets.form.assign_to.add',{doctype:me.doctype,name:me.name,assign_to:assign_to,description:me.dialog.fields_dict.description.get_value(),priority:me.dialog.fields_dict.priority.get_value(),date:me.dialog.fields_dict.date.get_value(),notify:me.dialog.fields_dict.notify.get_value()},function(r,rt){me.render(r.message);});}}} $(this.body).find('a.close').click(function(){$c('webnotes.widgets.form.assign_to.remove',{doctype:me.doctype,name:me.name,assign_to:$(this).attr('data-owner')},function(r,rt){me.render(r.message);});return false;});},add:function(){var me=this;if(!me.dialog){me.dialog=new wn.widgets.Dialog({title:'Add to To Do',width:350,fields:[{fieldtype:'Link',fieldname:'assign_to',options:'Profile',label:'Assign To',description:'Add to To Do List of',reqd:true},{fieldtype:'Data',fieldname:'description',label:'Comment'},{fieldtype:'Date',fieldname:'date',label:'Complete By'},{fieldtype:'Select',fieldname:'priority',label:'Priority',options:'Low\nMedium\nHigh','default':'Medium'},{fieldtype:'Check',fieldname:'notify',label:'Notify By Email'},{fieldtype:'Button',label:'Add',fieldname:'add_btn'}]});me.dialog.fields_dict.add_btn.input.onclick=function(){var assign_to=me.dialog.fields_dict.assign_to.get_value();if(assign_to){$c('webnotes.widgets.form.assign_to.add',{doctype:me.doctype,name:me.name,assign_to:assign_to,description:me.dialog.fields_dict.description.get_value(),priority:me.dialog.fields_dict.priority.get_value(),date:me.dialog.fields_dict.date.get_value(),notify:me.dialog.fields_dict.notify.get_value()},function(r,rt){me.render(r.message);});}}}
me.dialog.clear();me.dialog.show();}}); me.dialog.clear();me.dialog.show();}});
/* /*
* lib/js/legacy/app.js * lib/js/legacy/app.js