fix: set Required By on Purchase Orders created per supplier

Mapping drops a schedule date that already passed, leaving the buyer to pick a
new one on the Purchase Order form. Nothing fills it in when the orders are
created straight from the supplier selection dialog, so a Material Request
whose required date has gone by failed to save with "Please enter the Required
By".

Items that lose their date now fall back to today, which is the earliest date a
Purchase Order raised today accepts.
This commit is contained in:
Mihir Kandoi
2026-08-01 08:38:26 +05:30
parent 09cfd1fe91
commit d05bd80b1e

View File

@@ -236,6 +236,9 @@ def make_purchase_orders_by_supplier(source_name: str, item_suppliers: str | lis
"requested_qty": requested_qty,
},
)
for item in purchase_order.items:
item.schedule_date = item.schedule_date or nowdate()
purchase_order.insert()
purchase_orders.append(purchase_order.name)