Merge branch 'master' into cms2
diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py
index 2f84a9c..66a0d65 100644
--- a/erpnext/accounts/doctype/gl_control/gl_control.py
+++ b/erpnext/accounts/doctype/gl_control/gl_control.py
@@ -484,11 +484,13 @@
Create recurring invoices on specific date by copying the original one
and notify the concerned people
"""
- rv = webnotes.conn.sql("""select name, recurring_id from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0) = 1
- and next_date = %s and next_date <= ifnull(end_date, '2199-12-31') and docstatus=1""", nowdate())
+ rv = webnotes.conn.sql("""select name, recurring_id from `tabSales Invoice` \
+ where ifnull(convert_into_recurring_invoice, 0) = 1 and next_date = %s \
+ and next_date <= ifnull(end_date, '2199-12-31') and docstatus=1""", nowdate())
for d in rv:
- if not webnotes.conn.sql("""select name from `tabSales Invoice` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
+ if not webnotes.conn.sql("""select name from `tabSales Invoice` \
+ where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
prev_rv = get_obj('Sales Invoice', d[0], with_children=1)
new_rv = create_new_invoice(prev_rv)
@@ -499,13 +501,16 @@
# clone rv
new_rv = clone(prev_rv)
+ mdict = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
+ mcount = mdict[prev_rv.doc.recurring_type]
+
# update new rv
new_rv.doc.posting_date = new_rv.doc.next_date
new_rv.doc.aging_date = new_rv.doc.next_date
new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
- new_rv.doc.invoice_period_from_date = get_next_month_date(new_rv.doc.invoice_period_from_date)
- new_rv.doc.invoice_period_to_date = get_next_month_date(new_rv.doc.invoice_period_to_date)
+ new_rv.doc.invoice_period_from_date = get_next_date(new_rv.doc.invoice_period_from_date, mcount)
+ new_rv.doc.invoice_period_to_date = get_next_date(new_rv.doc.invoice_period_to_date, mcount)
new_rv.doc.owner = prev_rv.doc.owner
new_rv.doc.save()
@@ -515,13 +520,13 @@
return new_rv
-def get_next_month_date(dt):
+def get_next_date(dt, mcount):
import datetime
- m = getdate(dt).month + 1
+ m = getdate(dt).month + mcount
y = getdate(dt).year
d = getdate(dt).day
if m > 12:
- m, y = 1, y+1
+ m, y = m-12, y+1
try:
next_month_date = datetime.date(y, m, d)
except:
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 7b62684..f07c7b3 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -686,7 +686,9 @@
def convert_into_recurring(self):
if self.doc.convert_into_recurring_invoice:
- if not self.doc.invoice_period_from_date or not self.doc.invoice_period_to_date:
+ if not self.doc.recurring_type:
+ msgprint("Please select recurring type", raise_exception=1)
+ elif not self.doc.invoice_period_from_date or not self.doc.invoice_period_to_date:
msgprint("Invoice period from date and to date is mandatory for recurring invoice", raise_exception=1)
self.set_next_date()
if not self.doc.recurring_id:
@@ -702,10 +704,11 @@
will be generated e.g. 05, 28 etc.""", raise_exception=1)
import datetime
- m = getdate(self.doc.posting_date).month + 1
+ mcount = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
+ m = getdate(self.doc.posting_date).month + mcount[self.doc.recurring_type]
y = getdate(self.doc.posting_date).year
if m > 12:
- m, y = 1, y+1
+ m, y = m-12, y+1
try:
next_date = datetime.date(y, m, cint(self.doc.repeat_on_day_of_month))
except:
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt
index d2439c8..969a7dc 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-13 11:56:18',
+ 'creation': '2012-06-11 12:09:54',
'docstatus': 0,
- 'modified': '2012-06-04 14:40:59',
+ 'modified': '2012-06-17 21:37:40',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -1484,6 +1484,21 @@
{
'allow_on_submit': 1,
'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
+ 'description': u'Select the period when the invoice will be generated automatically',
+ 'doctype': u'DocField',
+ 'fieldname': u'recurring_type',
+ 'fieldtype': u'Select',
+ 'label': u'Recurring Type',
+ 'no_copy': 1,
+ 'options': u'Monthly\nQuarterly\nHalf-yearly\nYearly',
+ 'permlevel': 0,
+ 'print_hide': 1
+ },
+
+ # DocField
+ {
+ 'allow_on_submit': 1,
+ 'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
'description': u'The day of the month on which auto invoice will be generated e.g. 05, 28 etc ',
'doctype': u'DocField',
'fieldname': u'repeat_on_day_of_month',
diff --git a/erpnext/accounts/search_criteria/purchase_register/purchase_register.py b/erpnext/accounts/search_criteria/purchase_register/purchase_register.py
index 0601a62..bb58d77 100644
--- a/erpnext/accounts/search_criteria/purchase_register/purchase_register.py
+++ b/erpnext/accounts/search_criteria/purchase_register/purchase_register.py
@@ -15,6 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# add expense head columns
+from webnotes.utils import flt, cint, cstr
+
expense_acc = [c[0] for c in sql("""select distinct expense_head
from `tabPurchase Invoice Item`
where parenttype='Purchase Invoice'
@@ -39,7 +41,7 @@
order by account_head asc""")]
tax_acc.append('Total Tax')
-tax_acc.append('GrandTotal')
+tax_acc.append('Grand Total')
for c in tax_acc:
if c:
@@ -58,56 +60,41 @@
exp_head_amount = sql("""select expense_head, sum(amount)
from `tabPurchase Invoice Item`
where parent = %s and parenttype='Purchase Invoice'
- group by expense_head""", (r[col_idx['ID']],))
+ group by expense_head""", (r[col_idx['ID']]))
#convert the result to dictionary for easy retrieval
exp_head_amount_dict = {}
for e in exp_head_amount:
exp_head_amount_dict[e[0]] = e[1]
- exp_head_keys = exp_head_amount_dict.keys()
-
- net_total = 0
-
+ net_total = 0
# get expense amount
for i in expense_acc:
- val = 0
-
- #check if expense head exists in dict
- if i in exp_head_keys:
- val = exp_head_amount_dict[i]
- val = flt(val and val or 0)
+ val = exp_head_amount_dict.get(i, 0)
net_total += val
- r.append(val)
-
+ r.append(val)
r.append(net_total)
#Get tax for account heads
- acc_head_tax = sql("""select account_head, tax_amount
+ acc_head_tax = sql("""select account_head, sum(tax_amount)
from `tabPurchase Taxes and Charges`
where parent = '%s'
and parenttype = 'Purchase Invoice'
and add_deduct_tax = 'Add'
- and category in ('For Total', 'For Both')""" %(r[col_idx['ID']],))
+ and category in ('For Total', 'For Both')
+ group by account_head
+ """ %(r[col_idx['ID']],))
#Convert the result to dictionary for easy retrieval
acc_head_tax_dict = {}
for a in acc_head_tax:
- acc_head_tax_dict[a[0]] = a[1]
+ acc_head_tax_dict[a[0]] = flt(a[1])
- acc_head_keys = acc_head_tax_dict.keys()
-
# get tax amount
total_tax = 0
- grand_total = 0
- for c in tax_acc:
- val = 0
- if c:
- #check if account head exists in dict
- if c in acc_head_keys:
- val = acc_head_tax_dict[c]
- val = flt(val and val or 0)
- total_tax += val
- r.append(val)
+ for c in tax_acc:
+ val = acc_head_tax_dict.get(c, 0)
+ total_tax += val
+ r.append(val)
r.append(total_tax)
r.append(flt(total_tax)+ flt(net_total)) # grand total
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/sales_register/sales_register.py b/erpnext/accounts/search_criteria/sales_register/sales_register.py
index 9fdfb00..c99948e 100644
--- a/erpnext/accounts/search_criteria/sales_register/sales_register.py
+++ b/erpnext/accounts/search_criteria/sales_register/sales_register.py
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# add additional columns
+from webnotes.utils import flt, cint, cstr
cl = [c[0] for c in sql("""select distinct account_head
from `tabSales Taxes and Charges`
@@ -61,41 +62,30 @@
#convert the result to dictionary for easy retrieval
income_acc_dict = {}
for ia in income_acc_list:
- income_acc_dict[ia[0]] = ia[1]
+ income_acc_dict[ia[0]] = flt(ia[1])
- income_acc_keys = income_acc_dict.keys()
-
net_total = 0
for i in income_acc:
- val = 0
- #check if income account exists in dict
- if i in income_acc_keys:
- val = income_acc_dict[i]
- val = flt(val and val or 0)
+ val = income_acc_dict.get(i, 0)
net_total += val
r.append(val)
r.append(net_total)
#Get tax for account heads
- acc_head_tax = sql("""select account_head, tax_amount
+ acc_head_tax = sql("""select account_head, sum(tax_amount)
from `tabSales Taxes and Charges`
where parent = '%s'
- and parenttype = 'Sales Invoice'""" %(r[col_idx['ID']],))
+ and parenttype = 'Sales Invoice'
+ group by account_head""" %(r[col_idx['ID']],))
#Convert the result to dictionary for easy retrieval
acc_head_tax_dict = {}
for a in acc_head_tax:
- acc_head_tax_dict[a[0]] = a[1]
-
- acc_head_keys = acc_head_tax_dict.keys()
+ acc_head_tax_dict[a[0]] = flt(a[1])
total_tax = 0
for c in cl:
- val = 0
- #check if account head exists in dict
- if c in acc_head_keys:
- val = acc_head_tax_dict[c]
- val = flt(val and val or 0)
+ val = acc_head_tax_dict.get(c, 0)
total_tax += val
r.append(val)
r.append(total_tax)
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 524e03d..67a2aae 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -108,7 +108,7 @@
msgprint("Supplier Type is mandatory")
raise Exception
- if not sql("select name from tabAccount where name=%s", (self.doc.supplier_type + " - " + abbr)):
+ if not sql("select name from tabAccount where name=%s and debit_or_credit = 'Credit' and ifnull(is_pl_account, 'No') = 'No'", (self.doc.supplier_type + " - " + abbr)):
# if not group created , create it
self.add_account(self.doc.supplier_type, self.get_payables_group(), abbr)
diff --git a/erpnext/patches/june_2012/set_recurring_type.py b/erpnext/patches/june_2012/set_recurring_type.py
new file mode 100644
index 0000000..bfb925c
--- /dev/null
+++ b/erpnext/patches/june_2012/set_recurring_type.py
@@ -0,0 +1,6 @@
+def execute():
+ import webnotes
+ from webnotes.model.sync import sync
+ sync('accounts', 'sales_invoice')
+
+ webnotes.conn.sql("update `tabSales Invoice` set recurring_type = 'Monthly' where ifnull(convert_into_recurring_invoice, 0) = 1")
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index 98c3aff..fd734a9 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -442,4 +442,9 @@
'patch_file': 'series_unique_patch',
'description': "add unique constraint to series table's name column"
},
+ {
+ 'patch_module': 'patches.june_2012',
+ 'patch_file': 'set_recurring_type',
+ 'description': "set recurring type as monthly in old"
+ },
]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/lead/lead.js b/erpnext/selling/doctype/lead/lead.js
index 5d43449..389dce0 100644
--- a/erpnext/selling/doctype/lead/lead.js
+++ b/erpnext/selling/doctype/lead/lead.js
@@ -45,15 +45,24 @@
cur_frm.cscript.make_communication_body();
}
+cur_frm.cscript.refresh_custom_buttons = function() {
+ cur_frm.clear_custom_buttons();
+ if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
+ if (doc.source != 'Existing Customer') {
+ cur_frm.add_custom_button('Create Customer',
+ cur_frm.cscript['Create Customer']);
+ }
+ cur_frm.add_custom_button('Create Opportunity',
+ cur_frm.cscript['Create Opportunity']);
+ cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
+ }
+}
+
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// custom buttons
//---------------
- cur_frm.clear_custom_buttons()
- if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
- if (doc.source != 'Existing Customer') cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
- cur_frm.add_custom_button('Create Opportunity', cur_frm.cscript['Create Opportunity']);
- cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
- }
+ cur_frm.cscript.refresh_custom_buttons();
+
erpnext.hide_naming_series();
if (!doc.__islocal) cur_frm.cscript.render_communication_list(doc, cdt, cdn);
diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py
index d4405b3..3f4a39c 100644
--- a/erpnext/website/doctype/web_page/web_page.py
+++ b/erpnext/website/doctype/web_page/web_page.py
@@ -25,7 +25,7 @@
"""name from title"""
self.doc.name = website.utils.page_name(self.doc.title)
- def validate(self):
+ def on_update(self):
"""make page for this product"""
from jinja2 import Template
import os
@@ -45,6 +45,9 @@
self.doc.content = Template(f.read()).render(doc=self.doc)
self.cleanup_temp()
+
+ self.doc.save()
+
self.if_home_clear_cache()
def cleanup_temp(self):
diff --git a/public/js/all-app.js b/public/js/all-app.js
index 859af21..5e3f8f2 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -350,7 +350,8 @@
if(df.fieldtype=='Check'){df.fieldtype='Select';df.options='No\nYes';}else if(['Text','Text Editor','Code','Link'].indexOf(df.fieldtype)!=-1){df.fieldtype='Data';}},set_default_condition:function(df,fieldtype){if(!fieldtype){if(df.fieldtype=='Data'){this.$w.find('.condition').val('like');}else{this.$w.find('.condition').val('=');}}},get_value:function(){var me=this;var val=me.field.get_value();var cond=me.$w.find('.condition').val();if(me.field.df.original_type=='Check'){val=(val=='Yes'?1:0);}
if(cond=='like'){val=val+'%';}
return[me.fieldselect.$select.find('option:selected').attr('table'),me.field.df.fieldname,me.$w.find('.condition').val(),cstr(val)];}});wn.ui.FieldSelect=Class.extend({init:function(parent,doctype,filter_fields,with_blank){this.doctype=doctype;this.fields_by_name={};this.with_blank=with_blank;this.$select=$('<select>').appendTo(parent);if(filter_fields){for(var i in filter_fields)
-this.add_field_option(this.filter_fields[i])}else{this.build_options();}},build_options:function(){var me=this;me.table_fields=[];var std_filters=[{fieldname:'name',fieldtype:'Data',label:'ID',parent:me.doctype},{fieldname:'modified',fieldtype:'Date',label:'Last Modified',parent:me.doctype},{fieldname:'owner',fieldtype:'Data',label:'Created By',parent:me.doctype},{fieldname:'creation',fieldtype:'Date',label:'Created On',parent:me.doctype},{fieldname:'_user_tags',fieldtype:'Data',label:'Tags',parent:me.doctype}];if(this.with_blank){this.$select.append($('<option>',{value:''}).text(''));}
+this.add_field_option(this.filter_fields[i])}else{this.build_options();}},build_options:function(){var me=this;me.table_fields=[];var std_filters=[{fieldname:'name',fieldtype:'Data',label:'ID',parent:me.doctype},{fieldname:'modified',fieldtype:'Date',label:'Last Modified',parent:me.doctype},{fieldname:'owner',fieldtype:'Data',label:'Created By',parent:me.doctype},{fieldname:'creation',fieldtype:'Date',label:'Created On',parent:me.doctype},{fieldname:'_user_tags',fieldtype:'Data',label:'Tags',parent:me.doctype},{fieldname:'docstatus',fieldtype:'Int',label:'Doc Status',parent:me.doctype},];var doctype_obj=locals['DocType'][me.doctype];if(doctype_obj&&cint(doctype_obj.istable)){std_filters=std_filters.concat([{fieldname:'parent',fieldtype:'Data',label:'Parent',parent:me.doctype}]);}
+if(this.with_blank){this.$select.append($('<option>',{value:''}).text(''));}
$.each(std_filters.concat(wn.meta.docfield_list[me.doctype]),function(i,df){me.add_field_option(df);});$.each(me.table_fields,function(i,table_df){if(table_df.options){$.each(wn.meta.docfield_list[table_df.options],function(i,df){me.add_field_option(df);});}});},add_field_option:function(df){var me=this;if(me.doctype&&df.parent==me.doctype){var label=df.label;var table=me.doctype;if(df.fieldtype=='Table')me.table_fields.push(df);}else{var label=df.label+' ('+df.parent+')';var table=df.parent;}
if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!me.fields_by_name[df.fieldname]){this.$select.append($('<option>',{value:df.fieldname,table:table}).text(label));me.fields_by_name[df.fieldname]=df;}}})
/*
@@ -1744,7 +1745,7 @@
if(f.fieldtype=='Section Break'){sec=fld;this.sections.push(fld);}
if((f.fieldtype=='Section Break')&&(fl[i+1])&&(fl[i+1].fieldtype!='Column Break')&&!f.hidden){var c=this.layout.addcell();$y(c.wrapper,{padding:'8px'});}}}
_f.Frm.prototype.add_custom_button=function(label,fn,icon){this.frm_head.appframe.add_button(label,fn,icon);}
-_f.Frm.prototype.clear_custom_buttons=function(){}
+_f.Frm.prototype.clear_custom_buttons=function(){this.frm_head.refresh_toolbar()}
_f.Frm.prototype.add_fetch=function(link_field,src_field,tar_field){if(!this.fetch_dict[link_field]){this.fetch_dict[link_field]={'columns':[],'fields':[]}}
this.fetch_dict[link_field].columns.push(src_field);this.fetch_dict[link_field].fields.push(tar_field);}
_f.Frm.prototype.setup_client_script=function(){if(this.meta.client_script_core||this.meta.client_script||this.meta.__js){this.runclientscript('setup',this.doctype,this.docname);}}
@@ -2201,7 +2202,7 @@
wn.widgets.form.sidebar.Attachment=function(parent,filedet,frm){filedet=filedet.split(',')
this.filename=filedet[0];this.fileid=filedet[1];this.frm=frm;var me=this;this.wrapper=$a(parent,'div','sidebar-comment-message');this.remove_fileid=function(){var doc=locals[me.frm.doctype][me.frm.docname];var fl=doc.file_list.split('\n');new_fl=[];for(var i=0;i<fl.length;i++){if(fl[i].split(',')[1]!=me.fileid)new_fl.push(fl[i]);}
doc.file_list=new_fl.join('\n');}
-var display_name=this.fileid;if(this.fileid.substr(0,8)=='FileData')
+var display_name=this.fileid;if(this.fileid&&this.fileid.substr(0,8)=='FileData')
display_name=this.filename;this.ln=$a(this.wrapper,'a','link_type small',{},display_name);this.ln.href='files/'+this.fileid;this.ln.target='_blank';this.del=$a(this.wrapper,'span','close','','×');this.del.onclick=function(){var yn=confirm("Are you sure you want to delete the attachment?")
if(yn){var callback=function(r,rt){locals[me.frm.doctype][me.frm.docname].modified=r.message;$dh(me.wrapper);me.remove_fileid();frm.refresh();}
$c('webnotes.widgets.form.utils.remove_attach',args={'fid':me.fileid,dt:me.frm.doctype,dn:me.frm.docname},callback);}}}
diff --git a/public/js/all-web.js b/public/js/all-web.js
index 1f70310..a549dc9 100644
--- a/public/js/all-web.js
+++ b/public/js/all-web.js
@@ -237,7 +237,8 @@
if(df.fieldtype=='Check'){df.fieldtype='Select';df.options='No\nYes';}else if(['Text','Text Editor','Code','Link'].indexOf(df.fieldtype)!=-1){df.fieldtype='Data';}},set_default_condition:function(df,fieldtype){if(!fieldtype){if(df.fieldtype=='Data'){this.$w.find('.condition').val('like');}else{this.$w.find('.condition').val('=');}}},get_value:function(){var me=this;var val=me.field.get_value();var cond=me.$w.find('.condition').val();if(me.field.df.original_type=='Check'){val=(val=='Yes'?1:0);}
if(cond=='like'){val=val+'%';}
return[me.fieldselect.$select.find('option:selected').attr('table'),me.field.df.fieldname,me.$w.find('.condition').val(),cstr(val)];}});wn.ui.FieldSelect=Class.extend({init:function(parent,doctype,filter_fields,with_blank){this.doctype=doctype;this.fields_by_name={};this.with_blank=with_blank;this.$select=$('<select>').appendTo(parent);if(filter_fields){for(var i in filter_fields)
-this.add_field_option(this.filter_fields[i])}else{this.build_options();}},build_options:function(){var me=this;me.table_fields=[];var std_filters=[{fieldname:'name',fieldtype:'Data',label:'ID',parent:me.doctype},{fieldname:'modified',fieldtype:'Date',label:'Last Modified',parent:me.doctype},{fieldname:'owner',fieldtype:'Data',label:'Created By',parent:me.doctype},{fieldname:'creation',fieldtype:'Date',label:'Created On',parent:me.doctype},{fieldname:'_user_tags',fieldtype:'Data',label:'Tags',parent:me.doctype}];if(this.with_blank){this.$select.append($('<option>',{value:''}).text(''));}
+this.add_field_option(this.filter_fields[i])}else{this.build_options();}},build_options:function(){var me=this;me.table_fields=[];var std_filters=[{fieldname:'name',fieldtype:'Data',label:'ID',parent:me.doctype},{fieldname:'modified',fieldtype:'Date',label:'Last Modified',parent:me.doctype},{fieldname:'owner',fieldtype:'Data',label:'Created By',parent:me.doctype},{fieldname:'creation',fieldtype:'Date',label:'Created On',parent:me.doctype},{fieldname:'_user_tags',fieldtype:'Data',label:'Tags',parent:me.doctype},{fieldname:'docstatus',fieldtype:'Int',label:'Doc Status',parent:me.doctype},];var doctype_obj=locals['DocType'][me.doctype];if(doctype_obj&&cint(doctype_obj.istable)){std_filters=std_filters.concat([{fieldname:'parent',fieldtype:'Data',label:'Parent',parent:me.doctype}]);}
+if(this.with_blank){this.$select.append($('<option>',{value:''}).text(''));}
$.each(std_filters.concat(wn.meta.docfield_list[me.doctype]),function(i,df){me.add_field_option(df);});$.each(me.table_fields,function(i,table_df){if(table_df.options){$.each(wn.meta.docfield_list[table_df.options],function(i,df){me.add_field_option(df);});}});},add_field_option:function(df){var me=this;if(me.doctype&&df.parent==me.doctype){var label=df.label;var table=me.doctype;if(df.fieldtype=='Table')me.table_fields.push(df);}else{var label=df.label+' ('+df.parent+')';var table=df.parent;}
if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!me.fields_by_name[df.fieldname]){this.$select.append($('<option>',{value:df.fieldname,table:table}).text(label));me.fields_by_name[df.fieldname]=df;}}})
/*