From ecf15130bad830e603c3778408e8770fce651783 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Mon, 21 Apr 2025 19:05:16 +0530 Subject: [PATCH 1/5] fix: backslash in url --- .../doctype/production_plan/production_plan.py | 4 +++- .../stock/doctype/material_request/material_request.json | 8 +++++--- .../stock/doctype/material_request/material_request.py | 8 +++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 1e35b4e7311..6babcd9f21e 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -948,9 +948,11 @@ class ProductionPlan(Document): frappe.flags.mute_messages = False + from urllib.parse import quote_plus + if material_request_list: material_request_list = [ - f"""{m.name}""" + f"""{m.name}""" for m in material_request_list ] msgprint(_("{0} created").format(comma_and(material_request_list))) diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index 1684d531889..af3061018ab 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -53,13 +53,14 @@ "options": "fa fa-pushpin" }, { + "default": "MAT/MR/.YYYY.-", "fieldname": "naming_series", "fieldtype": "Select", "label": "Series", "no_copy": 1, "oldfieldname": "naming_series", "oldfieldtype": "Select", - "options": "MAT-MR-.YYYY.-", + "options": "MAT-MR-.YYYY.-\nMAT/MR/.YYYY.-", "print_hide": 1, "reqd": 1, "set_only_once": 1 @@ -357,7 +358,7 @@ "idx": 70, "is_submittable": 1, "links": [], - "modified": "2024-12-16 12:46:02.262167", + "modified": "2025-04-21 18:36:04.827917", "modified_by": "Administrator", "module": "Stock", "name": "Material Request", @@ -424,10 +425,11 @@ } ], "quick_entry": 1, + "row_format": "Dynamic", "search_fields": "status,transaction_date", "show_name_in_global_search": 1, "sort_field": "creation", "sort_order": "DESC", "states": [], "title_field": "title" -} \ No newline at end of file +} diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 1ae37d212c0..ae81bf80383 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -27,14 +27,15 @@ form_grid_templates = {"items": "templates/form_grid/material_request_grid.html" class MaterialRequest(BuyingController): # begin: auto-generated types + # ruff: noqa + # This code is auto-generated. Do not modify anything in this block. from typing import TYPE_CHECKING if TYPE_CHECKING: - from frappe.types import DF - from erpnext.stock.doctype.material_request_item.material_request_item import MaterialRequestItem + from frappe.types import DF amended_from: DF.Link | None company: DF.Link @@ -50,7 +51,7 @@ class MaterialRequest(BuyingController): "Subcontracting", "Customer Provided", ] - naming_series: DF.Literal["MAT-MR-.YYYY.-"] + naming_series: DF.Literal["MAT-MR-.YYYY.-", "MAT/MR/.YYYY.-"] per_ordered: DF.Percent per_received: DF.Percent scan_barcode: DF.Data | None @@ -78,6 +79,7 @@ class MaterialRequest(BuyingController): transaction_date: DF.Date transfer_status: DF.Literal["", "Not Started", "In Transit", "Completed"] work_order: DF.Link | None + # ruff: noqa # end: auto-generated types def check_if_already_pulled(self): From 7a82b37f7605449aadb0c1a53dfde8bdf64beef7 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 22 Apr 2025 15:22:54 +0530 Subject: [PATCH 2/5] fix: use get_url_to_form instead --- .../manufacturing/doctype/production_plan/production_plan.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 6babcd9f21e..ac56449efa8 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -17,6 +17,7 @@ from frappe.utils import ( comma_and, flt, get_link_to_form, + get_url_to_form, getdate, now_datetime, nowdate, @@ -948,11 +949,9 @@ class ProductionPlan(Document): frappe.flags.mute_messages = False - from urllib.parse import quote_plus - if material_request_list: material_request_list = [ - f"""{m.name}""" + f"""{m.name}""" for m in material_request_list ] msgprint(_("{0} created").format(comma_and(material_request_list))) From eaaf34cda659f61a13d1fe9f15cb71bc91ba10c0 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 22 Apr 2025 15:27:09 +0530 Subject: [PATCH 3/5] fix: revert unintended changes --- .../stock/doctype/material_request/material_request.json | 8 +++----- .../stock/doctype/material_request/material_request.py | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index af3061018ab..1684d531889 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -53,14 +53,13 @@ "options": "fa fa-pushpin" }, { - "default": "MAT/MR/.YYYY.-", "fieldname": "naming_series", "fieldtype": "Select", "label": "Series", "no_copy": 1, "oldfieldname": "naming_series", "oldfieldtype": "Select", - "options": "MAT-MR-.YYYY.-\nMAT/MR/.YYYY.-", + "options": "MAT-MR-.YYYY.-", "print_hide": 1, "reqd": 1, "set_only_once": 1 @@ -358,7 +357,7 @@ "idx": 70, "is_submittable": 1, "links": [], - "modified": "2025-04-21 18:36:04.827917", + "modified": "2024-12-16 12:46:02.262167", "modified_by": "Administrator", "module": "Stock", "name": "Material Request", @@ -425,11 +424,10 @@ } ], "quick_entry": 1, - "row_format": "Dynamic", "search_fields": "status,transaction_date", "show_name_in_global_search": 1, "sort_field": "creation", "sort_order": "DESC", "states": [], "title_field": "title" -} +} \ No newline at end of file diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index ae81bf80383..1ae37d212c0 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -27,16 +27,15 @@ form_grid_templates = {"items": "templates/form_grid/material_request_grid.html" class MaterialRequest(BuyingController): # begin: auto-generated types - # ruff: noqa - # This code is auto-generated. Do not modify anything in this block. from typing import TYPE_CHECKING if TYPE_CHECKING: - from erpnext.stock.doctype.material_request_item.material_request_item import MaterialRequestItem from frappe.types import DF + from erpnext.stock.doctype.material_request_item.material_request_item import MaterialRequestItem + amended_from: DF.Link | None company: DF.Link customer: DF.Link | None @@ -51,7 +50,7 @@ class MaterialRequest(BuyingController): "Subcontracting", "Customer Provided", ] - naming_series: DF.Literal["MAT-MR-.YYYY.-", "MAT/MR/.YYYY.-"] + naming_series: DF.Literal["MAT-MR-.YYYY.-"] per_ordered: DF.Percent per_received: DF.Percent scan_barcode: DF.Data | None @@ -79,7 +78,6 @@ class MaterialRequest(BuyingController): transaction_date: DF.Date transfer_status: DF.Literal["", "Not Started", "In Transit", "Completed"] work_order: DF.Link | None - # ruff: noqa # end: auto-generated types def check_if_already_pulled(self): From 5d07beee61102c2b5ab171dabc62dae6400e56c8 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 22 Apr 2025 15:50:02 +0530 Subject: [PATCH 4/5] fix: change get_url_to_form to get_link_to_form --- .../manufacturing/doctype/production_plan/production_plan.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index ac56449efa8..0fc9fcf357d 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -951,8 +951,7 @@ class ProductionPlan(Document): if material_request_list: material_request_list = [ - f"""{m.name}""" - for m in material_request_list + get_link_to_form("Material Request", m.name) for m in material_request_list ] msgprint(_("{0} created").format(comma_and(material_request_list))) else: From c3d172fac32acb5692f2ca52f98927fb92ad3d1e Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 22 Apr 2025 15:50:51 +0530 Subject: [PATCH 5/5] fix: remove unused import --- erpnext/manufacturing/doctype/production_plan/production_plan.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 0fc9fcf357d..8ba9afe9fc6 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -17,7 +17,6 @@ from frappe.utils import ( comma_and, flt, get_link_to_form, - get_url_to_form, getdate, now_datetime, nowdate,