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: avoid name clash in delivery stop (backport #37306) #37701

Merged
merged 1 commit into from
Oct 26, 2023
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
fix: avoid name clash in delivery stop (#37306)
* fix(stock): avoid name clash in delivery stop with Document.lock()

* chore(stock): format delivery stop json according to doctype builder

(cherry picked from commit 6817821)
blaggacao authored and mergify[bot] committed Oct 26, 2023
commit 0fbbe6ab900d42f16864d58f141bc798f50ac06a
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
@@ -343,5 +343,6 @@ erpnext.patches.v14_0.correct_asset_value_if_je_with_workflow
erpnext.patches.v14_0.migrate_deferred_accounts_to_item_defaults
erpnext.patches.v14_0.create_accounting_dimensions_in_sales_order_item
erpnext.patches.v14_0.rename_over_order_allowance_field
erpnext.patches.v14_0.migrate_delivery_stop_lock_field
# below migration patch should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
7 changes: 7 additions & 0 deletions erpnext/patches/v14_0/migrate_delivery_stop_lock_field.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import frappe
from frappe.model.utils.rename_field import rename_field


def execute():
if frappe.db.has_column("Delivery Stop", "lock"):
rename_field("Delivery Stop", "lock", "locked")
1,002 changes: 192 additions & 810 deletions erpnext/stock/doctype/delivery_stop/delivery_stop.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion erpnext/stock/doctype/delivery_trip/delivery_trip.py
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ def form_route_list(self, optimize):
for stop in self.delivery_stops:
leg.append(stop.customer_address)

if optimize and stop.lock:
if optimize and stop.locked:
route_list.append(leg)
leg = [stop.customer_address]

4 changes: 2 additions & 2 deletions erpnext/stock/doctype/delivery_trip/test_delivery_trip.py
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ def test_unoptimized_route_list_without_locks(self):
self.assertEqual(len(route_list[0]), 4)

def test_unoptimized_route_list_with_locks(self):
self.delivery_trip.delivery_stops[0].lock = 1
self.delivery_trip.delivery_stops[0].locked = 1
self.delivery_trip.save()
route_list = self.delivery_trip.form_route_list(optimize=False)

@@ -65,7 +65,7 @@ def test_optimized_route_list_without_locks(self):
self.assertEqual(len(route_list[0]), 4)

def test_optimized_route_list_with_locks(self):
self.delivery_trip.delivery_stops[0].lock = 1
self.delivery_trip.delivery_stops[0].locked = 1
self.delivery_trip.save()
route_list = self.delivery_trip.form_route_list(optimize=True)