[WIP] Alternative items (#13705)

* Alternative Items in BOM

* Alternative Items in Work Order
This commit is contained in:
Doridel Cahanap
2018-05-16 13:28:39 +08:00
committed by Rushabh Mehta
parent 0cde6ae3c5
commit e42192bb6c
4 changed files with 179 additions and 3 deletions

View File

@@ -287,9 +287,13 @@ erpnext.utils.select_alternate_items = function(opts) {
alternative_items.forEach(d => {
let row = frappe.get_doc(opts.child_doctype, d.docname);
let qty = row.qty;
let qty = null;
if (row.doctype === 'Work Order Item') {
qty = row.required_qty;
} else {
qty = row.qty;
}
row[item_field] = d.alternate_item;
frm.script_manager.trigger(item_field, row.doctype, row.name)
.then(() => {
frappe.model.set_value(row.doctype, row.name, 'qty', qty);