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

View File

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