Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update delivery note with delivered status if visited check in delivery stop in delivery trip #1180

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions erpnext/stock/doctype/delivery_trip/delivery_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def on_submit(self):

def on_update_after_submit(self):
self.update_delivery_note_status()
self.update_delivered_status_for_delivery_note()
self.validate_payment_due_date()
def before_submit(self):
self.update_status()
Expand Down Expand Up @@ -135,6 +136,11 @@ def update_delivery_notes(self, delete=False):
delivery_notes = [get_link_to_form("Delivery Note", note) for note in delivery_notes]
frappe.msgprint(_("Delivery Notes {0} updated".format(", ".join(delivery_notes))))

def update_delivered_status_for_delivery_note(self):
for stop in self.delivery_stops:
if stop.visited:
frappe.db.set_value("Delivery Note", stop.delivery_note, "delivered", 1)

def process_route(self, optimize):
"""
Estimate the arrival times for each stop in the Delivery Trip.
Expand Down