switched ORM methods for single SQL query
This commit is contained in:
parent
53b65ab8ed
commit
b9460ed22c
@ -186,12 +186,10 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
|
|||||||
return doclist
|
return doclist
|
||||||
|
|
||||||
def set_expired_status():
|
def set_expired_status():
|
||||||
quotations = frappe.get_all("Quotation")
|
from datetime import date
|
||||||
for quotation in quotations:
|
DATE_FORMAT = "%Y%m%d" # For converting python date to SQL comparable date
|
||||||
quotation = frappe.get_doc("Quotation",quotation.name)
|
today = date.today().strftime(DATE_FORMAT)
|
||||||
if quotation.valid_till and getdate(quotation.valid_till) < getdate(nowdate()):
|
frappe.db.sql("UPDATE tabQuotation SET status = 'Expired' WHERE valid_till < " + today)
|
||||||
frappe.db.set(quotation,'status','Expired')
|
|
||||||
frappe.db.commit()
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_sales_invoice(source_name, target_doc=None):
|
def make_sales_invoice(source_name, target_doc=None):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user