Fix shopify test case

This commit is contained in:
Shreya 2018-06-08 17:15:30 +05:30
parent 3b201cc2fd
commit 294238abfd
2 changed files with 10 additions and 11 deletions

View File

@ -22,7 +22,7 @@ class TestAsset(unittest.TestCase):
pi = make_purchase_invoice(asset.name, asset.item_code, asset.gross_purchase_amount,
asset.company, asset.purchase_date)
print(pi.name)
pi.supplier = "_Test Supplier"
pi.insert()
pi.submit()
@ -353,7 +353,6 @@ class TestAsset(unittest.TestCase):
''', (asset.name))]
if pi:
pi_doc = frappe.get_doc("Purchase Invoice", pi[0])
print(pi[0])
pi_doc.cancel
# if pi:
# frappe.db.set_value("Purchase Invoice", {"name": pi[0]}, "docstatus", 2)

View File

@ -216,7 +216,7 @@ def get_supplier(shopify_item):
"doctype": "Supplier",
"supplier_name": shopify_item.get("vendor"),
"shopify_supplier_id": shopify_item.get("vendor").lower(),
"supplier_type": get_supplier_type()
"supplier_group": get_supplier_group()
}).insert()
return supplier.name
else:
@ -224,15 +224,15 @@ def get_supplier(shopify_item):
else:
return ""
def get_supplier_type():
supplier_type = frappe.db.get_value("Supplier Type", _("Shopify Supplier"))
if not supplier_type:
supplier_type = frappe.get_doc({
"doctype": "Supplier Type",
"supplier_type": _("Shopify Supplier")
def get_supplier_group():
supplier_group = frappe.db.get_value("Supplier Group", _("Shopify Supplier"))
if not supplier_group:
supplier_group = frappe.get_doc({
"doctype": "Supplier Group",
"supplier_group_name": _("Shopify Supplier")
}).insert()
return supplier_type.name
return supplier_type
return supplier_group.name
return supplier_group
def get_item_details(shopify_item):
item_details = {}