fix: Validation for delivery date in Sales Order (#35597)
* fix: Validation for delivery date in Sales Order * chore: update utils * chore: revert * chore: Add default delivery date
This commit is contained in:
parent
937c0feefe
commit
984f89d274
@ -299,6 +299,7 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
|
||||
)
|
||||
|
||||
target.flags.ignore_permissions = ignore_permissions
|
||||
target.delivery_date = nowdate()
|
||||
target.run_method("set_missing_values")
|
||||
target.run_method("calculate_taxes_and_totals")
|
||||
|
||||
@ -306,6 +307,7 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
|
||||
balance_qty = obj.qty - ordered_items.get(obj.item_code, 0.0)
|
||||
target.qty = balance_qty if balance_qty > 0 else 0
|
||||
target.stock_qty = flt(target.qty) * flt(obj.conversion_factor)
|
||||
target.delivery_date = nowdate()
|
||||
|
||||
if obj.against_blanket_order:
|
||||
target.against_blanket_order = obj.against_blanket_order
|
||||
|
@ -60,9 +60,9 @@ class TestQuotation(FrappeTestCase):
|
||||
sales_order = make_sales_order(quotation.name)
|
||||
sales_order.currency = "USD"
|
||||
sales_order.conversion_rate = 20.0
|
||||
sales_order.delivery_date = "2019-01-01"
|
||||
sales_order.naming_series = "_T-Quotation-"
|
||||
sales_order.transaction_date = nowdate()
|
||||
sales_order.delivery_date = nowdate()
|
||||
sales_order.insert()
|
||||
|
||||
self.assertEqual(sales_order.currency, "USD")
|
||||
@ -644,8 +644,6 @@ def make_quotation(**args):
|
||||
},
|
||||
)
|
||||
|
||||
qo.delivery_date = add_days(qo.transaction_date, 10)
|
||||
|
||||
if not args.do_not_save:
|
||||
qo.insert()
|
||||
if not args.do_not_submit:
|
||||
|
@ -171,7 +171,8 @@ class SalesOrder(SellingController):
|
||||
frappe.msgprint(
|
||||
_("Expected Delivery Date should be after Sales Order Date"),
|
||||
indicator="orange",
|
||||
title=_("Warning"),
|
||||
title=_("Invalid Delivery Date"),
|
||||
raise_exception=True,
|
||||
)
|
||||
else:
|
||||
frappe.throw(_("Please enter Delivery Date"))
|
||||
|
Loading…
Reference in New Issue
Block a user