Merge branch 'master' into develop

This commit is contained in:
mbauskar
2017-08-31 15:31:47 +05:30
10 changed files with 100 additions and 29 deletions

View File

@@ -153,9 +153,11 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
if(!r.message) {
frappe.throw(__("BOM does not contain any stock item"))
} else {
erpnext.utils.remove_empty_first_row(cur_frm, "items");
$.each(r.message, function(i, item) {
var d = frappe.model.add_child(cur_frm.doc, "Material Request Item", "items");
d.item_code = item.item_code;
d.item_name = item.item_name;
d.description = item.description;
d.warehouse = values.warehouse;
d.uom = item.stock_uom;

View File

@@ -0,0 +1,28 @@
QUnit.module('manufacturing');
QUnit.test("test material request get items from BOM", function(assert) {
assert.expect(4);
let done = assert.async();
frappe.run_serially([
() => frappe.set_route('Form', 'BOM'),
() => frappe.timeout(3),
() => frappe.click_button('Get Items from BOM'),
() => frappe.timeout(3),
() => {
assert.ok(cur_dialog, 'dialog appeared');
},
() => cur_dialog.set_value('bom', 'Laptop'),
() => cur_dialog.set_value('warehouse', 'Laptop Scrap Warehouse'),
() => frappe.click_button('Get Items from BOM'),
() => frappe.timeout(3),
() => {
assert.ok(cur_frm.doc.items[0].item_code, "First row is not empty");
assert.ok(cur_frm.doc.items[0].item_name, "Item name is not empty");
assert.equal(cur_frm.doc.items[0].item_name, "Laptop", cur_frm.doc.items[0].item_name);
},
() => cur_frm.doc.items[0].schedule_date = '2017-12-12',
() => cur_frm.save(),
() => done()
]);
});