[new feature] Product Configurator (via Item Quick Entry) (#11535)

* [Feature] Item Variant Creation from Quick Entry

* [minor] formatted js

* [minor] set 3 attribute per page instead of 5 in template

* [fix] fixed codecy issue

* [fix] label translation

* [minor] changed trigger event of item template

* [fix] moved item ui tests under stock

* [UI test] added test for item attribute

* [UI test] added test for creation of item variant from quick entry

* [fix] item variant ui test fixes

* [wip]

* [cleanup] item quick entry

* [remove] tests, fixtures were missing

* [refactor] use set_only_once in item
This commit is contained in:
Rushabh Mehta
2017-11-14 15:27:28 +05:30
committed by Nabin Hait
parent 4d99ebaeb5
commit d5c6416d91
11 changed files with 501 additions and 110 deletions

View File

@@ -1,120 +0,0 @@
QUnit.test("test: item", function (assert) {
assert.expect(6);
let done = assert.async();
let keyboard_cost = 800;
let screen_cost = 4000;
let CPU_cost = 15000;
let scrap_cost = 100;
let no_of_items_to_stock = 100;
let is_stock_item = 1;
frappe.run_serially([
// test item creation
() => frappe.set_route("List", "Item"),
// Create a keyboard item
() => frappe.tests.make(
"Item", [
{item_code: "Keyboard"},
{item_group: "Products"},
{is_stock_item: is_stock_item},
{standard_rate: keyboard_cost},
{opening_stock: no_of_items_to_stock},
{default_warehouse: "Stores - FT"}
]
),
() => {
assert.ok(cur_frm.doc.item_name.includes('Keyboard'),
'Item Keyboard created correctly');
assert.ok(cur_frm.doc.item_code.includes('Keyboard'),
'item_code for Keyboard set correctly');
assert.ok(cur_frm.doc.item_group.includes('Products'),
'item_group for Keyboard set correctly');
assert.equal(cur_frm.doc.is_stock_item, is_stock_item,
'is_stock_item for Keyboard set correctly');
assert.equal(cur_frm.doc.standard_rate, keyboard_cost,
'standard_rate for Keyboard set correctly');
assert.equal(cur_frm.doc.opening_stock, no_of_items_to_stock,
'opening_stock for Keyboard set correctly');
},
// Create a Screen item
() => frappe.tests.make(
"Item", [
{item_code: "Screen"},
{item_group: "Products"},
{is_stock_item: is_stock_item},
{standard_rate: screen_cost},
{opening_stock: no_of_items_to_stock},
{default_warehouse: "Stores - FT"}
]
),
// Create a CPU item
() => frappe.tests.make(
"Item", [
{item_code: "CPU"},
{item_group: "Products"},
{is_stock_item: is_stock_item},
{standard_rate: CPU_cost},
{opening_stock: no_of_items_to_stock},
{default_warehouse: "Stores - FT"}
]
),
// Create a laptop item
() => frappe.tests.make(
"Item", [
{item_code: "Laptop"},
{item_group: "Products"},
{default_warehouse: "Stores - FT"}
]
),
() => frappe.tests.make(
"Item", [
{item_code: "Computer"},
{item_group: "Products"},
{is_stock_item: 0},
]
),
// Create a scrap item
() => frappe.tests.make(
"Item", [
{item_code: "Scrap item"},
{item_group: "Products"},
{is_stock_item: is_stock_item},
{standard_rate: scrap_cost},
{opening_stock: no_of_items_to_stock},
{default_warehouse: "Stores - FT"}
]
),
() => frappe.tests.make(
"Item", [
{item_code: "Test Product 4"},
{item_group: "Products"},
{is_stock_item: 1},
{has_batch_no: 1},
{create_new_batch: 1},
{uoms:
[
[
{uom:"Unit"},
{conversion_factor: 10},
]
]
},
{taxes:
[
[
{tax_type:"SGST - "+frappe.get_abbr(frappe.defaults.get_default("Company"))},
{tax_rate: 0},
]
]},
{has_serial_no: 1},
{standard_rate: 100},
{opening_stock: 100},
]
),
() => done()
]);
});