fix: test cases
This commit is contained in:
parent
f0d27528e3
commit
e55a927eee
@ -158,8 +158,11 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
def test_purchase_return_for_rejected_qty(self):
|
||||
from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse
|
||||
|
||||
rejected_warehouse=get_warehouse(company = "_Test Company with perpetual inventory", abbr = " - TCP1", warehouse_name = "_Test Rejected Warehouse").name
|
||||
print(rejected_warehouse)
|
||||
rejected_warehouse="_Test Rejected Warehouse - TCP1"
|
||||
if not frappe.db.exists("Warehouse", rejected_warehouse):
|
||||
get_warehouse(company = "_Test Company with perpetual inventory",
|
||||
abbr = " - TCP1", warehouse_name = "_Test Rejected Warehouse").name
|
||||
|
||||
pr = make_purchase_receipt(company="_Test Company with perpetual inventory", warehouse = "Stores - TCP1", supplier_warehouse = "Work in Progress - TCP1", received_qty=4, qty=2, rejected_warehouse=rejected_warehouse)
|
||||
|
||||
return_pr = make_purchase_receipt(company="_Test Company with perpetual inventory", warehouse = "Stores - TCP1", supplier_warehouse = "Work in Progress - TCP1", is_return=1, return_against=pr.name, received_qty = -4, qty=-2, rejected_warehouse=rejected_warehouse)
|
||||
@ -269,20 +272,21 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
if not frappe.db.exists("Item", item_code):
|
||||
item = make_item(item_code, dict(has_serial_no=1))
|
||||
|
||||
serial_no = random_string(5)
|
||||
serial_no = "12903812901"
|
||||
pr_doc = make_purchase_receipt(item_code=item_code,
|
||||
qty=1, serial_no = serial_no)
|
||||
|
||||
self.assertEqual(serial_no, frappe.db.get_value("Serial No",
|
||||
{"purchase_document_type": "Purchase Receipt", "purchase_document_no": pr_doc.name}, "name"))
|
||||
|
||||
#check for the auto created serial nos
|
||||
item_code = "Test Auto Created Serial No"
|
||||
if not frappe.db.exists("Item", item_code):
|
||||
item = make_item(item_code, dict(has_serial_no=1, serial_no_series="KLJL.###"))
|
||||
|
||||
new_pr_doc = make_purchase_receipt(item_code=item_code, qty=1)
|
||||
|
||||
serial_no = get_serial_nos(new_pr_doc[0].serial_no)[0]
|
||||
serial_no = get_serial_nos(new_pr_doc.items[0].serial_no)[0]
|
||||
self.assertEqual(serial_no, frappe.db.get_value("Serial No",
|
||||
{"purchase_document_type": "Purchase Receipt", "purchase_document_no": new_pr_doc.name}, "name"))
|
||||
|
||||
|
@ -381,6 +381,7 @@ def auto_make_serial_nos(args):
|
||||
if sr.sales_order and voucher_type == "Stock Entry" \
|
||||
and not args.get('actual_qty', 0) > 0:
|
||||
sr.sales_order = None
|
||||
sr.update_serial_no_reference()
|
||||
sr.save(ignore_permissions=True)
|
||||
elif args.get('actual_qty', 0) > 0:
|
||||
created_numbers.append(make_serial_no(serial_no, args))
|
||||
|
Loading…
Reference in New Issue
Block a user