From 437c1b512c0ab93a6fba65d7a9cb8a2654d48161 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 20 Mar 2012 18:45:28 +0530 Subject: [PATCH] listview update and form fix --- css/all-app.css | 26 +++++++--- .../doctype/journal_voucher/listview.js | 31 ++++++++++-- .../doctype/receivable_voucher/listview.js | 44 +++++++++++++++++ .../selling/doctype/sales_order/listview.js | 1 + js/all-app.js | 49 ++++++++++--------- js/all-web.js | 32 ++++++------ version.num | 2 +- 7 files changed, 135 insertions(+), 50 deletions(-) create mode 100644 erpnext/accounts/doctype/receivable_voucher/listview.js diff --git a/css/all-app.css b/css/all-app.css index 7cf3d76d405..37de7731f70 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -1515,7 +1515,6 @@ div.psidebar div.section-item, div.psidebar .section-link { margin: -1px; background: #5f83b9; color: #FFFFFF; - text-shadow: 0px 1px 1px #234386; border-color: #466086; -moz-border-radius: 0; -webkit-border-radius: 0; @@ -1630,12 +1629,23 @@ div.list-row { div.list-row:hover { background-color: #eef } + div.list-row .label { - margin-left: 3px; + margin-right: 4px; } -div.list-row .main { - margin-left: 4px; - color: #444; + +div.list-row table { + table-layout: fixed; + border-collapse: collapse; + width: 100%; +} + +div.list-row table td { + overflow: hidden; + padding-right: 3px; + vertical-align: middle; + height: 24px; + max-height: 24px; } div.paging-button { @@ -1689,9 +1699,13 @@ span.bar-inner { background-color: #bdf; height: 100%; margin-bottom: 2px; + float: left; } span.bar-complete { - background-color: green; + background-color: #009900; +} +span.bar-empty { + background-color: #990000; } diff --git a/erpnext/accounts/doctype/journal_voucher/listview.js b/erpnext/accounts/doctype/journal_voucher/listview.js index da344def894..5d7f85a7d99 100644 --- a/erpnext/accounts/doctype/journal_voucher/listview.js +++ b/erpnext/accounts/doctype/journal_voucher/listview.js @@ -2,12 +2,33 @@ wn.doclistviews['Journal Voucher'] = wn.views.ListView.extend({ init: function(d) { this._super(d); this.fields = this.fields.concat([ - '`tabJournal Voucher`.voucher_type' + '`tabJournal Voucher`.voucher_type', + '`tabJournal Voucher`.remark', + '`tabJournal Voucher`.total_debit' ]); this.stats = this.stats.concat(['voucher_type']); }, - render: function(row, data) { - this._super(row, data); - this.$main.html(data.voucher_type); - } + prepare_data: function(data) { + this._super(data); + if(!data.remark) data.remark = ''; + if(data.remark.length> 30) { + data.remark = '' + data.remark.substr(0,30) + + '...'; + } + }, + columns: [ + {width: '5%', content:'avatar'}, + {width: '3%', content:'docstatus'}, + {width: '12%', content:'name'}, + {width: '15%', content:'voucher_type'}, + {width: '38%', content:'tags+remark', css: {'color':'#aaa'}}, + { + width: '18%', + content: function(parent, data) { + $(parent).html(sys_defaults.currency + ' ' + fmt_money(data.total_debit)) + }, + css: {'text-align':'right'} + }, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ], }); \ No newline at end of file diff --git a/erpnext/accounts/doctype/receivable_voucher/listview.js b/erpnext/accounts/doctype/receivable_voucher/listview.js new file mode 100644 index 00000000000..1e43b9255a8 --- /dev/null +++ b/erpnext/accounts/doctype/receivable_voucher/listview.js @@ -0,0 +1,44 @@ +// render +wn.doclistviews['Receivable Voucher'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabReceivable Voucher`.customer", + "ifnull(`tabReceivable Voucher`.outstanding_amount,0) as outstanding_amount", + "ifnull(`tabReceivable Voucher`.grand_total,0) as grand_total", + "`tabReceivable Voucher`.currency", + "ifnull(`tabReceivable Voucher`.grand_total_export,0) as grand_total_export" + ]); + this.stats = this.stats.concat(['status']); + }, + render: function(row, data, listobj) { + + // bar color for billed + data.per_paid = flt((data.grand_total - data.outstanding_amount) / data.grand_total * 100, 2) + + data.bar_outer_class = ''; data.bar_inner_class = ''; + if(data.outstanding_amount == 0) data.bar_inner_class = 'bar-complete'; + if(data.per_paid < 1) data.bar_outer_class = 'bar-empty'; + + // lock for docstatus + data.icon = ''; + data.item_color = 'grey'; + if(data.docstatus==0) { + data.customer = '[Draft] ' + data.customer; + } else if(data.docstatus==1) { + data.item_color = 'blue'; + } else if(data.docstatus==2) { + data.item_color = 'red'; + } + + this._super(row, data); + this.$main.html(repl('%(customer)s\ + \ + \ + \ + %(currency)s %(grand_total_export)s\ + ', data)) + } +}); diff --git a/erpnext/selling/doctype/sales_order/listview.js b/erpnext/selling/doctype/sales_order/listview.js index 4b55e2b1b09..0b458109ba3 100644 --- a/erpnext/selling/doctype/sales_order/listview.js +++ b/erpnext/selling/doctype/sales_order/listview.js @@ -11,6 +11,7 @@ wn.doclistviews['Sales Order'] = wn.views.ListView.extend({ ]); this.stats = this.stats.concat(['status']); }, + render: function(row, data, listobj) { // bar color for billed diff --git a/js/all-app.js b/js/all-app.js index 20214bd75b3..44e05a0e689 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -386,17 +386,19 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i %(label)s \ (%(count)s)\ ',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}} -this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags']},render:function(row,data){this.prepare_data(data);$(row).html(repl(' \ - \ - \ - %(name)s\ - \ - %(when)s\ - \ - ',data)).addClass('list-row');this.hide_delete(row,data);this.add_user_tags(row,data);this.$main=$(row).find('.main');},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},hide_delete:function(row,data){if(this.parent.can_delete){$(row).find('.list-check').removeClass('hide');$(row).find('.list-check input').data('name',data.name);}},add_user_tags:function(row,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('' -+strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo($(row).find('.tags'));}});}}}) +this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},columns:[{width:'5%',content:'check'},{width:'5%',content:'avatar'},{width:'5%',content:'docstatus',css:{"text-align":"center"}},{width:'30%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'10%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} +if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;} +if(typeof opts.content=='function'){opts.content(parent,data);} +else if(opts.content=='name'){$(parent).html(repl('%(name)s',data));} +else if(opts.content=='avatar'){$(parent).html(repl('',data));} +else if(opts.content=='check'){$(parent).html('');$(parent).find('input').data('name',data.name);} +else if(opts.content=='docstatus'){$(parent).html(repl('',data));} +else if(opts.content=='tags'){this.add_user_tags(parent,data);} +else if(opts.content=='modified'){$(parent).append(data.when);} +else if(data[opts.content]){$(parent).append(data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('',v);});var tr=$(row).html(''+rowhtml+'
').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('' ++strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}}) /* * lib/js/wn/views/pageview.js */ @@ -742,8 +744,7 @@ this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.r Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} Field.prototype.set=function(val){if(this.not_in_form) return;if((!this.docname)&&this.grid){this.docname=this.grid.add_newrow();} -if(in_list(['Data','Text','Small Text','Code'],this.df.fieldtype)) -val=clean_smart_quotes(val);var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} +var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} Field.prototype.set_input=function(val){this.value=val;if(this.input&&this.input.set_input){if(val==null)this.input.set_input('');else this.input.set_input(val);} var disp_val=val;if(val==null)disp_val='';this.set_disp(disp_val);} Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.df.reqd&&this.get_value&&!is_null(this.get_value())&&this.set_as_error) @@ -808,7 +809,8 @@ if(cur_frm){if(val==locals[me.doctype][me.docname][me.df.fieldname]){me.set(val) me.set(val);if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect();if(!val){me.run_trigger();return;} var fetch='';if(cur_frm.fetch_dict[me.df.fieldname]) -fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':val,'options':me.df.options,'fetch':fetch},function(r,rt){if(selector&&selector.display)return;if(r.message=='Ok'){if(r.fetch_values) +fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':val,'options':me.df.options,'fetch':fetch},function(r,rt){if(selector&&selector.display)return;if(r.message=='Ok'){if($(me.txt).val()!=val){me.set_input(val);} +if(r.fetch_values) me.set_fetch_values(r.fetch_values);me.run_trigger();}else{var astr='';if(in_list(profile.can_create,me.df.options))astr=repl('

Click here to create a new %(dtl)s',{dt:me.df.options,dtl:get_doctype_label(me.df.options)}) msgprint(repl('error:%(val)s is not a valid %(dt)s.

You must first create a new %(dt)s %(val)s and then select its value. To find an existing %(dt)s, click on the magnifying glass next to the field.%(add)s',{val:me.txt.value,dt:get_doctype_label(me.df.options),add:astr}));me.txt.value='';me.set('');}});} LinkField.prototype.set_fetch_values=function(fetch_values){var fl=cur_frm.fetch_dict[this.df.fieldname].fields;var changed_fields=[];for(var i=0;i '):'';var $button=$('').click(fn).appendTo(tb);if(green){$button.addClass('btn-info');$button.find('i').addClass('icon-white');} @@ -1422,8 +1424,7 @@ this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.r Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} Field.prototype.set=function(val){if(this.not_in_form) return;if((!this.docname)&&this.grid){this.docname=this.grid.add_newrow();} -if(in_list(['Data','Text','Small Text','Code'],this.df.fieldtype)) -val=clean_smart_quotes(val);var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} +var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} Field.prototype.set_input=function(val){this.value=val;if(this.input&&this.input.set_input){if(val==null)this.input.set_input('');else this.input.set_input(val);} var disp_val=val;if(val==null)disp_val='';this.set_disp(disp_val);} Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.df.reqd&&this.get_value&&!is_null(this.get_value())&&this.set_as_error) @@ -1488,7 +1489,8 @@ if(cur_frm){if(val==locals[me.doctype][me.docname][me.df.fieldname]){me.set(val) me.set(val);if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect();if(!val){me.run_trigger();return;} var fetch='';if(cur_frm.fetch_dict[me.df.fieldname]) -fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':val,'options':me.df.options,'fetch':fetch},function(r,rt){if(selector&&selector.display)return;if(r.message=='Ok'){if(r.fetch_values) +fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':val,'options':me.df.options,'fetch':fetch},function(r,rt){if(selector&&selector.display)return;if(r.message=='Ok'){if($(me.txt).val()!=val){me.set_input(val);} +if(r.fetch_values) me.set_fetch_values(r.fetch_values);me.run_trigger();}else{var astr='';if(in_list(profile.can_create,me.df.options))astr=repl('

Click here to create a new %(dtl)s',{dt:me.df.options,dtl:get_doctype_label(me.df.options)}) msgprint(repl('error:%(val)s is not a valid %(dt)s.

You must first create a new %(dt)s %(val)s and then select its value. To find an existing %(dt)s, click on the magnifying glass next to the field.%(add)s',{val:me.txt.value,dt:get_doctype_label(me.df.options),add:astr}));me.txt.value='';me.set('');}});} LinkField.prototype.set_fetch_values=function(fetch_values){var fl=cur_frm.fetch_dict[this.df.fieldname].fields;var changed_fields=[];for(var i=0;iCreated:
\ \ %(creation)s

\ diff --git a/js/all-web.js b/js/all-web.js index ca0521245a6..94fe44ff49d 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -300,17 +300,19 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i %(label)s \ (%(count)s)\ ',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}} -this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags']},render:function(row,data){this.prepare_data(data);$(row).html(repl(' \ - \ - \ - %(name)s\ - \ - %(when)s\ - \ - ',data)).addClass('list-row');this.hide_delete(row,data);this.add_user_tags(row,data);this.$main=$(row).find('.main');},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},hide_delete:function(row,data){if(this.parent.can_delete){$(row).find('.list-check').removeClass('hide');$(row).find('.list-check input').data('name',data.name);}},add_user_tags:function(row,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('' -+strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo($(row).find('.tags'));}});}}}) +this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},columns:[{width:'5%',content:'check'},{width:'5%',content:'avatar'},{width:'5%',content:'docstatus',css:{"text-align":"center"}},{width:'30%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'10%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} +if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;} +if(typeof opts.content=='function'){opts.content(parent,data);} +else if(opts.content=='name'){$(parent).html(repl('%(name)s',data));} +else if(opts.content=='avatar'){$(parent).html(repl('',data));} +else if(opts.content=='check'){$(parent).html('');$(parent).find('input').data('name',data.name);} +else if(opts.content=='docstatus'){$(parent).html(repl('',data));} +else if(opts.content=='tags'){this.add_user_tags(parent,data);} +else if(opts.content=='modified'){$(parent).append(data.when);} +else if(data[opts.content]){$(parent).append(data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('',v);});var tr=$(row).html(''+rowhtml+'
').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('' ++strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}}) /* * lib/js/wn/views/pageview.js */ @@ -639,8 +641,7 @@ this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.r Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} Field.prototype.set=function(val){if(this.not_in_form) return;if((!this.docname)&&this.grid){this.docname=this.grid.add_newrow();} -if(in_list(['Data','Text','Small Text','Code'],this.df.fieldtype)) -val=clean_smart_quotes(val);var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} +var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} Field.prototype.set_input=function(val){this.value=val;if(this.input&&this.input.set_input){if(val==null)this.input.set_input('');else this.input.set_input(val);} var disp_val=val;if(val==null)disp_val='';this.set_disp(disp_val);} Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.df.reqd&&this.get_value&&!is_null(this.get_value())&&this.set_as_error) @@ -705,7 +706,8 @@ if(cur_frm){if(val==locals[me.doctype][me.docname][me.df.fieldname]){me.set(val) me.set(val);if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect();if(!val){me.run_trigger();return;} var fetch='';if(cur_frm.fetch_dict[me.df.fieldname]) -fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':val,'options':me.df.options,'fetch':fetch},function(r,rt){if(selector&&selector.display)return;if(r.message=='Ok'){if(r.fetch_values) +fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':val,'options':me.df.options,'fetch':fetch},function(r,rt){if(selector&&selector.display)return;if(r.message=='Ok'){if($(me.txt).val()!=val){me.set_input(val);} +if(r.fetch_values) me.set_fetch_values(r.fetch_values);me.run_trigger();}else{var astr='';if(in_list(profile.can_create,me.df.options))astr=repl('

Click here to create a new %(dtl)s',{dt:me.df.options,dtl:get_doctype_label(me.df.options)}) msgprint(repl('error:%(val)s is not a valid %(dt)s.

You must first create a new %(dt)s %(val)s and then select its value. To find an existing %(dt)s, click on the magnifying glass next to the field.%(add)s',{val:me.txt.value,dt:get_doctype_label(me.df.options),add:astr}));me.txt.value='';me.set('');}});} LinkField.prototype.set_fetch_values=function(fetch_values){var fl=cur_frm.fetch_dict[this.df.fieldname].fields;var changed_fields=[];for(var i=0;i '):'';var $button=$('').click(fn).appendTo(tb);if(green){$button.addClass('btn-info');$button.find('i').addClass('icon-white');} diff --git a/version.num b/version.num index c73013a35e3..c8846577bdb 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1244 \ No newline at end of file +1280 \ No newline at end of file