Merge pull request #51168 from nishkagosalia/gh-42873

This commit is contained in:
Mihir Kandoi
2025-12-18 10:14:05 +05:30
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -2707,7 +2707,9 @@ class AccountsController(TransactionBase):
for d in self.get("payment_schedule"):
d.validate_from_to_dates("discount_date", "due_date")
if self.doctype == "Sales Order" and getdate(d.due_date) < getdate(self.transaction_date):
if self.doctype in ["Sales Order", "Quotation"] and getdate(d.due_date) < getdate(
self.transaction_date
):
frappe.throw(
_("Row {0}: Due Date in the Payment Terms table cannot be before Posting Date").format(
d.idx

View File

@@ -52,6 +52,11 @@ class TestQuotation(IntegrationTestCase):
self.assertEqual(qo.get("items")[0].qty, 11)
self.assertEqual(qo.get("items")[-1].rate, 100)
def test_disallow_due_date_before_transaction_date(self):
qo = make_quotation(qty=3, do_not_submit=1)
qo.payment_schedule[0].due_date = add_days(qo.transaction_date, -2)
self.assertRaises(frappe.ValidationError, qo.save)
def test_update_child_disallow_rate_change(self):
qo = make_quotation(qty=4)
trans_item = json.dumps(