fix failing tests

This commit is contained in:
tunde 2017-09-25 12:10:02 +01:00
parent 90e09d4e79
commit 94c3c13ba6
4 changed files with 12 additions and 6 deletions

View File

@ -1079,7 +1079,7 @@ class TestSalesInvoice(unittest.TestCase):
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):

View File

@ -519,7 +519,7 @@ class TestSalesOrder(unittest.TestCase):
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 @@ class TestSalesOrder(unittest.TestCase):
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'))

View File

@ -11,7 +11,9 @@ from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings
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 @@ def update_cart(item_code, qty, with_items=False):
apply_cart_settings(quotation=quotation)
quotation.flags.ignore_permissions = True
quotation.payment_schedule = []
if not empty_card:
quotation.save()
else:
@ -173,6 +176,7 @@ def decorate_quotation_doc(doc):
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 @@ def _get_cart_quotation(party=None):
"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
})

View File

@ -8,6 +8,9 @@ from frappe.utils import nowdate, add_months
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 @@ class TestShoppingCart(unittest.TestCase):
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()