fix: Dont overwrite default warehouse in Material Request
This commit is contained in:
parent
a8fea8df98
commit
392f323d2d
@ -180,9 +180,8 @@ frappe.ui.form.on('Material Request', {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
get_item_data: function(frm, item) {
|
get_item_data: function(frm, item, overwrite_warehouse=false) {
|
||||||
if (item && !item.item_code) { return; }
|
if (item && !item.item_code) { return; }
|
||||||
|
|
||||||
frm.call({
|
frm.call({
|
||||||
method: "erpnext.stock.get_item_details.get_item_details",
|
method: "erpnext.stock.get_item_details.get_item_details",
|
||||||
child: item,
|
child: item,
|
||||||
@ -203,7 +202,8 @@ frappe.ui.form.on('Material Request', {
|
|||||||
plc_conversion_rate: 1,
|
plc_conversion_rate: 1,
|
||||||
rate: item.rate,
|
rate: item.rate,
|
||||||
conversion_factor: item.conversion_factor
|
conversion_factor: item.conversion_factor
|
||||||
}
|
},
|
||||||
|
overwrite_warehouse: overwrite_warehouse
|
||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
const d = item;
|
const d = item;
|
||||||
@ -354,29 +354,29 @@ frappe.ui.form.on("Material Request Item", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const item = locals[doctype][name];
|
const item = locals[doctype][name];
|
||||||
frm.events.get_item_data(frm, item);
|
frm.events.get_item_data(frm, item, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
from_warehouse: function(frm, doctype, name) {
|
from_warehouse: function(frm, doctype, name) {
|
||||||
const item = locals[doctype][name];
|
const item = locals[doctype][name];
|
||||||
frm.events.get_item_data(frm, item);
|
frm.events.get_item_data(frm, item, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
warehouse: function(frm, doctype, name) {
|
warehouse: function(frm, doctype, name) {
|
||||||
const item = locals[doctype][name];
|
const item = locals[doctype][name];
|
||||||
frm.events.get_item_data(frm, item);
|
frm.events.get_item_data(frm, item, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
rate: function(frm, doctype, name) {
|
rate: function(frm, doctype, name) {
|
||||||
const item = locals[doctype][name];
|
const item = locals[doctype][name];
|
||||||
frm.events.get_item_data(frm, item);
|
frm.events.get_item_data(frm, item, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
item_code: function(frm, doctype, name) {
|
item_code: function(frm, doctype, name) {
|
||||||
const item = locals[doctype][name];
|
const item = locals[doctype][name];
|
||||||
item.rate = 0;
|
item.rate = 0;
|
||||||
set_schedule_date(frm);
|
set_schedule_date(frm);
|
||||||
frm.events.get_item_data(frm, item);
|
frm.events.get_item_data(frm, item, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
schedule_date: function(frm, cdt, cdn) {
|
schedule_date: function(frm, cdt, cdn) {
|
||||||
|
@ -47,6 +47,8 @@ def get_item_details(args, doc=None, for_validate=False, overwrite_warehouse=Tru
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
args = process_args(args)
|
args = process_args(args)
|
||||||
|
for_validate = process_string_args(for_validate)
|
||||||
|
overwrite_warehouse = process_string_args(overwrite_warehouse)
|
||||||
item = frappe.get_cached_doc("Item", args.item_code)
|
item = frappe.get_cached_doc("Item", args.item_code)
|
||||||
validate_item_details(args, item)
|
validate_item_details(args, item)
|
||||||
|
|
||||||
@ -166,6 +168,10 @@ def process_args(args):
|
|||||||
set_transaction_type(args)
|
set_transaction_type(args)
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
def process_string_args(args):
|
||||||
|
if isinstance(args, string_types):
|
||||||
|
args = json.loads(args)
|
||||||
|
return args
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_item_code(barcode=None, serial_no=None):
|
def get_item_code(barcode=None, serial_no=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user