Issue fixed in stock reconciliation
This commit is contained in:
parent
5a24749456
commit
b8108c68e9
@ -13,7 +13,7 @@ wn.doclistviews['Purchase Receipt'] = wn.views.ListView.extend({
|
|||||||
{width: '3%', content:'docstatus'},
|
{width: '3%', content:'docstatus'},
|
||||||
{width: '15%', content:'name'},
|
{width: '15%', content:'name'},
|
||||||
{width: '47%', content:'supplier_name+tags', css: {color:'#222'}},
|
{width: '47%', content:'supplier_name+tags', css: {color:'#222'}},
|
||||||
{width: '15%', content:'purchase_order_no', type:'link', doctype:'Purchase Order Order'},
|
{width: '15%', content:'purchase_order_no', type:'link', doctype:'Purchase Order'},
|
||||||
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
|
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@ -60,7 +60,12 @@ class DocType:
|
|||||||
count = 1
|
count = 1
|
||||||
for s in data:
|
for s in data:
|
||||||
count += 1
|
count += 1
|
||||||
if count == 2: continue
|
if count == 2:
|
||||||
|
if s[0] != 'Item Code' or s[1] != 'Warehouse':
|
||||||
|
msgprint("First row of the attachment always should be 'Item Code, Warehouse, Quantity \
|
||||||
|
and Valuation Rate/Incoming Rate'", raise_exception=1)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
# validate
|
# validate
|
||||||
if (submit and len(s) != 4) or (not submit and len(s) != 6):
|
if (submit and len(s) != 4) or (not submit and len(s) != 6):
|
||||||
msgprint("Data entered at Row No " + cstr(count) + " in Attachment File is not in correct format.", raise_exception=1)
|
msgprint("Data entered at Row No " + cstr(count) + " in Attachment File is not in correct format.", raise_exception=1)
|
||||||
@ -172,6 +177,7 @@ class DocType:
|
|||||||
Make stock entry of qty diff, calculate incoming rate to maintain valuation rate.
|
Make stock entry of qty diff, calculate incoming rate to maintain valuation rate.
|
||||||
If no qty diff, but diff in valuation rate, make (+1,-1) entry to update valuation
|
If no qty diff, but diff in valuation rate, make (+1,-1) entry to update valuation
|
||||||
"""
|
"""
|
||||||
|
self.diff_info = ''
|
||||||
for row in self.data:
|
for row in self.data:
|
||||||
# Get qty as per system
|
# Get qty as per system
|
||||||
sys_stock = self.get_system_stock(row[0],row[1])
|
sys_stock = self.get_system_stock(row[0],row[1])
|
||||||
@ -190,29 +196,28 @@ class DocType:
|
|||||||
self.make_entry_for_valuation(row, sys_stock, is_submit)
|
self.make_entry_for_valuation(row, sys_stock, is_submit)
|
||||||
|
|
||||||
if is_submit == 1:
|
if is_submit == 1:
|
||||||
self.store_diff_info(qty_diff, rate_diff)
|
r = [cstr(i) for i in row] + [cstr(qty_diff), cstr(rate_diff)]
|
||||||
|
self.store_diff_info(r)
|
||||||
|
|
||||||
msgprint("Stock Reconciliation Completed Successfully...")
|
msgprint("Stock Reconciliation Completed Successfully...")
|
||||||
|
|
||||||
|
|
||||||
def store_diff_info(self, qty_diff, rate_diff):
|
def store_diff_info(self, r):
|
||||||
"""Add diffs column in attached file"""
|
"""Add diffs column in attached file"""
|
||||||
|
|
||||||
# add header
|
# add header
|
||||||
if self.val_method == 'Moving Average':
|
if not self.diff_info:
|
||||||
out = "Item Code, Warehouse, Qty, Valuation Rate, Qty Diff, Rate Diff"
|
if self.val_method == 'Moving Average':
|
||||||
else:
|
self.diff_info += "Item Code, Warehouse, Qty, Valuation Rate, Qty Diff, Rate Diff"
|
||||||
out = "Item Code, Warehouse, Qty, Incoming Rate, Qty Diff, Rate Diff"
|
else:
|
||||||
|
self.diff_info += "Item Code, Warehouse, Qty, Incoming Rate, Qty Diff, Rate Diff"
|
||||||
|
|
||||||
|
|
||||||
# add data
|
# add data
|
||||||
for d in self.data:
|
self.diff_info += "\n" + ','.join(r)
|
||||||
s = [cstr(i) for i in d] + [cstr(qty_diff), cstr(rate_diff)]
|
|
||||||
out += "\n" + ','.join(s)
|
webnotes.conn.set(self.doc, 'diff_info', self.diff_info)
|
||||||
|
|
||||||
webnotes.conn.set(self.doc, 'diff_info', out)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
if not self.doc.file_list:
|
if not self.doc.file_list:
|
||||||
@ -221,7 +226,6 @@ class DocType:
|
|||||||
self.do_stock_reco(is_submit = 1)
|
self.do_stock_reco(is_submit = 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
self.get_reconciliation_data(submit = 0)
|
self.get_reconciliation_data(submit = 0)
|
||||||
self.do_stock_reco(is_submit = -1)
|
self.do_stock_reco(is_submit = -1)
|
||||||
Loading…
x
Reference in New Issue
Block a user