Merge branch 'staging-fixes' into staging

This commit is contained in:
Frappe Bot 2018-12-10 16:05:45 +00:00
commit 298796bea6
4 changed files with 6 additions and 19 deletions

View File

@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)"
source_link = "https://github.com/frappe/erpnext"
develop_version = '12.x.x-develop'
staging_version = '11.0.3-beta.27'
staging_version = '11.0.3-beta.28'
error_report_email = "support@erpnext.com"

View File

@ -579,4 +579,3 @@ erpnext.patches.v10_0.update_user_image_in_employee
erpnext.patches.v11_0.update_delivery_trip_status
erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items
erpnext.patches.v11_0.set_missing_gst_hsn_code
erpnext.patches.v11_0.update_package_total_in_delivery_trips

View File

@ -1,7 +0,0 @@
import frappe
def execute():
for trip in frappe.get_all("Delivery Trip", {"docstatus" : 1}):
trip_doc = frappe.get_doc("Delivery Trip", trip.name)
total = sum([stop.grand_total for stop in trip_doc.delivery_stops if stop.grand_total])
frappe.db.set_value("Delivery Trip", trip.name, "package_total", total, update_modified=False)

View File

@ -25,8 +25,6 @@ class DeliveryTrip(Document):
def validate(self):
self.validate_stop_addresses()
self.update_status()
self.update_package_total()
def on_submit(self):
self.update_status()
@ -39,6 +37,11 @@ class DeliveryTrip(Document):
self.update_status()
self.update_delivery_notes(delete=True)
def validate_stop_addresses(self):
for stop in self.delivery_stops:
if not stop.customer_address:
stop.customer_address = get_address_display(frappe.get_doc("Address", stop.address).as_dict())
def update_status(self):
status = {
0: "Draft",
@ -55,14 +58,6 @@ class DeliveryTrip(Document):
self.db_set("status", status)
def update_package_total(self):
self.package_total = sum([stop.grand_total for stop in self.delivery_stops if stop.grand_total])
def validate_stop_addresses(self):
for stop in self.delivery_stops:
if not stop.customer_address:
stop.customer_address = get_address_display(frappe.get_doc("Address", stop.address).as_dict())
def update_delivery_notes(self, delete=False):
"""
Update all connected Delivery Notes with Delivery Trip details