[minor] fixes in stock balance report, bin uom and sle is_cancelled

This commit is contained in:
Nabin Hait 2013-10-02 16:29:45 +05:30
parent a37ff498fe
commit a1d1c980bc
7 changed files with 24 additions and 6 deletions

View File

View File

@ -0,0 +1,13 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.conn.sql("""update `tabStock Ledger Entry` set is_cancelled = 'No'
where ifnull(is_cancelled, '') = ''""")
webnotes.conn.sql("""update tabBin b set b.stock_uom =
(select i.stock_uom from tabItem i where i.name = b.item_code)
where b.created_on>='2013-09-01'""")

View File

@ -219,4 +219,5 @@ patch_list = [
"execute:webnotes.conn.set_value('Accounts Settings', None, 'frozen_accounts_modifier', 'Accounts Manager') # 2013-09-24",
"patches.september_2013.p04_unsubmit_serial_nos",
"patches.september_2013.p05_fix_customer_in_pos",
"patches.october_2013.fix_is_cancelled_in_sle",
]

View File

@ -29,6 +29,8 @@ erpnext.StockGridReport = wn.views.TreeGridReport.extend({
if(add_qty)
wh.fifo_stack.push([add_qty, sl.incoming_rate, sl.posting_date]);
if(sl.serial_no) value_diff = this.get_serialized_value_diff(sl);
} else {
// outgoing
if(sl.serial_no) {
@ -98,7 +100,7 @@ erpnext.StockGridReport = wn.views.TreeGridReport.extend({
$.each(sl.serial_no.trim().split("\n"), function(i, sr) {
if(sr) {
value_diff += flt(me.serialized_buying_rates[sr.trim()]);
value_diff += flt(me.serialized_buying_rates[sr.trim().toLowerCase()]);
}
});
@ -112,7 +114,7 @@ erpnext.StockGridReport = wn.views.TreeGridReport.extend({
if(sle.qty > 0 && sle.serial_no) {
$.each(sle.serial_no.trim().split("\n"), function(i, sr) {
if(sr && sle.incoming_rate !== undefined) {
serialized_buying_rates[sr.trim()] = flt(sle.incoming_rate);
serialized_buying_rates[sr.trim().toLowerCase()] = flt(sle.incoming_rate);
}
});
}

View File

@ -16,7 +16,7 @@ class DocType:
self.doclist = doclist
def validate(self):
if not self.doc.stock_uom:
if self.doc.fields.get("__islocal") or not self.doc.stock_uom:
self.doc.stock_uom = webnotes.conn.get_value('Item', self.doc.item_code, 'stock_uom')
self.validate_mandatory()

View File

@ -246,6 +246,7 @@ class DocType(StockController):
"stock_uom": webnotes.conn.get_value("Item", row.item_code, "stock_uom"),
"voucher_detail_no": row.voucher_detail_no,
"fiscal_year": self.doc.fiscal_year,
"is_cancelled": "No"
})
args.update(opts)
self.make_sl_entries([args])

View File

@ -126,10 +126,11 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
} else {
item.inflow_value += value_diff;
}
}
item.closing_qty += qty_diff;
item.closing_value += value_diff;
item.closing_qty += qty_diff;
item.closing_value += value_diff;
}
} else {
break;
}