Skip to content

Commit

Permalink
Minor Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaduggal committed Jun 17, 2020
1 parent 4d2b389 commit 1561176
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def get_tracking_from_fedex(track_doc):
scans = []
if scan_events:
for event in scan_events:
if event.get('EventType') == 'DL':
track_doc.delivery_date_time = event.get('Timestamp').replace(tzinfo=None)
row_dict = {"time": event.get('Timestamp').replace(tzinfo=None)}
city = event.get('Address').get('City', None)
state = event.get('Address').get('StateOrProvinceCode', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
from ..doctype.carrier_tracking.fedex_functions import get_tracking_from_fedex


def update_delivery_date_time():
ctrack_dict = frappe.db.sql("""SELECT ct.name FROM `tabCarrier Tracking` ct WHERE ct.status = 'Delivered'
AND ct.docstatus !=2 AND ct.status_code = 'DL' AND ct.delivery_date_time IS NULL
ORDER BY ct.creation ASC""", as_dict=1)
sno=1
for ct in ctrack_dict:
ct_doc = frappe.get_doc('Carrier Tracking', ct.name)
print(str(sno) + ". " + ct.name + " is being Updated")
sno +=1
get_tracking_from_fedex(ct_doc)
frappe.db.commit()

def update_costing_bypass():
bypass_ct = frappe.db.sql("""SELECT ct.name FROM `tabCarrier Tracking` ct WHERE ct.docstatus<2
AND ct.document = 'Sales Invoice' ORDER BY ct.creation DESC""")
Expand Down

0 comments on commit 1561176

Please sign in to comment.