2017-09-07 13:46:38 +00:00
|
|
|
QUnit.test("test:Sales Invoice", function(assert) {
|
|
|
|
assert.expect(3);
|
2017-07-27 13:45:06 +00:00
|
|
|
let done = assert.async();
|
|
|
|
|
|
|
|
frappe.run_serially([
|
|
|
|
() => {
|
|
|
|
return frappe.tests.make("POS Profile", [
|
|
|
|
{naming_series: "SINV"},
|
2017-11-06 17:22:41 +00:00
|
|
|
{pos_profile_name: "_Test POS Profile"},
|
2017-07-27 13:45:06 +00:00
|
|
|
{country: "India"},
|
|
|
|
{currency: "INR"},
|
2017-09-07 13:46:38 +00:00
|
|
|
{write_off_account: "Write Off - FT"},
|
|
|
|
{write_off_cost_center: "Main - FT"},
|
2017-07-27 13:45:06 +00:00
|
|
|
{payments: [
|
|
|
|
[
|
|
|
|
{"default": 1},
|
|
|
|
{"mode_of_payment": "Cash"}
|
|
|
|
]]
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
() => cur_frm.save(),
|
|
|
|
() => frappe.timeout(2),
|
|
|
|
() => {
|
|
|
|
assert.equal(cur_frm.doc.payments[0].default, 1, "Default mode of payment tested");
|
|
|
|
},
|
2017-09-07 13:46:38 +00:00
|
|
|
() => frappe.timeout(1),
|
2017-07-27 13:45:06 +00:00
|
|
|
() => {
|
|
|
|
return frappe.tests.make("Sales Invoice", [
|
2017-08-20 05:29:48 +00:00
|
|
|
{customer: "Test Customer 2"},
|
2017-07-27 13:45:06 +00:00
|
|
|
{is_pos: 1},
|
|
|
|
{posting_date: frappe.datetime.get_today()},
|
|
|
|
{due_date: frappe.datetime.get_today()},
|
|
|
|
{items: [
|
|
|
|
[
|
2017-08-20 05:29:48 +00:00
|
|
|
{"item_code": "Test Product 1"},
|
|
|
|
{"qty": 5},
|
2017-09-07 13:46:38 +00:00
|
|
|
{"warehouse":'Stores - FT'}
|
2017-07-27 13:45:06 +00:00
|
|
|
]]
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
() => frappe.timeout(2),
|
|
|
|
() => cur_frm.save(),
|
|
|
|
() => frappe.timeout(2),
|
|
|
|
() => {
|
|
|
|
assert.equal(cur_frm.doc.payments[0].default, 1, "Default mode of payment tested");
|
|
|
|
assert.equal(cur_frm.doc.payments[0].mode_of_payment, "Cash", "Default mode of payment tested");
|
|
|
|
},
|
|
|
|
() => done()
|
|
|
|
]);
|
|
|
|
});
|