test: hoist defaults to function signature

This commit is contained in:
Ankush Menat 2021-05-23 14:48:03 +05:30
parent a11a8e8ab2
commit 4e360f805f
No known key found for this signature in database
GPG Key ID: 8EA82E09BBD13AAF

View File

@ -530,23 +530,24 @@ def make_item_variant():
test_records = frappe.get_test_records('Item')
def create_item(item_code, is_stock_item=None, valuation_rate=0, warehouse=None, is_customer_provided_item=None,
customer=None, is_purchase_item=None, opening_stock=None, company=None):
def create_item(item_code, is_stock_item=1, valuation_rate=0, warehouse="_Test Warehouse - _TC",
is_customer_provided_item=None, customer=None, is_purchase_item=None, opening_stock=0,
company="_Test Company"):
if not frappe.db.exists("Item", item_code):
item = frappe.new_doc("Item")
item.item_code = item_code
item.item_name = item_code
item.description = item_code
item.item_group = "All Item Groups"
item.is_stock_item = is_stock_item or 1
item.opening_stock = opening_stock or 0
item.valuation_rate = valuation_rate or 0.0
item.is_stock_item = is_stock_item
item.opening_stock = opening_stock
item.valuation_rate = valuation_rate
item.is_purchase_item = is_purchase_item
item.is_customer_provided_item = is_customer_provided_item
item.customer = customer or ''
item.append("item_defaults", {
"default_warehouse": warehouse or '_Test Warehouse - _TC',
"company": company or "_Test Company"
"default_warehouse": warehouse,
"company": company
})
item.save()
else: