test: add Purchase Receipt GL snapshots

Extends the Phase-0 characterization suite with 3 PR scenarios:
  pr_basic, pr_with_taxes, pr_return — all using _Test Company with
  perpetual inventory (TCP1) so stock-received GL entries are produced.

Also refreshes se_material_issue.json (cumulative stock on test-erpnext-v17
shifted the outgoing valuation rate). 29 snapshots total, all green.
This commit is contained in:
Nabin Hait
2026-05-27 15:17:00 +05:30
parent 18188cb1b2
commit b63e1fd796
5 changed files with 161 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
[
{
"account": "Stock In Hand - TCP1",
"account_currency": "INR",
"against": "Stock Received But Not Billed - TCP1",
"cost_center": "Main - TCP1",
"credit": 0.0,
"credit_in_account_currency": 0.0,
"debit": 500.0,
"debit_in_account_currency": 500.0,
"is_opening": "No",
"party": null,
"party_type": null,
"posting_date": "2024-01-15"
},
{
"account": "Stock Received But Not Billed - TCP1",
"account_currency": "INR",
"against": "Stock In Hand - TCP1",
"cost_center": "Main - TCP1",
"credit": 500.0,
"credit_in_account_currency": 500.0,
"debit": 0.0,
"debit_in_account_currency": 0.0,
"is_opening": "No",
"party": null,
"party_type": null,
"posting_date": "2024-01-15"
}
]

View File

@@ -0,0 +1,30 @@
[
{
"account": "Stock In Hand - TCP1",
"account_currency": "INR",
"against": "Stock Received But Not Billed - TCP1",
"cost_center": "Main - TCP1",
"credit": 500.0,
"credit_in_account_currency": 500.0,
"debit": 0.0,
"debit_in_account_currency": 0.0,
"is_opening": "No",
"party": null,
"party_type": null,
"posting_date": "2024-01-15"
},
{
"account": "Stock Received But Not Billed - TCP1",
"account_currency": "INR",
"against": "Stock In Hand - TCP1",
"cost_center": "Main - TCP1",
"credit": 0.0,
"credit_in_account_currency": 0.0,
"debit": 500.0,
"debit_in_account_currency": 500.0,
"is_opening": "No",
"party": null,
"party_type": null,
"posting_date": "2024-01-15"
}
]

View File

@@ -0,0 +1,58 @@
[
{
"account": "Stock In Hand - TCP1",
"account_currency": "INR",
"against": "Stock Received But Not Billed - TCP1",
"cost_center": "Main - TCP1",
"credit": 0.0,
"credit_in_account_currency": 0.0,
"debit": 750.0,
"debit_in_account_currency": 750.0,
"is_opening": "No",
"party": null,
"party_type": null,
"posting_date": "2024-01-15"
},
{
"account": "Stock Received But Not Billed - TCP1",
"account_currency": "INR",
"against": "Stock In Hand - TCP1",
"cost_center": "Main - TCP1",
"credit": 500.0,
"credit_in_account_currency": 500.0,
"debit": 0.0,
"debit_in_account_currency": 0.0,
"is_opening": "No",
"party": null,
"party_type": null,
"posting_date": "2024-01-15"
},
{
"account": "_Test Account Customs Duty - TCP1",
"account_currency": "INR",
"against": "Stock In Hand - TCP1",
"cost_center": "Main - TCP1",
"credit": 150.0,
"credit_in_account_currency": 150.0,
"debit": 0.0,
"debit_in_account_currency": 0.0,
"is_opening": "No",
"party": null,
"party_type": null,
"posting_date": "2024-01-15"
},
{
"account": "_Test Account Shipping Charges - TCP1",
"account_currency": "INR",
"against": "Stock In Hand - TCP1",
"cost_center": "Main - TCP1",
"credit": 100.0,
"credit_in_account_currency": 100.0,
"debit": 0.0,
"debit_in_account_currency": 0.0,
"is_opening": "No",
"party": null,
"party_type": null,
"posting_date": "2024-01-15"
}
]

View File

@@ -6,8 +6,8 @@
"cost_center": "Main - TCP1",
"credit": 0.0,
"credit_in_account_currency": 0.0,
"debit": 500.0,
"debit_in_account_currency": 500.0,
"debit": 750.0,
"debit_in_account_currency": 750.0,
"is_opening": "No",
"party": null,
"party_type": null,
@@ -18,8 +18,8 @@
"account_currency": "INR",
"against": "Stock Adjustment - TCP1",
"cost_center": "Main - TCP1",
"credit": 500.0,
"credit_in_account_currency": 500.0,
"credit": 750.0,
"credit_in_account_currency": 750.0,
"debit": 0.0,
"debit_in_account_currency": 0.0,
"is_opening": "No",

View File

@@ -26,6 +26,7 @@ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make
from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_sales_return
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.accounts.gl_snapshot import assert_gl_snapshot
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
POSTING_DATE = "2024-01-15"
@@ -441,6 +442,44 @@ class TestGLCharacterization(IntegrationTestCase):
sr.submit()
assert_gl_snapshot(self, "sr_basic", "Stock Reconciliation", sr.name)
def test_pr_basic(self):
pr = make_purchase_receipt(
company=DN_COMPANY,
warehouse=DN_WAREHOUSE,
posting_date=POSTING_DATE,
qty=5,
rate=100,
)
assert_gl_snapshot(self, "pr_basic", "Purchase Receipt", pr.name)
def test_pr_with_taxes(self):
pr = make_purchase_receipt(
company=DN_COMPANY,
warehouse=DN_WAREHOUSE,
posting_date=POSTING_DATE,
qty=5,
rate=100,
get_taxes_and_charges=True,
)
assert_gl_snapshot(self, "pr_with_taxes", "Purchase Receipt", pr.name)
def test_pr_return(self):
original = make_purchase_receipt(
company=DN_COMPANY,
warehouse=DN_WAREHOUSE,
posting_date=POSTING_DATE,
qty=5,
rate=100,
)
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_return
ret = make_purchase_return(original.name)
ret.posting_date = POSTING_DATE
ret.set_posting_time = 1
ret.insert()
ret.submit()
assert_gl_snapshot(self, "pr_return", "Purchase Receipt", ret.name)
def _make_dated_delivery_note(**args) -> frappe.Document:
"""Minimal Delivery Note on a fixed posting date using the perpetual-inventory