[fix] [minor] [stock entry] call get_items even if item exists and on saved document

This commit is contained in:
Nabin Hait 2013-08-17 12:38:23 +05:30
parent 176f3afd14
commit c46d044efe
2 changed files with 9 additions and 11 deletions

View File

@ -122,16 +122,15 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
}, },
get_items: function() { get_items: function() {
if(this.frm.doc.__islocal && (this.frm.doc.production_order || this.frm.doc.bom_no) if(this.frm.doc.production_order || this.frm.doc.bom_no) {
&& !getchildren('Stock Entry Detail', this.frm.doc.name, 'mtn_details').length) { // if production order / bom is mentioned, get items
// if production order / bom is mentioned, get items return this.frm.call({
return this.frm.call({ doc: this.frm.doc,
doc: this.frm.doc, method: "get_items",
method: "get_items", callback: function(r) {
callback: function(r) { if(!r.exc) refresh_field("mtn_details");
if(!r.exc) refresh_field("mtn_details"); }
} });
});
} }
}, },

View File

@ -571,7 +571,6 @@ class DocType(StockController):
for item in item_dict: for item in item_dict:
pending_to_issue = (max_qty * item_dict[item]["qty"]) - issued_item_qty.get(item, 0) pending_to_issue = (max_qty * item_dict[item]["qty"]) - issued_item_qty.get(item, 0)
desire_to_transfer = flt(self.doc.fg_completed_qty) * item_dict[item]["qty"] desire_to_transfer = flt(self.doc.fg_completed_qty) * item_dict[item]["qty"]
if desire_to_transfer <= pending_to_issue: if desire_to_transfer <= pending_to_issue:
item_dict[item]["qty"] = desire_to_transfer item_dict[item]["qty"] = desire_to_transfer
else: else: