test case for quotation

This commit is contained in:
mbauskar 2016-01-18 16:33:57 +05:30 committed by rohitwaghchaure
parent b8b56f127f
commit e40736c105

View File

@ -32,5 +32,31 @@ class TestQuotation(unittest.TestCase):
sales_order.transaction_date = "2013-05-12"
sales_order.insert()
def test_create_quotation_with_margin(self):
from erpnext.selling.doctype.quotation.quotation import make_sales_order
from erpnext.selling.doctype.sales_order.sales_order \
import make_material_request, make_delivery_note, make_sales_invoice
test_records[0]['items'][0]['price_list_rate'] = 1500
test_records[0]['items'][0]['type'] = 'Percentage'
test_records[0]['items'][0]['rate_or_amount'] = 20
quotation = frappe.copy_doc(test_records[0])
quotation.insert()
self.assertRaises(frappe.ValidationError, make_sales_order, quotation.name)
quotation.submit()
sales_order = make_sales_order(quotation.name)
sales_order.delivery_date = "2016-01-02"
sales_order.naming_series = "_T-Quotation-"
sales_order.transaction_date = "2016-01-01"
sales_order.insert()
sales_order.submit()
dn = make_delivery_note(sales_order.name)
dn.save()
si = make_sales_invoice(sales_order.name)
si.save()
test_records = frappe.get_test_records('Quotation')