fix set_expired_status method
This commit is contained in:
parent
e0c9f3c282
commit
754c43f6c3
@ -186,8 +186,8 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
|
||||
return doclist
|
||||
|
||||
def set_expired_status():
|
||||
frappe.db.sql("""UPDATE `tabQuotation` SET status = 'Expired'
|
||||
WHERE 'valid_till' < %s""", (nowdate()))
|
||||
frappe.db.sql("""UPDATE `tabQuotation` SET `status` = 'Expired'
|
||||
WHERE `status` != "Expired" AND `valid_till` < %s""", (nowdate()))
|
||||
frappe.db.commit()
|
||||
|
||||
@frappe.whitelist()
|
||||
|
@ -218,9 +218,9 @@ class TestQuotation(unittest.TestCase):
|
||||
]
|
||||
yesterday = getdate(nowdate()) - datetime.timedelta(days=1)
|
||||
expired_quotation = make_quotation(item_list=quotation_item)
|
||||
# Manually set valid till date to bypass validation
|
||||
expired_quotation.valid_till = yesterday
|
||||
expired_quotation.save()
|
||||
# Call schedular method
|
||||
set_expired_status()
|
||||
|
||||
self.assertEqual(expired_quotation.status,"Expired")
|
||||
|
Loading…
x
Reference in New Issue
Block a user