fix(test): `test_gl_entries_for_standalone_debit_note`
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 13593bc..ae1f2d8 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -1783,9 +1783,14 @@
set_advance_flag(company="_Test Company", flag=0, default_account="")
def test_gl_entries_for_standalone_debit_note(self):
- make_purchase_invoice(qty=5, rate=500, update_stock=True)
+ from erpnext.stock.doctype.item.test_item import make_item
- returned_inv = make_purchase_invoice(qty=-5, rate=5, update_stock=True, is_return=True)
+ item_code = make_item(properties={"is_stock_item": 1})
+ make_purchase_invoice(item_code=item_code, qty=5, rate=500, update_stock=True)
+
+ returned_inv = make_purchase_invoice(
+ item_code=item_code, qty=-5, rate=5, update_stock=True, is_return=True
+ )
# override the rate with valuation rate
sle = frappe.get_all(
@@ -1795,7 +1800,7 @@
)[0]
rate = flt(sle.stock_value_difference) / flt(sle.actual_qty)
- self.assertAlmostEqual(returned_inv.items[0].rate, rate)
+ self.assertAlmostEqual(rate, 500)
def test_payment_allocation_for_payment_terms(self):
from erpnext.buying.doctype.purchase_order.test_purchase_order import (