Merge pull request #14453 from rohitwaghchaure/item_alternative_fixes_for_backflush

[Fix] Alternative item, transferred qty issue for backflush method
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 88d8499..af9c8f7 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -6,6 +6,8 @@
 from frappe import _
 from frappe.utils import cint, cstr
 from frappe.utils.nestedset import NestedSet
+from erpnext.accounts.utils import validate_field_number
+
 
 class CostCenter(NestedSet):
 	nsm_parent_field = 'parent_cost_center'
diff --git a/erpnext/healthcare/setup.py b/erpnext/healthcare/setup.py
index 1dd8804..f30f42c 100644
--- a/erpnext/healthcare/setup.py
+++ b/erpnext/healthcare/setup.py
@@ -187,93 +187,21 @@
 def create_lab_test_items():
 	records = [
 		{"doctype": "Item", "item_code": "MCH", "item_name": "MCH", "item_group": _("Laboratory"),
-			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1,
-		    "item_defaults": [{
-		      "company": "_Test Company",
-		      "default_warehouse": "_Test Warehouse - _TC",
-		      "expense_account": "_Test Account Cost for Goods Sold - _TC",
-		      "buying_cost_center": "_Test Cost Center - _TC",
-		      "selling_cost_center": "_Test Cost Center - _TC",
-		      "income_account": "Sales - _TC"
-		    }]
-		},
+			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
 		{"doctype": "Item", "item_code": "LDL", "item_name": "LDL", "item_group": _("Laboratory"),
-			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1,
-		    "item_defaults": [{
-		      "company": "_Test Company",
-		      "default_warehouse": "_Test Warehouse - _TC",
-		      "expense_account": "_Test Account Cost for Goods Sold - _TC",
-		      "buying_cost_center": "_Test Cost Center - _TC",
-		      "selling_cost_center": "_Test Cost Center - _TC",
-		      "income_account": "Sales - _TC"
-		    }]
-		},
+			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
 		{"doctype": "Item", "item_code": "GTT", "item_name": "GTT", "item_group": _("Laboratory"),
-			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1,
-		    "item_defaults": [{
-		      "company": "_Test Company",
-		      "default_warehouse": "_Test Warehouse - _TC",
-		      "expense_account": "_Test Account Cost for Goods Sold - _TC",
-		      "buying_cost_center": "_Test Cost Center - _TC",
-		      "selling_cost_center": "_Test Cost Center - _TC",
-		      "income_account": "Sales - _TC"
-		    }]
-		},
+			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
 		{"doctype": "Item", "item_code": "HDL", "item_name": "HDL", "item_group": _("Laboratory"),
-			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1,
-		    "item_defaults": [{
-		      "company": "_Test Company",
-		      "default_warehouse": "_Test Warehouse - _TC",
-		      "expense_account": "_Test Account Cost for Goods Sold - _TC",
-		      "buying_cost_center": "_Test Cost Center - _TC",
-		      "selling_cost_center": "_Test Cost Center - _TC",
-		      "income_account": "Sales - _TC"
-		    }]
-		},
+			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
 		{"doctype": "Item", "item_code": "BILT", "item_name": "BILT", "item_group": _("Laboratory"),
-			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1,
-		    "item_defaults": [{
-		      "company": "_Test Company",
-		      "default_warehouse": "_Test Warehouse - _TC",
-		      "expense_account": "_Test Account Cost for Goods Sold - _TC",
-		      "buying_cost_center": "_Test Cost Center - _TC",
-		      "selling_cost_center": "_Test Cost Center - _TC",
-		      "income_account": "Sales - _TC"
-		    }]
-		},
+			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
 		{"doctype": "Item", "item_code": "BILD", "item_name": "BILD", "item_group": _("Laboratory"),
-			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1,
-		    "item_defaults": [{
-		      "company": "_Test Company",
-		      "default_warehouse": "_Test Warehouse - _TC",
-		      "expense_account": "_Test Account Cost for Goods Sold - _TC",
-		      "buying_cost_center": "_Test Cost Center - _TC",
-		      "selling_cost_center": "_Test Cost Center - _TC",
-		      "income_account": "Sales - _TC"
-		    }]
-		},
+			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
 		{"doctype": "Item", "item_code": "BP", "item_name": "BP", "item_group": _("Laboratory"),
-			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1,
-		    "item_defaults": [{
-		      "company": "_Test Company",
-		      "default_warehouse": "_Test Warehouse - _TC",
-		      "expense_account": "_Test Account Cost for Goods Sold - _TC",
-		      "buying_cost_center": "_Test Cost Center - _TC",
-		      "selling_cost_center": "_Test Cost Center - _TC",
-		      "income_account": "Sales - _TC"
-		    }]
-		},
+			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
 		{"doctype": "Item", "item_code": "BS", "item_name": "BS", "item_group": _("Laboratory"),
-			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1,
-		    "item_defaults": [{
-		      "company": "_Test Company",
-		      "default_warehouse": "_Test Warehouse - _TC",
-		      "expense_account": "_Test Account Cost for Goods Sold - _TC",
-		      "buying_cost_center": "_Test Cost Center - _TC",
-		      "selling_cost_center": "_Test Cost Center - _TC",
-		      "income_account": "Sales - _TC"
-		    }]
-		}
+			"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}
 	]
 	insert_record(records)