* fix: required by date in the reorder material request (#44497)
(cherry picked from commit 4001166ecc)
# Conflicts:
# erpnext/stock/doctype/stock_entry/test_stock_entry.py
* chore: fix conflicts
---------
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -1727,6 +1727,46 @@ class TestStockEntry(FrappeTestCase):
|
||||
mr.cancel()
|
||||
mr.delete()
|
||||
|
||||
def test_auto_reorder_level_with_lead_time_days(self):
|
||||
from erpnext.stock.reorder_item import reorder_item
|
||||
|
||||
item_doc = make_item(
|
||||
"Test Auto Reorder Item - 002",
|
||||
properties={"stock_uom": "Kg", "purchase_uom": "Nos", "is_stock_item": 1, "lead_time_days": 2},
|
||||
uoms=[{"uom": "Nos", "conversion_factor": 5}],
|
||||
)
|
||||
|
||||
if not frappe.db.exists("Item Reorder", {"parent": item_doc.name}):
|
||||
item_doc.append(
|
||||
"reorder_levels",
|
||||
{
|
||||
"warehouse_reorder_level": 0,
|
||||
"warehouse_reorder_qty": 10,
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"material_request_type": "Purchase",
|
||||
},
|
||||
)
|
||||
|
||||
item_doc.save(ignore_permissions=True)
|
||||
|
||||
frappe.db.set_single_value("Stock Settings", "auto_indent", 1)
|
||||
|
||||
mr_list = reorder_item()
|
||||
|
||||
frappe.db.set_single_value("Stock Settings", "auto_indent", 0)
|
||||
mrs = frappe.get_all(
|
||||
"Material Request Item",
|
||||
fields=["schedule_date"],
|
||||
filters={"item_code": item_doc.name, "uom": "Nos"},
|
||||
)
|
||||
|
||||
for mri in mrs:
|
||||
self.assertEqual(getdate(mri.schedule_date), getdate(add_days(today(), 2)))
|
||||
|
||||
for mr in mr_list:
|
||||
mr.cancel()
|
||||
mr.delete()
|
||||
|
||||
def test_stock_entry_for_same_posting_date_and_time(self):
|
||||
warehouse = "_Test Warehouse - _TC"
|
||||
item_code = "Test Stock Entry For Same Posting Datetime 1"
|
||||
|
||||
@@ -98,6 +98,7 @@ def _reorder_item():
|
||||
"description": d.description,
|
||||
"stock_uom": d.stock_uom,
|
||||
"purchase_uom": d.purchase_uom,
|
||||
"lead_time_days": d.lead_time_days,
|
||||
}
|
||||
),
|
||||
)
|
||||
@@ -129,6 +130,7 @@ def get_items_for_reorder() -> dict[str, list]:
|
||||
item_table.brand,
|
||||
item_table.variant_of,
|
||||
item_table.has_variants,
|
||||
item_table.lead_time_days,
|
||||
)
|
||||
.where(
|
||||
(item_table.disabled == 0)
|
||||
|
||||
Reference in New Issue
Block a user