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.

(cherry picked from commit d05bd80b1e)
This commit is contained in:
Mihir Kandoi
2026-08-01 08:38:26 +05:30
committed by Mergify
parent f19aa957cb
commit f99d66d578

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)