[test] Purchase Receipt - update rejected serial no

This commit is contained in:
Anand Doshi 2014-08-11 18:03:43 +05:30
parent 5c0db8d05e
commit f957cbd8ef
2 changed files with 28 additions and 0 deletions

View File

@ -118,6 +118,28 @@ class TestPurchaseReceipt(unittest.TestCase):
self.assertFalse(frappe.db.get_value("Serial No", pr.get("purchase_receipt_details")[0].serial_no,
"warehouse"))
def test_rejected_serial_no(self):
pr = frappe.copy_doc(test_records[0])
pr.get("purchase_receipt_details")[0].item_code = "_Test Serialized Item With Series"
pr.get("purchase_receipt_details")[0].qty = 3
pr.get("purchase_receipt_details")[0].rejected_qty = 2
pr.get("purchase_receipt_details")[0].received_qty = 5
pr.get("purchase_receipt_details")[0].rejected_warehouse = "_Test Rejected Warehouse - _TC"
pr.insert()
pr.submit()
accepted_serial_nos = pr.get("purchase_receipt_details")[0].serial_no.split("\n")
self.assertEquals(len(accepted_serial_nos), 3)
for serial_no in accepted_serial_nos:
self.assertEquals(frappe.db.get_value("Serial No", serial_no, "warehouse"),
pr.get("purchase_receipt_details")[0].warehouse)
rejected_serial_nos = pr.get("purchase_receipt_details")[0].rejected_serial_no.split("\n")
self.assertEquals(len(rejected_serial_nos), 2)
for serial_no in rejected_serial_nos:
self.assertEquals(frappe.db.get_value("Serial No", serial_no, "warehouse"),
pr.get("purchase_receipt_details")[0].rejected_warehouse)
def get_gl_entries(voucher_type, voucher_no):
return frappe.db.sql("""select account, debit, credit
from `tabGL Entry` where voucher_type=%s and voucher_no=%s

View File

@ -11,6 +11,12 @@
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse 1"
},
{
"company": "_Test Company",
"create_account_under": "Stock Assets - _TC",
"doctype": "Warehouse",
"warehouse_name": "_Test Rejected Warehouse"
},
{
"company": "_Test Company 1",
"create_account_under": "Stock Assets - _TC1",