stock reconciliation - rewrite in progress

This commit is contained in:
Nabin Hait
2013-01-07 18:51:11 +05:30
parent ea09dbcfbb
commit 9d0f636c46
18 changed files with 1002 additions and 753 deletions

View File

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