mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-31 19:02:21 +02:00
refactor(test): make purchase receipt deterministic
This commit is contained in:
@@ -29,6 +29,11 @@ from erpnext.tests.utils import ERPNextTestSuite
|
||||
|
||||
|
||||
class TestPurchaseReceipt(ERPNextTestSuite):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.load_test_records("Purchase Receipt")
|
||||
|
||||
def setUp(self):
|
||||
frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1)
|
||||
|
||||
@@ -741,7 +746,12 @@ class TestPurchaseReceipt(ERPNextTestSuite):
|
||||
serial_no = ["12903812901"]
|
||||
if not frappe.db.exists("Serial No", serial_no[0]):
|
||||
frappe.get_doc(
|
||||
{"doctype": "Serial No", "item_code": item_code, "serial_no": serial_no[0]}
|
||||
{
|
||||
"doctype": "Serial No",
|
||||
"item_code": item_code,
|
||||
"serial_no": serial_no[0],
|
||||
"company": self.companies[0].name,
|
||||
}
|
||||
).insert()
|
||||
|
||||
pr_doc = make_purchase_receipt(item_code=item_code, qty=1, serial_no=serial_no)
|
||||
@@ -2699,6 +2709,7 @@ class TestPurchaseReceipt(ERPNextTestSuite):
|
||||
"doctype": "Serial No",
|
||||
"item_code": serial_item,
|
||||
"serial_no": serial_no,
|
||||
"company": self.companies[0].name,
|
||||
}
|
||||
).insert()
|
||||
|
||||
@@ -3990,6 +4001,7 @@ class TestPurchaseReceipt(ERPNextTestSuite):
|
||||
"doctype": "Serial No",
|
||||
"item_code": serial_item,
|
||||
"serial_no": serial_no,
|
||||
"company": self.companies[0].name,
|
||||
}
|
||||
).insert()
|
||||
|
||||
|
||||
87
erpnext/stock/doctype/purchase_receipt/test_records.json
Normal file
87
erpnext/stock/doctype/purchase_receipt/test_records.json
Normal file
@@ -0,0 +1,87 @@
|
||||
[
|
||||
{
|
||||
"buying_price_list": "_Test Price List",
|
||||
"company": "_Test Company",
|
||||
"conversion_rate": 1.0,
|
||||
"currency": "INR",
|
||||
"doctype": "Purchase Receipt",
|
||||
"base_grand_total": 720.0,
|
||||
"naming_series": "_T-Purchase Receipt-",
|
||||
"base_net_total": 500.0,
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": "_Test Account Shipping Charges - _TC",
|
||||
"add_deduct_tax": "Add",
|
||||
"category": "Valuation and Total",
|
||||
"charge_type": "Actual",
|
||||
"description": "Shipping Charges",
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "taxes",
|
||||
"rate": 100.0,
|
||||
"tax_amount": 100.0,
|
||||
"cost_center": "Main - _TC"
|
||||
},
|
||||
{
|
||||
"account_head": "_Test Account VAT - _TC",
|
||||
"add_deduct_tax": "Add",
|
||||
"category": "Total",
|
||||
"charge_type": "Actual",
|
||||
"description": "VAT",
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "taxes",
|
||||
"rate": 120.0,
|
||||
"tax_amount": 120.0,
|
||||
"cost_center": "Main - _TC"
|
||||
},
|
||||
{
|
||||
"account_head": "_Test Account Customs Duty - _TC",
|
||||
"add_deduct_tax": "Add",
|
||||
"category": "Valuation",
|
||||
"charge_type": "Actual",
|
||||
"description": "Customs Duty",
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "taxes",
|
||||
"rate": 150.0,
|
||||
"tax_amount": 150.0,
|
||||
"cost_center": "Main - _TC"
|
||||
}
|
||||
],
|
||||
"items": [
|
||||
{
|
||||
"base_amount": 250.0,
|
||||
"conversion_factor": 1.0,
|
||||
"description": "_Test Item",
|
||||
"doctype": "Purchase Receipt Item",
|
||||
"item_code": "_Test Item",
|
||||
"item_name": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 5.0,
|
||||
"rate": 50.0,
|
||||
"received_qty": 5.0,
|
||||
"rejected_qty": 0.0,
|
||||
"stock_uom": "_Test UOM",
|
||||
"uom": "_Test UOM",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"cost_center": "Main - _TC"
|
||||
},
|
||||
{
|
||||
"base_amount": 250.0,
|
||||
"conversion_factor": 1.0,
|
||||
"description": "_Test Item Home Desktop 100",
|
||||
"doctype": "Purchase Receipt Item",
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"item_name": "_Test Item Home Desktop 100",
|
||||
"parentfield": "items",
|
||||
"qty": 5.0,
|
||||
"rate": 50.0,
|
||||
"received_qty": 5.0,
|
||||
"rejected_qty": 0.0,
|
||||
"stock_uom": "_Test UOM",
|
||||
"uom": "_Test UOM",
|
||||
"warehouse": "_Test Warehouse 1 - _TC",
|
||||
"cost_center": "Main - _TC"
|
||||
}
|
||||
],
|
||||
"supplier": "_Test Supplier"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user