test: Validate the actual quantity when creating a material request from the sales order

This commit is contained in:
Bhavan23
2024-10-08 16:24:28 +05:30
parent 930208117c
commit 17fdd42645

View File

@@ -9,6 +9,8 @@ import frappe.permissions
from frappe.core.doctype.user_permission.test_user_permission import create_user
from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, flt, getdate, nowdate, today
from erpnext.stock.get_item_details import get_bin_details
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.controllers.accounts_controller import InvalidQtyError, update_child_qty_rate
@@ -119,6 +121,10 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase):
self.assertEqual(mr.material_request_type, "Purchase")
self.assertEqual(len(mr.get("items")), len(so.get("items")))
for item in mr.get("items"):
actual_qty = get_bin_details(item.item_code, item.warehouse, mr.company, True).get("actual_qty", 0)
self.assertEqual(flt(item.actual_qty), actual_qty)
def test_make_delivery_note(self):
so = make_sales_order(do_not_submit=True)