fix failing tests
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 4d0fa90..3163f10 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -1079,7 +1079,7 @@
si.items[0].price_list_rate = price_list_rate
si.items[0].margin_type = 'Percentage'
si.items[0].margin_rate_or_amount = 25
- si.insert()
+ si.save()
self.assertEqual(si.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
def test_outstanding_amount_after_advance_jv_cancelation(self):
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index 723123e..75850d5 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -519,7 +519,7 @@
so.items[0].price_list_rate = price_list_rate = 100
so.items[0].margin_type = 'Percentage'
so.items[0].margin_rate_or_amount = 25
- so.insert()
+ so.save()
new_so = frappe.copy_doc(so)
new_so.save(ignore_permissions=True)
@@ -549,7 +549,7 @@
self.assertFalse(si.get('payment_schedule'))
def test_terms_copied(self):
- so = make_sales_order(do_not_copy=1)
+ so = make_sales_order(do_not_copy=1, do_not_save=1)
so.payment_terms_template = '_Test Payment Term Template'
so.insert()
self.assertTrue(so.get('payment_schedule'))
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 5fe13c5..327acaf 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -11,7 +11,9 @@
from frappe.utils.nestedset import get_root_of
from erpnext.accounts.utils import get_account_name
-class WebsitePriceListMissingError(frappe.ValidationError): pass
+
+class WebsitePriceListMissingError(frappe.ValidationError):
+ pass
def set_cart_count(quotation=None):
if cint(frappe.db.get_singles_value("Shopping Cart Settings", "enabled")):
@@ -98,6 +100,7 @@
apply_cart_settings(quotation=quotation)
quotation.flags.ignore_permissions = True
+ quotation.payment_schedule = []
if not empty_card:
quotation.save()
else:
@@ -173,6 +176,7 @@
return doc
+
def _get_cart_quotation(party=None):
'''Return the open Quotation of type "Shopping Cart" or make a new one'''
if not party:
@@ -194,7 +198,7 @@
"status": "Draft",
"docstatus": 0,
"__islocal": 1,
- "payment_terms_template": "_Test Payment Terms Template",
+ "payment_terms_template": "_Test Payment Term Template",
(party.doctype.lower()): party.name
})
diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py
index 22b2895..da04982 100644
--- a/erpnext/shopping_cart/test_shopping_cart.py
+++ b/erpnext/shopping_cart/test_shopping_cart.py
@@ -8,6 +8,9 @@
from erpnext.shopping_cart.cart import _get_cart_quotation, update_cart, get_party
from erpnext.tests.utils import create_test_contact_and_address
+
+test_dependencies = ['Payment Terms Template']
+
class TestShoppingCart(unittest.TestCase):
"""
Note:
@@ -62,7 +65,6 @@
self.assertEquals(quotation.get("items")[0].qty, 1)
self.assertEquals(quotation.get("items")[0].amount, 10)
-
# add second item
update_cart("_Test Item 2", 1)
quotation = self.test_get_cart_customer()