Skip to content

Track Overrides with GHA helper#142

Merged
agritheory merged 4 commits into
version-15from
track-overrides
Oct 8, 2025
Merged

Track Overrides with GHA helper#142
agritheory merged 4 commits into
version-15from
track-overrides

Conversation

@IshwaryaM1030

@IshwaryaM1030 IshwaryaM1030 commented Oct 6, 2025

Copy link
Copy Markdown
Collaborator

Closes #87

@github-actions

github-actions Bot commented Oct 6, 2025

Copy link
Copy Markdown

The following override methods have changed in the upstream repository:

update_work_order_qty in file erpnext/manufacturing/doctype/work_order/work_order.py has changed:

--- old
+++ new
@@ -23,7 +23,7 @@
 			if qty > completed_qty:
 				frappe.throw(
 					_(\"{0} ({1}) cannot be greater than planned quantity ({2}) in Work Order {3}\").format(
-						self.meta.get_label(fieldname), qty, completed_qty, self.name
+						_(self.meta.get_label(fieldname)), qty, completed_qty, self.name
 					),
 					StockOverProductionError,
 				)

validate_job_card in file erpnext/manufacturing/doctype/job_card/job_card.py has changed:

--- old
+++ new
@@ -12,6 +12,12 @@
 					bold(\"Job Card\"), get_link_to_form(\"Job Card\", self.name)
 				)
 			)
+		elif frappe.db.get_single_value(\"Manufacturing Settings\", \"enforce_time_logs\"):
+			for row in self.time_logs:
+				if not row.from_time or not row.to_time:
+					frappe.throw(
+						_(\"Row #{0}: From Time and To Time fields are required\").format(row.idx),
+					)
 
 		precision = self.precision(\"total_completed_qty\")
 		total_completed_qty = flt(

set_missing_item_details in file erpnext/controllers/accounts_controller.py has changed:

--- old
+++ new
@@ -52,6 +52,13 @@
 								)
 							):
 								item.set(fieldname, value)
+
+								if fieldname == \"batch_no\" and item.batch_no and not item.is_free_item:
+									if ret.get(\"rate\"):
+										item.set(\"rate\", ret.get(\"rate\"))
+
+									if not item.get(\"price_list_rate\") and ret.get(\"price_list_rate\"):
+										item.set(\"price_list_rate\", ret.get(\"price_list_rate\"))
 
 							elif fieldname in [\"cost_center\", \"conversion_factor\"] and not item.get(
 								fieldname

make_work_order_for_subassembly_items in file erpnext/manufacturing/doctype/production_plan/production_plan.py has changed:

--- old
+++ new
@@ -13,7 +13,14 @@
 				\"company\": self.get(\"company\"),
 			}
 
+			if flt(row.qty) <= flt(row.ordered_qty):
+				continue
+
 			self.prepare_data_for_sub_assembly_items(row, work_order_data)
+
+			if work_order_data.get(\"qty\") <= 0:
+				continue
+
 			work_order = self.create_work_order(work_order_data)
 			if work_order:
 				wo_list.append(work_order)

@IshwaryaM1030

Copy link
Copy Markdown
Collaborator Author

@agritheory I see only Sales Order class has overridden from Sales Cycle doctypes. So adding the track overrides only for SO in this PR.

@github-actions

github-actions Bot commented Oct 8, 2025

Copy link
Copy Markdown

The following override methods have changed in the upstream repository:

update_work_order_qty in file erpnext/manufacturing/doctype/work_order/work_order.py has changed:

--- old
+++ new
@@ -23,7 +23,7 @@
 			if qty > completed_qty:
 				frappe.throw(
 					_(\"{0} ({1}) cannot be greater than planned quantity ({2}) in Work Order {3}\").format(
-						self.meta.get_label(fieldname), qty, completed_qty, self.name
+						_(self.meta.get_label(fieldname)), qty, completed_qty, self.name
 					),
 					StockOverProductionError,
 				)

validate_job_card in file erpnext/manufacturing/doctype/job_card/job_card.py has changed:

--- old
+++ new
@@ -12,6 +12,12 @@
 					bold(\"Job Card\"), get_link_to_form(\"Job Card\", self.name)
 				)
 			)
+		elif frappe.db.get_single_value(\"Manufacturing Settings\", \"enforce_time_logs\"):
+			for row in self.time_logs:
+				if not row.from_time or not row.to_time:
+					frappe.throw(
+						_(\"Row #{0}: From Time and To Time fields are required\").format(row.idx),
+					)
 
 		precision = self.precision(\"total_completed_qty\")
 		total_completed_qty = flt(

set_missing_item_details in file erpnext/controllers/accounts_controller.py has changed:

--- old
+++ new
@@ -52,6 +52,13 @@
 								)
 							):
 								item.set(fieldname, value)
+
+								if fieldname == \"batch_no\" and item.batch_no and not item.is_free_item:
+									if ret.get(\"rate\"):
+										item.set(\"rate\", ret.get(\"rate\"))
+
+									if not item.get(\"price_list_rate\") and ret.get(\"price_list_rate\"):
+										item.set(\"price_list_rate\", ret.get(\"price_list_rate\"))
 
 							elif fieldname in [\"cost_center\", \"conversion_factor\"] and not item.get(
 								fieldname

get_item_details in file erpnext/stock/get_item_details.py has changed:

--- old
+++ new
@@ -61,6 +61,15 @@
 
 	out.update(get_price_list_rate(args, item))
 
+	if (
+		not out.price_list_rate
+		and args.transaction_type == \"selling\"
+		and frappe.get_single_value(\"Selling Settings\", \"fallback_to_default_price_list\")
+	):
+		fallback_args = args.copy()
+		fallback_args.price_list = frappe.get_single_value(\"Selling Settings\", \"selling_price_list\")
+		out.update(get_price_list_rate(fallback_args, item))
+
 	args.customer = current_customer
 
 	if args.customer and cint(args.is_pos):

validate_finished_goods in file erpnext/stock/doctype/stock_entry/stock_entry.py has changed:

--- old
+++ new
@@ -21,12 +21,6 @@
 					frappe.throw(
 						_(\"Finished Item {0} does not match with Work Order {1}\").format(
 							d.item_code, self.work_order
-						)
-					)
-				elif flt(d.transfer_qty) > flt(self.fg_completed_qty):
-					frappe.throw(
-						_(\"Quantity in row {0} ({1}) must be same as manufactured quantity {2}\").format(
-							d.idx, d.transfer_qty, self.fg_completed_qty
 						)
 					)
 

make_work_order_for_subassembly_items in file erpnext/manufacturing/doctype/production_plan/production_plan.py has changed:

--- old
+++ new
@@ -10,10 +10,18 @@
 			work_order_data = {
 				\"wip_warehouse\": default_warehouses.get(\"wip_warehouse\"),
 				\"fg_warehouse\": default_warehouses.get(\"fg_warehouse\"),
+				\"scrap_warehouse\": default_warehouses.get(\"scrap_warehouse\"),
 				\"company\": self.get(\"company\"),
 			}
 
+			if flt(row.qty) <= flt(row.ordered_qty):
+				continue
+
 			self.prepare_data_for_sub_assembly_items(row, work_order_data)
+
+			if work_order_data.get(\"qty\") <= 0:
+				continue
+
 			work_order = self.create_work_order(work_order_data)
 			if work_order:
 				wo_list.append(work_order)

@github-actions

github-actions Bot commented Oct 8, 2025

Copy link
Copy Markdown

The following override methods have changed in the upstream repository:

get_item_details in file erpnext/stock/get_item_details.py has changed:

--- old
+++ new
@@ -61,6 +61,15 @@
 
 	out.update(get_price_list_rate(args, item))
 
+	if (
+		not out.price_list_rate
+		and args.transaction_type == \"selling\"
+		and frappe.get_single_value(\"Selling Settings\", \"fallback_to_default_price_list\")
+	):
+		fallback_args = args.copy()
+		fallback_args.price_list = frappe.get_single_value(\"Selling Settings\", \"selling_price_list\")
+		out.update(get_price_list_rate(fallback_args, item))
+
 	args.customer = current_customer
 
 	if args.customer and cint(args.is_pos):

@agritheory
agritheory merged commit a2d631e into version-15 Oct 8, 2025
7 checks passed
@agritheory
agritheory deleted the track-overrides branch October 8, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants