Merge pull request #22743 from frappe/vehicle

fix: Heatmap in Vehicle
This commit is contained in:
Rucha Mahabal 2020-07-20 23:52:25 +05:30 committed by GitHub
commit a13a0608b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,3 +14,10 @@ class Vehicle(Document):
frappe.throw(_("Insurance Start date should be less than Insurance End date"))
if getdate(self.carbon_check_date) > getdate():
frappe.throw(_("Last carbon check date cannot be a future date"))
def get_timeline_data(doctype, name):
'''Return timeline for vehicle log'''
return dict(frappe.db.sql('''select unix_timestamp(date), count(*)
from `tabVehicle Log` where license_plate=%s
and date > date_sub(curdate(), interval 1 year)
group by date''', name))