Minor fix in delivery note, show paking items in order, show serial no of the respective item in the dropdown of packing item

This commit is contained in:
Rohit Waghchaure 2016-11-18 12:16:22 +05:30
parent 05d0cd9574
commit e887e92dd4
2 changed files with 30 additions and 16 deletions

View File

@ -66,27 +66,41 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
});
}
if(this.frm.fields_dict["packed_items"].grid.get_field('batch_no')) {
this.frm.set_query("batch_no", "packed_items", function(doc, cdt, cdn) {
return me.set_query_for_batch(doc, cdt, cdn)
});
}
if(this.frm.fields_dict["items"].grid.get_field('batch_no')) {
this.frm.set_query("batch_no", "items", function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
if(!item.item_code) {
frappe.throw(__("Please enter Item Code to get batch no"));
} else {
filters = {
'item_code': item.item_code,
'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
}
if(item.warehouse) filters["warehouse"] = item.warehouse
return {
query : "erpnext.controllers.queries.get_batch_no",
filters: filters
}
}
return me.set_query_for_batch(doc, cdt, cdn)
});
}
},
set_query_for_batch: function(doc, cdt, cdn) {
// Show item's batches in the dropdown of batch no
var me = this;
var item = frappe.get_doc(cdt, cdn);
if(!item.item_code) {
frappe.throw(__("Please enter Item Code to get batch no"));
} else {
filters = {
'item_code': item.item_code,
'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
}
if(item.warehouse) filters["warehouse"] = item.warehouse
return {
query : "erpnext.controllers.queries.get_batch_no",
filters: filters
}
}
},
refresh: function() {
this._super();
this.frm.toggle_display("customer_name",

View File

@ -16,7 +16,7 @@ class PackedItem(Document):
def get_product_bundle_items(item_code):
return frappe.db.sql("""select t1.item_code, t1.qty, t1.uom, t1.description
from `tabProduct Bundle Item` t1, `tabProduct Bundle` t2
where t2.new_item_code=%s and t1.parent = t2.name""", item_code, as_dict=1)
where t2.new_item_code=%s and t1.parent = t2.name order by t1.idx""", item_code, as_dict=1)
def get_packing_item_details(item):
return frappe.db.sql("""select item_name, description, stock_uom from `tabItem`