call commit after sql query for schedular job

This commit is contained in:
0Pranav 2019-11-25 10:51:27 +05:30
parent 6c368e2dfb
commit eefc492ff4
2 changed files with 3 additions and 2 deletions

View File

@ -187,7 +187,8 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
def set_expired_status():
frappe.db.sql("""UPDATE `tabQuotation` SET status = 'Expired'
WHERE status != 'Expired' AND 'valid_till' < %s""", (nowdate()) )
WHERE status != 'Expired' AND 'valid_till' < %s""", (nowdate()))
frappe.db.commit()
@frappe.whitelist()
def make_sales_invoice(source_name, target_doc=None):

View File

@ -216,7 +216,7 @@ class TestQuotation(unittest.TestCase):
"rate": 500
}
]
yesterday = getdate(nowdate()) + datetime.timedelta(days=-1)
yesterday = getdate(nowdate()) - datetime.timedelta(days=1)
expired_quotation = make_quotation(item_list=quotation_item,transaction_date=yesterday)
set_expired_status()