fix in delivery note detail double entry
diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js
index 4865b3f..97b20eb 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.js
+++ b/erpnext/selling/doctype/sales_common/sales_common.js
@@ -26,13 +26,15 @@
// run if this is not executed from dt_map...
doc = locals[doc.doctype][doc.name];
if(doc.customer || getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length) {
- if(callback) callback(doc, cdt, cdn);
- return;
+ if(callback) {
+ callback(doc, cdt, cdn);
+ }
+ } else {
+ $c_obj([doc],'load_default_taxes','',function(r,rt){
+ refresh_field('other_charges');
+ if(callback) callback(doc, cdt, cdn);
+ });
}
- $c_obj([doc],'load_default_taxes','',function(r,rt){
- refresh_field('other_charges');
- if(callback) callback(doc, cdt, cdn);
- });
}
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index a57c33d..9186bb8 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -36,7 +36,9 @@
@webnotes.whitelist()
def get_comp_base_currency(arg=None):
""" get default currency of company"""
- return webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", webnotes.form_dict['company'])[0][0]
+ res = webnotes.conn.sql("""select default_currency from `tabCompany`
+ where name = %s""", webnotes.form_dict.get('company'))
+ return res and res[0][0] or None
@webnotes.whitelist()
def get_price_list_currency(arg=None):
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index b0569fc..1f5170b 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -30,7 +30,7 @@
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()});
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
- if(doc.__islocal && doc.customer) cur_frm.cscript.pull_item_details_onload(doc,dt,dn);
+ if(doc.__islocal && doc.customer) cur_frm.cscript.customer(doc,dt,dn,onload=true);
if(!doc.price_list_currency) {
set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate:1});
}
@@ -125,16 +125,6 @@
}
-//RV-DN : Pull Item details - UOM, Item Group as it was not in Sales Invoice
-//---------------------------------------------------------------------
-cur_frm.cscript.pull_item_details_onload = function(doc,dt,dn){
- var callback = function(r,rt){
- refresh_field('delivery_note_details');
- cur_frm.cscript.customer(doc,dt,dn,onload=true);
- }
- $c_obj(make_doclist(dt,dn),'set_item_details','',callback);
-}
-
//================ create new contact ============================================================================
cur_frm.cscript.new_contact = function(){
tn = createLocal('Contact');
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 99f688f..3d8a101 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -74,16 +74,6 @@
return cstr(self.doc.sales_order_no)
-
-
- #-------------------set item details -uom and item group----------------
- def set_item_details(self):
- for d in getlist(self.doclist,'delivery_note_details'):
- res = sql("select stock_uom, item_group from `tabItem` where name ='%s'"%d.item_code)
- if not d.stock_uom: d.stock_uom = res and cstr(res[0][0]) or ''
- if not d.item_group: d.item_group = res and cstr(res[0][1]) or ''
- d.save()
-
# ::::: Validates that Sales Order is not pulled twice :::::::
def validate_prev_docname(self):
for d in getlist(self.doclist, 'delivery_note_details'):