diff --git a/data/master.sql.gz b/data/master.sql.gz index 9f2ed7f0d4..8b9fdb9889 100644 Binary files a/data/master.sql.gz and b/data/master.sql.gz differ diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index 4865b3fdf8..97b20eb702 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -26,13 +26,15 @@ cur_frm.cscript.load_taxes = function(doc, cdt, cdn, callback) { // 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 a57c33d00b..9186bb831b 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -36,7 +36,9 @@ from utilities.transaction_base import TransactionBase @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 b0569fcaaf..1f5170be96 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -30,7 +30,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) { 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 @@ cur_frm.cscript['Get Items'] = function(doc,dt,dn) { } -//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 e8af7ef39f..3d8a1011fc 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -74,16 +74,6 @@ class DocType(TransactionBase): 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'): @@ -351,16 +341,17 @@ class DocType(TransactionBase): """ Validate that if packed qty exists, it should be equal to qty """ - if not any([d.fields.get('packed_qty') for d in self.doclist]): + if not any([flt(d.fields.get('packed_qty')) for d in self.doclist if + d.doctype=='Delivery Note Detail']): return packing_error_list = [] for d in self.doclist: if d.doctype != 'Delivery Note Detail': continue - if d.fields.get('qty') != d.fields.get('packed_qty'): + if flt(d.fields.get('qty')) != flt(d.fields.get('packed_qty')): packing_error_list.append([ d.fields.get('item_code', ''), - d.fields.get('qty', ''), - d.fields.get('packed_qty', '') + d.fields.get('qty', 0), + d.fields.get('packed_qty', 0) ]) if packing_error_list: from webnotes.utils import cstr