mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
Merge branch 'version-13-hotfix' into mergify/bp/version-13-hotfix/pr-33664
This commit is contained in:
@@ -383,7 +383,7 @@ class AccountsController(TransactionBase):
|
|||||||
self.get("inter_company_reference")
|
self.get("inter_company_reference")
|
||||||
or self.get("inter_company_invoice_reference")
|
or self.get("inter_company_invoice_reference")
|
||||||
or self.get("inter_company_order_reference")
|
or self.get("inter_company_order_reference")
|
||||||
):
|
) and not self.get("is_return"):
|
||||||
msg = _("Internal Sale or Delivery Reference missing.")
|
msg = _("Internal Sale or Delivery Reference missing.")
|
||||||
msg += _("Please create purchase from internal sale or delivery document itself")
|
msg += _("Please create purchase from internal sale or delivery document itself")
|
||||||
frappe.throw(msg, title=_("Internal Sales Reference Missing"))
|
frappe.throw(msg, title=_("Internal Sales Reference Missing"))
|
||||||
|
|||||||
@@ -191,14 +191,7 @@ def get_list_context(context=None):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_sales_order(source_name, target_doc=None):
|
def make_sales_order(source_name: str, target_doc=None):
|
||||||
quotation = frappe.db.get_value(
|
|
||||||
"Quotation", source_name, ["transaction_date", "valid_till"], as_dict=1
|
|
||||||
)
|
|
||||||
if quotation.valid_till and (
|
|
||||||
quotation.valid_till < quotation.transaction_date or quotation.valid_till < getdate(nowdate())
|
|
||||||
):
|
|
||||||
frappe.throw(_("Validity period of this quotation has ended."))
|
|
||||||
return _make_sales_order(source_name, target_doc)
|
return _make_sales_order(source_name, target_doc)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -118,17 +118,20 @@ class TestQuotation(FrappeTestCase):
|
|||||||
sales_order.payment_schedule[1].due_date, getdate(add_days(quotation.transaction_date, 30))
|
sales_order.payment_schedule[1].due_date, getdate(add_days(quotation.transaction_date, 30))
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_valid_till(self):
|
def test_valid_till_before_transaction_date(self):
|
||||||
from erpnext.selling.doctype.quotation.quotation import make_sales_order
|
|
||||||
|
|
||||||
quotation = frappe.copy_doc(test_records[0])
|
quotation = frappe.copy_doc(test_records[0])
|
||||||
quotation.valid_till = add_days(quotation.transaction_date, -1)
|
quotation.valid_till = add_days(quotation.transaction_date, -1)
|
||||||
self.assertRaises(frappe.ValidationError, quotation.validate)
|
self.assertRaises(frappe.ValidationError, quotation.validate)
|
||||||
|
|
||||||
|
def test_so_from_expired_quotation(self):
|
||||||
|
from erpnext.selling.doctype.quotation.quotation import make_sales_order
|
||||||
|
|
||||||
|
quotation = frappe.copy_doc(test_records[0])
|
||||||
quotation.valid_till = add_days(nowdate(), -1)
|
quotation.valid_till = add_days(nowdate(), -1)
|
||||||
quotation.insert()
|
quotation.insert()
|
||||||
quotation.submit()
|
quotation.submit()
|
||||||
self.assertRaises(frappe.ValidationError, make_sales_order, quotation.name)
|
|
||||||
|
make_sales_order(quotation.name)
|
||||||
|
|
||||||
def test_shopping_cart_without_website_item(self):
|
def test_shopping_cart_without_website_item(self):
|
||||||
if frappe.db.exists("Website Item", {"item_code": "_Test Item Home Desktop 100"}):
|
if frappe.db.exists("Website Item", {"item_code": "_Test Item Home Desktop 100"}):
|
||||||
|
|||||||
Reference in New Issue
Block a user