fix in delivery note detail double entry

This commit is contained in:
Anand Doshi 2012-03-03 16:27:48 +05:30
parent 5478842d80
commit 821cb64987
4 changed files with 12 additions and 28 deletions

View File

@ -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);
});
}

View File

@ -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):

View File

@ -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');

View File

@ -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'):