mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
stock reconciliation - rewrite in progress
This commit is contained in:
@@ -135,18 +135,24 @@ class DocType:
|
||||
where is_active = 1 and name = %s""", bom_no, as_dict=1)
|
||||
return bom and bom[0]['unit_cost'] or 0
|
||||
|
||||
def get_valuation_rate(self, arg):
|
||||
def get_valuation_rate(self, args):
|
||||
""" Get average valuation rate of relevant warehouses
|
||||
as per valuation method (MAR/FIFO)
|
||||
as on costing date
|
||||
"""
|
||||
from stock.utils import get_incoming_rate
|
||||
dt = self.doc.costing_date or nowdate()
|
||||
time = self.doc.costing_date == nowdate() and now().split()[1] or '23:59'
|
||||
warehouse = sql("select warehouse from `tabBin` where item_code = %s", arg['item_code'])
|
||||
warehouse = sql("select warehouse from `tabBin` where item_code = %s", args['item_code'])
|
||||
rate = []
|
||||
for wh in warehouse:
|
||||
r = get_obj('Valuation Control').get_incoming_rate(dt, time,
|
||||
arg['item_code'], wh[0], qty=arg.get('qty', 0))
|
||||
r = get_incoming_rate({
|
||||
item_code: args.get("item_code"),
|
||||
warehouse: wh[0],
|
||||
posting_date: dt,
|
||||
posting_time: time,
|
||||
qty: args.get("qty") or 0
|
||||
})
|
||||
if r:
|
||||
rate.append(r)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user