Skip to content

Commit

Permalink
Minor Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaduggal committed Jun 16, 2020
1 parent e6e9523 commit 1ececc4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
6 changes: 2 additions & 4 deletions rigpl_erpnext/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@
"rigpl_erpnext.rigpl_erpnext.scheduled_tasks.variant_copy.check_wrong_variants"
# Runs everyday at 2:10 AM
],
"*/16 * * * *": [
"rigpl_erpnext.rigpl_erpnext.scheduled_tasks.indiamart.execute"
],
"10 3 * * *": [
"rigpl_erpnext.rigpl_erpnext.scheduled_tasks.item_valuation_rate.set_valuation_rate_for_all"
# Runs everyday at 3:10 AM
Expand All @@ -207,7 +204,8 @@
],
"daily": [
"rigpl_erpnext.rigpl_erpnext.scheduled_tasks.permission_check.check_permission_exist",
"rigpl_erpnext.rigpl_erpnext.scheduled_tasks.work_order_status.execute"
"rigpl_erpnext.rigpl_erpnext.scheduled_tasks.work_order_status.execute",
"rigpl_erpnext.rigpl_erpnext.scheduled_tasks.indiamart.execute"

],
"hourly": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ def validate(self):
else:
self.docstatus = 1
if self.published == 1:
self.route = self.document_name.lower() + self.name.lower()
self.route = self.name.lower()
else:
self.route = ""
trans_doc = frappe.get_doc("Transporters", self.carrier_name)
if trans_doc.track_on_shipway != 1 and trans_doc.fedex_credentials != 1 and trans_doc.fedex_tracking_only != 1:
if trans_doc.docstatus != 1:
trans_doc.docstatus = 1
trans_doc.manual_exception_removed = 1
self.update_fields(trans_doc)
from_address_doc = frappe.get_doc("Address", self.from_address)
to_address_doc = frappe.get_doc("Address", self.to_address)
Expand Down Expand Up @@ -82,7 +86,7 @@ def auto_submit_ctrack(self, trans_doc):

def on_submit(self):
self.published = 1
self.route = self.document_name.lower() + self.name.lower()
self.route = self.name.lower()
self.push_data_to_sales_invoice()

def on_cancel(self):
Expand Down Expand Up @@ -189,7 +193,7 @@ def non_fedex_validations(self):
if re.sub('[^A-Za-z0-9]+', '', str(self.awb_number)) != si_awb or \
si_doc.transporters != self.carrier_name:
create_new_carrier_track(si_doc, frappe)
self.submit(ignore_permissions = True)
self.submit()
# self.save(ignore_permissions=True)
#else:
#self.awb_number = si_doc.lr_no
Expand Down Expand Up @@ -329,7 +333,7 @@ def book_shipment(self):
if packages.idx == 1:
shipment_booking(self)
self.published = 1
self.route = self.document_name.lower() + self.name.lower()
self.route = self.name.lower()
self.docstatus = 1
self.save(ignore_permissions=True)
else:
Expand Down Expand Up @@ -380,12 +384,12 @@ def set_recipient_email(self, to_address_doc, contact_doc):
if len(str(to_address_doc.email_id) + ", " + str(contact_doc.email_id)) < 140:
self.customer_emails = str(to_address_doc.email_id) + ", " + str(contact_doc.email_id)
else:
if len(contact_doc.email_id) < 140:
if len(str(contact_doc.email_id)) < 140:
self.customer_emails = contact_doc.email_id
elif len(to_address_doc.email_id) < 140:
self.customer_emails = to_address_doc.email_id
else:
if len(contact_doc.email_id) < 140:
if len(str(contact_doc.email_id)) < 140:
self.customer_emails = contact_doc.email_id
elif len(to_address_doc.email_id) < 140:
self.customer_emails = to_address_doc.email_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,17 @@ def get_all_ship_data():
track_doc = frappe.get_doc("Carrier Tracking", tracks.name)
getOrderShipmentDetails(track_doc)
else:
print("{}. Tracking was updated less than 6 hrs ago hence skipping {}".format(str(sno+1), tracks.name))
print("{}. Fedex Tracking was updated less than 6 hrs ago hence skipping {}".
format(str(sno+1), tracks.name))
elif (tracks.cred == 0 and tracks.tracking_only == 0) and days_diff < 60:
# Get from Shipway only less than 90 days old shipments
print("{}. Getting Tracking for {} from Shipway".format(str(sno+1), tracks.name))
track_doc = frappe.get_doc("Carrier Tracking", tracks.name)
getOrderShipmentDetails(track_doc)
# Get from Shipway only less than 60 days old shipments
if last_update_hrs > 6:
print("{}. Getting Tracking for {} from Shipway".format(str(sno+1), tracks.name))
track_doc = frappe.get_doc("Carrier Tracking", tracks.name)
getOrderShipmentDetails(track_doc)
else:
print("{}. Shipway Tracking was updated less than 6 hrs ago hence skipping {}".
format(str(sno + 1), tracks.name))
#track_doc.flags.ignore_permissions = True
sno += 1

Expand Down
3 changes: 2 additions & 1 deletion rigpl_erpnext/rigpl_erpnext/validations/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,9 @@ def check_existing_track(doctype, docname):

def is_tracked_transporter(doc, method):
fedex = frappe.get_value("Transporters", doc.transporters, "fedex_credentials")
fedex_track = frappe.get_value("Transporters", doc.transporters, "fedex_tracking_only")
shipway = frappe.get_value("Transporters", doc.transporters, "track_on_shipway")
if fedex == 1 or shipway == 1:
if fedex == 1 or shipway == 1 or fedex_track == 1:
ttrans = 1
else:
ttrans = 0
Expand Down

0 comments on commit 1ececc4

Please sign in to comment.