[fix] [minor] stock balance report for serialized item

This commit is contained in:
Nabin Hait 2013-11-15 13:38:23 +05:30
parent c10621a5be
commit e505fbea54
4 changed files with 18 additions and 15 deletions

View File

@ -25,7 +25,11 @@ erpnext.StockGridReport = wn.views.TreeGridReport.extend({
add_qty = 0; add_qty = 0;
} }
} }
if(sl.serial_no) {
var value_diff = this.get_serialized_value_diff(sl);
} else {
var value_diff = (rate * add_qty); var value_diff = (rate * add_qty);
}
if(add_qty) if(add_qty)
wh.fifo_stack.push([add_qty, sl.incoming_rate, sl.posting_date]); wh.fifo_stack.push([add_qty, sl.incoming_rate, sl.posting_date]);
@ -108,15 +112,8 @@ erpnext.StockGridReport = wn.views.TreeGridReport.extend({
get_serialized_buying_rates: function() { get_serialized_buying_rates: function() {
var serialized_buying_rates = {}; var serialized_buying_rates = {};
$.each(wn.report_dump.data["Stock Ledger Entry"], function(i, sle) { $.each(wn.report_dump.data["Serial No"], function(i, sn) {
if(sle.qty > 0 && sle.serial_no) { serialized_buying_rates[sn.name.toLowerCase()] = flt(sn.incoming_rate);
$.each(sle.serial_no.trim().split("\n"), function(i, sr) {
if(sr && sle.incoming_rate !== undefined
&& !serialized_buying_rates[sr.trim().toLowerCase()]) {
serialized_buying_rates[sr.trim().toLowerCase()] = flt(sle.incoming_rate);
}
});
}
}); });
return serialized_buying_rates; return serialized_buying_rates;

View File

@ -502,13 +502,14 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
var company_currency = this.get_company_currency(); var company_currency = this.get_company_currency();
if(!this.frm.doc.conversion_rate) { if(!this.frm.doc.conversion_rate) {
wn.throw(wn._('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange \ wn.throw(repl('%(conversion_rate_label)s' +
record is not created for %(from_currency)s to %(to_currency)s'), wn._(' is mandatory. Maybe Currency Exchange record is not created for ') +
'%(from_currency)s' + wn._(" to ") + '%(to_currency)s',
{ {
"conversion_rate_label": conversion_rate_label, "conversion_rate_label": conversion_rate_label,
"from_currency": self.doc.currency, "from_currency": this.frm.doc.currency,
"to_currency": company_currency "to_currency": company_currency
}); }));
} }
}, },

View File

@ -88,6 +88,11 @@ data_map = {
}, },
"force_index": "posting_sort_index" "force_index": "posting_sort_index"
}, },
"Serial No": {
"columns": ["name", "purchase_rate as incoming_rate"],
"conditions": ["docstatus < 2"],
"order_by": "name"
},
"Stock Entry": { "Stock Entry": {
"columns": ["name", "purpose"], "columns": ["name", "purpose"],
"conditions": ["docstatus=1"], "conditions": ["docstatus=1"],

View File

@ -22,7 +22,7 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
this._super(wrapper, { this._super(wrapper, {
title: "Stock Balance", title: "Stock Balance",
doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand", doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand",
"Stock Entry", "Project"], "Stock Entry", "Project", "Serial No"],
}); });
}, },
setup_columns: function() { setup_columns: function() {