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

View File

@ -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
# ==================================================================================== # ====================================================================================

View File

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