Added Default Warehouse field that sets all item's warehouse (#15462)
* -Added field def_warehouse that sets warehouse of all items -Grouped warehouse fields together and put raw materies supplied before items table, it will only show if there are any items supplied * Set def_warehouse in test_sales_order.py * Changed from def_warehouse to set_warehouse * Rest of def_warehouse to set_warehouse
This commit is contained in:
@@ -98,6 +98,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
frm.cscript.calculate_taxes_and_totals();
|
||||
});
|
||||
|
||||
frappe.ui.form.on(this.frm.doctype + " Item", {
|
||||
items_add: function(frm, cdt, cdn) {
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
if(!item.warehouse && frm.doc.set_warehouse) {
|
||||
item.warehouse = frm.doc.set_warehouse;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var me = this;
|
||||
if(this.frm.fields_dict["items"].grid.get_field('batch_no')) {
|
||||
this.frm.set_query("batch_no", "items", function(doc, cdt, cdn) {
|
||||
@@ -1463,6 +1472,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
set_warehouse: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.set_warehouse) {
|
||||
$.each(this.frm.doc.items || [], function(i, item) {
|
||||
frappe.model.set_value(me.frm.doctype + " Item", item.name, "warehouse", me.frm.doc.set_warehouse);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user