Fixes for updating item variant from template (#10975)

* Fixes for updating item variant from template

* More fixes for test cases
This commit is contained in:
Nabin Hait
2017-09-29 15:11:50 +05:30
committed by GitHub
parent 9c339145b2
commit 945f502748
8 changed files with 22 additions and 16 deletions

View File

@@ -120,6 +120,8 @@ class TestItem(unittest.TestCase):
self.assertRaises(ItemVariantExistsError, variant.save)
def test_copy_fields_from_template_to_variants(self):
frappe.delete_doc_if_exists("Item", "_Test Variant Item-XL", force=1)
fields = [{'field_name': 'item_group'}, {'field_name': 'is_stock_item'}]
allow_fields = [d.get('field_name') for d in fields]
set_item_variant_settings(fields)

View File

@@ -5,7 +5,7 @@ frappe.ui.form.on('Item Variant Settings', {
setup: function(frm) {
const allow_fields = [];
const exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website",
"show_variant_in_website", "opening_stock", "variant_of", "valuation_rate", "variant_based_on"];
"show_variant_in_website", "opening_stock", "variant_of", "valuation_rate"];
frappe.model.with_doctype('Item', () => {
frappe.get_meta('Item').fields.forEach(d => {

View File

@@ -12,7 +12,7 @@ class ItemVariantSettings(Document):
fields = frappe.get_meta('Item').fields
exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website",
"show_variant_in_website", "standard_rate", "opening_stock", "image", "description",
"variant_of", "valuation_rate", "description", "variant_based_on",
"variant_of", "valuation_rate", "description",
"website_image", "thumbnail", "website_specifiations", "web_long_description"]
for d in fields:

View File

@@ -11,7 +11,7 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt \
from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import StockFreezeError
from erpnext.stock.stock_ledger import get_previous_sle
from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
from erpnext.stock.doctype.item.test_item import set_item_variant_settings
from erpnext.stock.doctype.item.test_item import set_item_variant_settings, make_item_variant
from frappe.tests.test_permissions import set_user_permission_doctypes
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
from erpnext.accounts.doctype.account.test_account import get_inventory_account
@@ -46,6 +46,7 @@ class TestStockEntry(unittest.TestCase):
make_stock_entry(item_code=item_code, target=warehouse, qty=1, basic_rate=10)
sle = get_sle(item_code = item_code, warehouse = warehouse)[0]
self.assertEqual([[1, 10]], frappe.safe_eval(sle.stock_queue))
# negative qty
@@ -74,7 +75,6 @@ class TestStockEntry(unittest.TestCase):
frappe.db.set_default("allow_negative_stock", 0)
def test_auto_material_request(self):
from erpnext.stock.doctype.item.test_item import make_item_variant
make_item_variant()
self._test_auto_material_request("_Test Item")
self._test_auto_material_request("_Test Item", material_request_type="Transfer")
@@ -82,6 +82,7 @@ class TestStockEntry(unittest.TestCase):
def test_auto_material_request_for_variant(self):
fields = [{'field_name': 'reorder_levels'}]
set_item_variant_settings(fields)
make_item_variant()
template = frappe.get_doc("Item", "_Test Variant Item")
if not template.reorder_levels:

View File

@@ -13,13 +13,6 @@
"warehouse_name": "_Test Scrap Warehouse",
"is_group": 0
},
{
"company": "_Test Company",
"create_account_under": "Stock Assets - _TC",
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse",
"is_group": 0
},
{
"company": "_Test Company",
"create_account_under": "Fixed Assets - _TC",