pull available qty in so and DN in selection of item
This commit is contained in:
parent
1bf92fe034
commit
2c2a17f138
@ -156,6 +156,10 @@ class DocType(TransactionBase):
|
|||||||
ret['export_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
|
ret['export_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
|
||||||
ret['base_ref_rate'] = flt(base_ref_rate)
|
ret['base_ref_rate'] = flt(base_ref_rate)
|
||||||
ret['basic_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
|
return ret
|
||||||
|
|
||||||
|
|
||||||
@ -172,6 +176,14 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
return ret
|
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 ********************
|
# ***************** Get Ref rate as entered in Item Master ********************
|
||||||
def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):
|
def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):
|
||||||
|
|||||||
@ -116,13 +116,7 @@ class DocType(TransactionBase):
|
|||||||
# Get projected qty of item based on warehouse selected
|
# Get projected qty of item based on warehouse selected
|
||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
def get_available_qty(self,args):
|
def get_available_qty(self,args):
|
||||||
args = eval(args)
|
return get_obj('Sales Common').get_available_qty(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
|
|
||||||
|
|
||||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||||
# ====================================================================================
|
# ====================================================================================
|
||||||
|
|||||||
@ -175,7 +175,7 @@ cur_frm.cscript.delivery_type = function(doc, cdt, cdn) {
|
|||||||
if (doc.delivery_type = 'Sample') cfn_set_fields(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];
|
var d = locals[cdt][cdn];
|
||||||
if (d.serial_no) {
|
if (d.serial_no) {
|
||||||
get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
|
get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
|
||||||
|
|||||||
@ -133,12 +133,7 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
# ********** Get Actual Qty of item in warehouse selected *************
|
# ********** Get Actual Qty of item in warehouse selected *************
|
||||||
def get_actual_qty(self,args):
|
def get_actual_qty(self,args):
|
||||||
args = eval(args)
|
return get_obj('Sales Common').get_available_qty(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
|
|
||||||
|
|
||||||
|
|
||||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user