mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 05:29:18 +00:00
fix: set rate as price list rate on uom change
This commit is contained in:
@@ -228,9 +228,17 @@ frappe.ui.form.on('Material Request', {
|
|||||||
const qty_fields = ['actual_qty', 'projected_qty', 'min_order_qty'];
|
const qty_fields = ['actual_qty', 'projected_qty', 'min_order_qty'];
|
||||||
|
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
$.each(r.message, function(k, v) {
|
$.each(r.message, function(key, value) {
|
||||||
if(!d[k] || in_list(qty_fields, k)) d[k] = v;
|
if(!d[key] || in_list(qty_fields, key)) {
|
||||||
|
d[key] = value;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (d.price_list_rate != r.message.price_list_rate) {
|
||||||
|
d.price_list_rate = r.message.price_list_rate;
|
||||||
|
|
||||||
|
frappe.model.set_value(d.doctype, d.name, "rate", d.price_list_rate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -432,7 +440,6 @@ frappe.ui.form.on("Material Request Item", {
|
|||||||
item.amount = flt(item.qty) * flt(item.rate);
|
item.amount = flt(item.qty) * flt(item.rate);
|
||||||
frappe.model.set_value(doctype, name, "amount", item.amount);
|
frappe.model.set_value(doctype, name, "amount", item.amount);
|
||||||
refresh_field("amount", item.name, item.parentfield);
|
refresh_field("amount", item.name, item.parentfield);
|
||||||
frm.events.get_item_data(frm, item, false);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
item_code: function(frm, doctype, name) {
|
item_code: function(frm, doctype, name) {
|
||||||
@@ -452,7 +459,12 @@ frappe.ui.form.on("Material Request Item", {
|
|||||||
set_schedule_date(frm);
|
set_schedule_date(frm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
conversion_factor: function(frm, doctype, name) {
|
||||||
|
const item = locals[doctype][name];
|
||||||
|
frm.events.get_item_data(frm, item, false);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
erpnext.buying.MaterialRequestController = class MaterialRequestController extends erpnext.buying.BuyingController {
|
erpnext.buying.MaterialRequestController = class MaterialRequestController extends erpnext.buying.BuyingController {
|
||||||
|
|||||||
Reference in New Issue
Block a user