first cut error fixes
This commit is contained in:
parent
902e8609e5
commit
26d46556a4
@ -8,8 +8,6 @@ def execute():
|
||||
from stock.stock_ledger import update_entries_after
|
||||
for d in res:
|
||||
update_entries_after({
|
||||
item_code: d.item_code,
|
||||
warehouse: d.warehouse,
|
||||
posting_date: '2000-01-01',
|
||||
posting_time: '12:01'
|
||||
"item_code": d.item_code,
|
||||
"warehouse": d.warehouse,
|
||||
})
|
||||
|
@ -82,10 +82,10 @@ def cleanup_wrong_sle():
|
||||
webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3])
|
||||
create_comment(d[3])
|
||||
update_entries_after({
|
||||
item_code: d[0],
|
||||
warehouse: d[1],
|
||||
posting_date: "2012-07-01",
|
||||
posting_time: "12:05"
|
||||
"item_code": d[0],
|
||||
"warehouse": d[1],
|
||||
"posting_date": "2012-07-01",
|
||||
"posting_time": "12:05"
|
||||
})
|
||||
|
||||
def create_comment(dn):
|
||||
|
@ -22,12 +22,7 @@ def execute():
|
||||
i=0
|
||||
for d in res:
|
||||
try:
|
||||
update_entries_after({
|
||||
item_code: d[0],
|
||||
warehouse: d[1],
|
||||
posting_date: "2000-01-01",
|
||||
posting_time: "12:00"
|
||||
})
|
||||
update_entries_after({ "item_code": d[0], "warehouse": d[1] })
|
||||
except:
|
||||
pass
|
||||
i += 1
|
||||
|
@ -45,10 +45,10 @@ class DocType:
|
||||
if args.get("actual_qty"):
|
||||
# update valuation and qty after transaction for post dated entry
|
||||
update_entries_after({
|
||||
item_code: self.doc.item_code,
|
||||
warehouse: self.doc.warehouse,
|
||||
posting_date: args.get("posting_date"),
|
||||
posting_time: args.get("posting_time")
|
||||
"item_code": self.doc.item_code,
|
||||
"warehouse": self.doc.warehouse,
|
||||
"posting_date": args.get("posting_date"),
|
||||
"posting_time": args.get("posting_time")
|
||||
})
|
||||
|
||||
def update_qty(self, args):
|
||||
|
@ -157,14 +157,13 @@ class DocType(TransactionBase):
|
||||
"""get stock and incoming rate on posting date"""
|
||||
for d in getlist(self.doclist, 'mtn_details'):
|
||||
args = {
|
||||
item_code: d.item_code,
|
||||
warehouse: d.s_warehouse or d.t_warehouse,
|
||||
posting_date: self.doc.posting_date,
|
||||
posting_time: self.doc.posting_time,
|
||||
qty: d.transfer_qty,
|
||||
serial_no: d.serial_no,
|
||||
bom_no: d.bom_no
|
||||
|
||||
"item_code": d.item_code,
|
||||
"warehouse": d.s_warehouse or d.t_warehouse,
|
||||
"posting_date": self.doc.posting_date,
|
||||
"posting_time": self.doc.posting_time,
|
||||
"qty": d.transfer_qty,
|
||||
"serial_no": d.serial_no,
|
||||
"bom_no": d.bom_no
|
||||
}
|
||||
# get actual stock at source warehouse
|
||||
d.actual_qty = get_previous_sle(args).get("qty_after_transaction") or 0
|
||||
@ -308,8 +307,8 @@ class DocType(TransactionBase):
|
||||
import json
|
||||
args, actual_qty, in_rate = json.loads(args), 0, 0
|
||||
args.update({
|
||||
posting_date: self.doc.posting_date,
|
||||
posting_time: self.doc.posting_time
|
||||
"posting_date": self.doc.posting_date,
|
||||
"posting_time": self.doc.posting_time
|
||||
})
|
||||
|
||||
ret = {
|
||||
|
@ -205,10 +205,10 @@ class DocType(DocListController):
|
||||
# repost future entries for selected item_code, warehouse
|
||||
for entries in existing_entries:
|
||||
update_entries_after({
|
||||
item_code: entries.item_code,
|
||||
warehouse: entries.warehouse,
|
||||
posting_date: self.doc.posting_date,
|
||||
posting_time: self.doc.posting_time
|
||||
"item_code": entries.item_code,
|
||||
"warehouse": entries.warehouse,
|
||||
"posting_date": self.doc.posting_date,
|
||||
"posting_time": self.doc.posting_time
|
||||
})
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ class DocType:
|
||||
if flt(self.doc.conversion_factor) != flt(1):
|
||||
wh = sql("select name from `tabWarehouse`")
|
||||
for w in wh:
|
||||
update_entries_after({item_code: self.doc.item_code, warehouse: w[0]})
|
||||
update_entries_after({"item_code": self.doc.item_code, "warehouse": w[0]})
|
||||
|
||||
# acknowledge user
|
||||
msgprint("Item Valuation Updated Successfully.")
|
||||
|
@ -121,12 +121,7 @@ class DocType:
|
||||
if not warehouse:
|
||||
warehouse = self.doc.name
|
||||
|
||||
update_entries_after({
|
||||
item_code: item_code,
|
||||
warehouse: warehouse,
|
||||
posting_date: '1900-01-01',
|
||||
posting_time = '10:00'
|
||||
})
|
||||
update_entries_after({ "item_code": item_code, "warehouse": warehouse })
|
||||
|
||||
def repost_reserved_qty(self, bin):
|
||||
reserved_qty = webnotes.conn.sql("""
|
||||
|
@ -16,8 +16,9 @@
|
||||
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.utils import cint
|
||||
from webnotes.utils import cint, flt, cstr
|
||||
from stock.utils import _msgprint, get_valuation_method
|
||||
import json
|
||||
|
||||
# future reposting
|
||||
|
||||
@ -67,7 +68,7 @@ def update_entries_after(args, verbose=1):
|
||||
qty_after_transaction += flt(sle.actual_qty)
|
||||
|
||||
# get stock value
|
||||
if serial_nos:
|
||||
if sle.serial_nos:
|
||||
stock_value = qty_after_transaction * valuation_rate
|
||||
elif valuation_method == "Moving Average":
|
||||
stock_value = (qty_after_transaction > 0) and \
|
||||
@ -101,7 +102,7 @@ def get_sle_before_datetime(args):
|
||||
entries between the cancelled entries in the same time-bucket
|
||||
"""
|
||||
sle = get_stock_ledger_entries(args,
|
||||
["timestamp(posting_date, posting_time) < timestamp(%%(posting_date)s, %%(posting_time)s)"],
|
||||
["timestamp(posting_date, posting_time) < timestamp(%(posting_date)s, %(posting_time)s)"],
|
||||
"limit 1")
|
||||
|
||||
return sle and sle[0] or webnotes._dict()
|
||||
@ -109,7 +110,7 @@ def get_sle_before_datetime(args):
|
||||
def get_sle_after_datetime(args):
|
||||
"""get Stock Ledger Entries after a particular datetime, for reposting"""
|
||||
return get_stock_ledger_entries(args,
|
||||
["timestamp(posting_date, posting_time) > timestamp(%%(posting_date)s, %%(posting_time)s)"])
|
||||
["timestamp(posting_date, posting_time) > timestamp(%(posting_date)s, %(posting_time)s)"])
|
||||
|
||||
def get_stock_ledger_entries(args, conditions=None, limit=None):
|
||||
"""get stock ledger entries filtered by specific posting datetime conditions"""
|
||||
|
@ -77,12 +77,11 @@ def get_previous_sle(args):
|
||||
"sle": "name of reference Stock Ledger Entry"
|
||||
}
|
||||
"""
|
||||
if not args.get("posting_date"):
|
||||
args["posting_date"] = "1900-01-01"
|
||||
if not args.get("posting_time"):
|
||||
args["posting_time"] = "12:00"
|
||||
if not args.get("posting_date"): args["posting_date"] = "1900-01-01"
|
||||
if not args.get("posting_time"): args["posting_time"] = "12:00"
|
||||
if not args.get("sle"): args["sle"] = ""
|
||||
|
||||
sle = sql("""
|
||||
sle = webnotes.conn.sql("""
|
||||
select * from `tabStock Ledger Entry`
|
||||
where item_code = %(item_code)s
|
||||
and warehouse = %(warehouse)s
|
||||
|
Loading…
Reference in New Issue
Block a user