enhancement`: Added Set Reserve Warehouse field in Purchase Order. (#19991)
This commit is contained in:
parent
8bada8759a
commit
93cb64ee30
@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"autoname": "naming_series:",
|
||||
"creation": "2013-05-21 16:16:39",
|
||||
@ -47,6 +48,7 @@
|
||||
"ignore_pricing_rule",
|
||||
"sec_warehouse",
|
||||
"set_warehouse",
|
||||
"set_reserve_warehouse",
|
||||
"col_break_warehouse",
|
||||
"is_subcontracted",
|
||||
"supplier_warehouse",
|
||||
@ -1039,12 +1041,20 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Tax Category",
|
||||
"options": "Tax Category"
|
||||
},
|
||||
{
|
||||
"depends_on": "supplied_items",
|
||||
"fieldname": "set_reserve_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"label": "Set Reserve Warehouse",
|
||||
"options": "Warehouse"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 105,
|
||||
"is_submittable": 1,
|
||||
"modified": "2019-07-11 18:25:49.509343",
|
||||
"links": [],
|
||||
"modified": "2019-12-18 13:13:22.852412",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
|
@ -1775,14 +1775,28 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
}
|
||||
},
|
||||
|
||||
set_reserve_warehouse: function() {
|
||||
this.autofill_warehouse("reserve_warehouse");
|
||||
},
|
||||
|
||||
set_warehouse: function() {
|
||||
this.autofill_warehouse("warehouse");
|
||||
},
|
||||
|
||||
autofill_warehouse : function (warehouse_field) {
|
||||
// set warehouse in all child table rows
|
||||
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);
|
||||
let warehouse = (warehouse_field === "warehouse") ? me.frm.doc.set_warehouse : me.frm.doc.set_reserve_warehouse;
|
||||
let child_table = (warehouse_field === "warehouse") ? me.frm.doc.items : me.frm.doc.supplied_items;
|
||||
let doctype = (warehouse_field === "warehouse") ? (me.frm.doctype + " Item") : (me.frm.doctype + " Item Supplied");
|
||||
|
||||
if(warehouse) {
|
||||
$.each(child_table || [], function(i, item) {
|
||||
frappe.model.set_value(doctype, item.name, warehouse_field, warehouse);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
coupon_code: function() {
|
||||
var me = this;
|
||||
frappe.run_serially([
|
||||
|
Loading…
x
Reference in New Issue
Block a user