pull available qty in so and DN in selection of item

This commit is contained in:
Nabin Hait 2012-06-27 15:14:58 +05:30
parent 1bf92fe034
commit 2c2a17f138
4 changed files with 15 additions and 14 deletions

View File

@ -156,6 +156,10 @@ class DocType(TransactionBase):
ret['export_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
ret['base_ref_rate'] = flt(base_ref_rate)
ret['basic_rate'] = flt(base_ref_rate)
if ret['warehouse'] or ret['reserved_warehouse']:
av_qty = self.get_available_qty({'item_code': args['item_code'], 'warehouse': ret['warehouse'] or ret['reserved_warehouse']})
ret.update(av_qty)
return ret
@ -172,6 +176,14 @@ class DocType(TransactionBase):
return ret
def get_available_qty(self,args):
tot_avail_qty = webnotes.conn.sql("select projected_qty, actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
ret = {
'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
}
return ret
# ***************** Get Ref rate as entered in Item Master ********************
def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):

View File

@ -116,13 +116,7 @@ class DocType(TransactionBase):
# Get projected qty of item based on warehouse selected
# -----------------------------------------------------
def get_available_qty(self,args):
args = eval(args)
tot_avail_qty = sql("select projected_qty, actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
ret = {
'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
}
return ret
return get_obj('Sales Common').get_available_qty(eval(args))
# OTHER CHARGES TRIGGER FUNCTIONS
# ====================================================================================

View File

@ -175,7 +175,7 @@ cur_frm.cscript.delivery_type = function(doc, cdt, cdn) {
if (doc.delivery_type = 'Sample') cfn_set_fields(doc, cdt, cdn);
}
cur_frm.cscript.serial_no = function(doc, cdt , cdn) {
cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if (d.serial_no) {
get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);

View File

@ -133,12 +133,7 @@ class DocType(TransactionBase):
# ********** Get Actual Qty of item in warehouse selected *************
def get_actual_qty(self,args):
args = eval(args)
actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
ret = {
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
}
return ret
return get_obj('Sales Common').get_available_qty(eval(args))
# OTHER CHARGES TRIGGER FUNCTIONS