Creating a sales order from an expire quotation

Hello, currently when a quotation is expired, no sales order can be made. What I need to do is to duplicate the quotation.

I think you should modify the system so that a sales order can be generated from an expired quotation, which is a very common fact.


I think having this rule ensures sales staff don’t make sales order on special offer quotation. Some places it’s a company policy to make sure sales price are kept in check. It’s a good safety concept. Instead of duplicating the quotation you can
Change expiry date to current or future date
Save and Submit.

After this Sales Order can be made. This will also ensure that you don’t have many expired quotation. You can adjust the expiration date in Selling settings by defining longer days than standard 15 days.

We also need to create sales order from expired quotation. It is good to have an additional dialog for confirmation, to alert user, but should be allowed (if need be at higher permission level). Prices change rarely for us, but may change at any time so need to have expiration on quotes even though most times expired quotes have correct pricing.

We added custom script to have Create Sales Order appear even when Quotation is expired and in:

from this function delete the if statement

def make_sales_order(source_name, 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)

Need to figure out how to do as server script as now every update requires update --reset and overrides (so need to delete if statement again)

ERPNext: v12.14.0 (version-12)
Frappe Framework: v12.12.0 (version-12)