From 15e36636339f968b0e9eddfc610a0179baf6c3ca Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:03:09 +0530 Subject: [PATCH 01/22] fix: required by date in the reorder material request (backport #44497) (#44508) * fix: required by date in the reorder material request (#44497) (cherry picked from commit 4001166ecc689ee877adf1d9babd4d0332ab4752) # Conflicts: # erpnext/stock/doctype/stock_entry/test_stock_entry.py * chore: fix conflicts --------- Co-authored-by: rohitwaghchaure --- .../doctype/stock_entry/test_stock_entry.py | 40 +++++++++++++++++++ erpnext/stock/reorder_item.py | 2 + 2 files changed, 42 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index ff3a8be0419..bb7d944e639 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -1727,6 +1727,46 @@ class TestStockEntry(FrappeTestCase): mr.cancel() mr.delete() + def test_auto_reorder_level_with_lead_time_days(self): + from erpnext.stock.reorder_item import reorder_item + + item_doc = make_item( + "Test Auto Reorder Item - 002", + properties={"stock_uom": "Kg", "purchase_uom": "Nos", "is_stock_item": 1, "lead_time_days": 2}, + uoms=[{"uom": "Nos", "conversion_factor": 5}], + ) + + if not frappe.db.exists("Item Reorder", {"parent": item_doc.name}): + item_doc.append( + "reorder_levels", + { + "warehouse_reorder_level": 0, + "warehouse_reorder_qty": 10, + "warehouse": "_Test Warehouse - _TC", + "material_request_type": "Purchase", + }, + ) + + item_doc.save(ignore_permissions=True) + + frappe.db.set_single_value("Stock Settings", "auto_indent", 1) + + mr_list = reorder_item() + + frappe.db.set_single_value("Stock Settings", "auto_indent", 0) + mrs = frappe.get_all( + "Material Request Item", + fields=["schedule_date"], + filters={"item_code": item_doc.name, "uom": "Nos"}, + ) + + for mri in mrs: + self.assertEqual(getdate(mri.schedule_date), getdate(add_days(today(), 2))) + + for mr in mr_list: + mr.cancel() + mr.delete() + def test_stock_entry_for_same_posting_date_and_time(self): warehouse = "_Test Warehouse - _TC" item_code = "Test Stock Entry For Same Posting Datetime 1" diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index c859506ce8a..ce9fdb547d2 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -98,6 +98,7 @@ def _reorder_item(): "description": d.description, "stock_uom": d.stock_uom, "purchase_uom": d.purchase_uom, + "lead_time_days": d.lead_time_days, } ), ) @@ -129,6 +130,7 @@ def get_items_for_reorder() -> dict[str, list]: item_table.brand, item_table.variant_of, item_table.has_variants, + item_table.lead_time_days, ) .where( (item_table.disabled == 0) From c502b562db3dab31050c46d40040d1bdaa7246de Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:45:29 +0530 Subject: [PATCH 02/22] fix: inv dimensions fields not creating for standard doctype (backport #44504) (#44514) fix: inv dimensions fields not creating for standard doctype (#44504) (cherry picked from commit 353610ce619d8406c8bd613807cf69c76274dfe0) Co-authored-by: rohitwaghchaure --- .../inventory_dimension/inventory_dimension.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py index 5fe5042ffd6..5d701a73393 100644 --- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py +++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py @@ -173,13 +173,10 @@ class InventoryDimension(Document): dimension_fields = [] if self.apply_to_all_doctypes: for doctype in get_inventory_documents(): - if field_exists(doctype[0], self.source_fieldname): - continue - dimension_fields = self.get_dimension_fields(doctype[0]) self.add_transfer_field(doctype[0], dimension_fields) custom_fields.setdefault(doctype[0], dimension_fields) - elif not field_exists(self.document_type, self.source_fieldname): + else: dimension_fields = self.get_dimension_fields() self.add_transfer_field(self.document_type, dimension_fields) @@ -198,8 +195,17 @@ class InventoryDimension(Document): dimension_field["fieldname"] = self.target_fieldname custom_fields["Stock Ledger Entry"] = dimension_field + filter_custom_fields = {} if custom_fields: - create_custom_fields(custom_fields) + for doctype, fields in custom_fields.items(): + if isinstance(fields, dict): + fields = [fields] + + for field in fields: + if not field_exists(doctype, field["fieldname"]): + filter_custom_fields.setdefault(doctype, []).append(field) + + create_custom_fields(filter_custom_fields) def add_transfer_field(self, doctype, dimension_fields): if doctype not in [ From e1d288321f52fb5b749daa256dcff21fb3b833d4 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Thu, 5 Dec 2024 05:29:43 +0100 Subject: [PATCH 03/22] refactor: translatable label on pos payments (#42081) * Use better description in pos_payment.js Use Change Amount instead of Change and To Be Paid in pos_payment.js and be consistent with other strings * change_amount_pos_payment.js (cherry picked from commit 138ffc4e93f8d63f6784d4c48ccb16e825144d8f) --- erpnext/selling/page/point_of_sale/pos_payment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/page/point_of_sale/pos_payment.js b/erpnext/selling/page/point_of_sale/pos_payment.js index 232b6a02123..7e16280eb37 100644 --- a/erpnext/selling/page/point_of_sale/pos_payment.js +++ b/erpnext/selling/page/point_of_sale/pos_payment.js @@ -584,7 +584,7 @@ erpnext.PointOfSale.Payment = class { const remaining = grand_total - doc.paid_amount; const change = doc.change_amount || remaining <= 0 ? -1 * remaining : undefined; const currency = doc.currency; - const label = change ? __("Change") : __("To Be Paid"); + const label = __("Change Amount"); this.$totals.html( `
From dfbb2279b60595c4b36e6f27f619bd5a619e96fd Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Wed, 4 Dec 2024 09:07:09 +0100 Subject: [PATCH 04/22] fix: strings for translation in pos_past_order_summary.js (cherry picked from commit 23c846d4b92dbc121255c8dc98d11de7536e3e4e) --- .../selling/page/point_of_sale/pos_past_order_summary.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js index b0b64e64747..ea6e453849e 100644 --- a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js +++ b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js @@ -46,7 +46,7 @@ erpnext.PointOfSale.PastOrderSummary = class { init_email_print_dialog() { const email_dialog = new frappe.ui.Dialog({ - title: "Email Receipt", + title: __("Email Receipt"), fields: [ { fieldname: "email_id", fieldtype: "Data", options: "Email", label: "Email ID" }, // {fieldname:'remarks', fieldtype:'Text', label:'Remarks (if any)'} @@ -59,7 +59,7 @@ erpnext.PointOfSale.PastOrderSummary = class { this.email_dialog = email_dialog; const print_dialog = new frappe.ui.Dialog({ - title: "Print Receipt", + title: __("Print Receipt"), fields: [{ fieldname: "print", fieldtype: "Data", label: "Print Preview" }], primary_action: () => { this.print_receipt(); @@ -112,7 +112,7 @@ erpnext.PointOfSale.PastOrderSummary = class { get_discount_html(doc) { if (doc.discount_amount) { return `
-
Discount (${doc.additional_discount_percentage} %)
+
${__("Discount")} (${doc.additional_discount_percentage} %)
${format_currency(doc.discount_amount, doc.currency)}
`; } else { From 8233e22d8b8c73eec8b192ad8d70883c5e183f47 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:40:55 +0100 Subject: [PATCH 05/22] fix: add label strings for translation in pos_controller.js (cherry picked from commit bd77a5557d9b3bac54122cf43d56050bc1ecba5e) --- erpnext/selling/page/point_of_sale/pos_controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js index 3d42f3ea23f..86aa8dd0961 100644 --- a/erpnext/selling/page/point_of_sale/pos_controller.js +++ b/erpnext/selling/page/point_of_sale/pos_controller.js @@ -30,7 +30,7 @@ erpnext.PointOfSale.Controller = class { fieldname: "mode_of_payment", fieldtype: "Link", in_list_view: 1, - label: "Mode of Payment", + label: __("Mode of Payment"), options: "Mode of Payment", reqd: 1, }, @@ -38,7 +38,7 @@ erpnext.PointOfSale.Controller = class { fieldname: "opening_amount", fieldtype: "Currency", in_list_view: 1, - label: "Opening Amount", + label: __("Opening Amount"), options: "company:company_currency", change: function () { dialog.fields_dict.balance_details.df.data.some((d) => { @@ -87,7 +87,7 @@ erpnext.PointOfSale.Controller = class { { fieldname: "balance_details", fieldtype: "Table", - label: "Opening Balance Details", + label: __("Opening Balance Details"), cannot_add_rows: false, in_place_edit: true, reqd: 1, From 3620ddab3457398880e80e783c2ff8313ba2ccad Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Wed, 4 Dec 2024 08:58:16 +0100 Subject: [PATCH 06/22] fix: add labels for translation in sales_order.js (cherry picked from commit d544328ffe629ed1dfb22a593db4044de8e30131) --- erpnext/selling/doctype/sales_order/sales_order.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 0d9a0e2e8b3..aff2c824225 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -68,7 +68,7 @@ frappe.ui.form.on("Sales Order", { target: frm, setters: [ { - label: 'Supplier', + label: __('Supplier'), fieldname: 'supplier', fieldtype: 'Link', options: 'Supplier' @@ -376,7 +376,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex target: me.frm, setters: [ { - label: "Customer", + label: __("Customer"), fieldname: "party_name", fieldtype: "Link", options: "Customer", @@ -430,7 +430,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex } else { const fields = [{ - label: 'Items', + label: __('Items'), fieldtype: 'Table', fieldname: 'items', description: __('Select BOM and Qty for Production'), @@ -724,7 +724,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex "default": 0 }, { - fieldname: 'items_for_po', fieldtype: 'Table', label: 'Select Items', + fieldname: 'items_for_po', fieldtype: 'Table', label: __('Select Items'), fields: [ { fieldtype:'Data', From 1f0f31a773c012ce01a49da8babeb3ee5c7f8944 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:12:34 +0100 Subject: [PATCH 07/22] fix: add strings for translation in pos_item_cart.js (cherry picked from commit 4b72b60f1a75657c444f210fcb3dd7a055e4d9b8) --- erpnext/selling/page/point_of_sale/pos_item_cart.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/pos_item_cart.js b/erpnext/selling/page/point_of_sale/pos_item_cart.js index 69f2511062b..3f33f711ba9 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_cart.js +++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js @@ -959,13 +959,13 @@ erpnext.PointOfSale.ItemCart = class { if (!res.length) { transaction_container.html( - `
No recent transactions found
` + `
${__("No recent transactions found")}
` ); return; } const elapsed_time = moment(res[0].posting_date + " " + res[0].posting_time).fromNow(); - this.$customer_section.find(".customer-desc").html(`Last transacted ${elapsed_time}`); + this.$customer_section.find(".customer-desc").html(`${__("Last transacted")} ${__(elapsed_time)}`); res.forEach((invoice) => { const posting_datetime = moment(invoice.posting_date + " " + invoice.posting_time).format( @@ -990,7 +990,7 @@ erpnext.PointOfSale.ItemCart = class {
- ${invoice.status} + ${__(invoice.status)}
From 639a71ffd09c567b5b9a7ed8b4b26eb025bf8652 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 5 Dec 2024 10:10:34 +0530 Subject: [PATCH 08/22] chore: linter fix (cherry picked from commit 31efaf6dbf8f0139a4dd291ae8abb3e27bdc91ac) --- erpnext/selling/page/point_of_sale/pos_item_cart.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/page/point_of_sale/pos_item_cart.js b/erpnext/selling/page/point_of_sale/pos_item_cart.js index 3f33f711ba9..eb84796c2d0 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_cart.js +++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js @@ -965,7 +965,9 @@ erpnext.PointOfSale.ItemCart = class { } const elapsed_time = moment(res[0].posting_date + " " + res[0].posting_time).fromNow(); - this.$customer_section.find(".customer-desc").html(`${__("Last transacted")} ${__(elapsed_time)}`); + this.$customer_section + .find(".customer-desc") + .html(`${__("Last transacted")} ${__(elapsed_time)}`); res.forEach((invoice) => { const posting_datetime = moment(invoice.posting_date + " " + invoice.posting_time).format( From ecc756bd52dbe252ef98ead1edce7d532ea36d71 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:51:39 +0530 Subject: [PATCH 09/22] fix: incorrect stock UOM for BOM raw materials (backport #44528) (#44530) fix: incorrect stock UOM for BOM raw materials (#44528) fix: incorrect stock uom for BOM raw materials (cherry picked from commit 5413cf9f1fae48c4af47f5790ef7b5e8d81ebaf7) Co-authored-by: rohitwaghchaure --- erpnext/manufacturing/doctype/bom/bom.py | 18 +++++++++++++++++ erpnext/manufacturing/doctype/bom/test_bom.py | 20 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index f18ca1f796a..920e2def12c 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -193,6 +193,24 @@ class BOM(WebsiteGenerator): self.update_cost(update_parent=False, from_child_bom=True, update_hour_rate=False, save=False) self.set_process_loss_qty() self.validate_scrap_items() + self.set_default_uom() + + def set_default_uom(self): + if not self.get("items"): + return + + item_wise_uom = frappe._dict( + frappe.get_all( + "Item", + filters={"name": ("in", [item.item_code for item in self.items])}, + fields=["name", "stock_uom"], + as_list=1, + ) + ) + + for row in self.get("items"): + if row.stock_uom != item_wise_uom.get(row.item_code): + row.stock_uom = item_wise_uom.get(row.item_code) def get_context(self, context): context.parents = [{"name": "boms", "title": _("All BOMs")}] diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index d02b51ca6e7..396a0b107d5 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -755,6 +755,26 @@ class TestBOM(FrappeTestCase): self.assertTrue("_Test RM Item 2 Fixed Asset Item" not in items) self.assertTrue("_Test RM Item 3 Manufacture Item" in items) + def test_bom_raw_materials_stock_uom(self): + rm_item = make_item( + properties={"is_stock_item": 1, "valuation_rate": 1000.0, "stock_uom": "Nos"} + ).name + fg_item = make_item(properties={"is_stock_item": 1}).name + + from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom + + bom = make_bom(item=fg_item, raw_materials=[rm_item], do_not_submit=True) + for row in bom.items: + self.assertEqual(row.stock_uom, "Nos") + + frappe.db.set_value("Item", rm_item, "stock_uom", "Kg") + + bom.items[0].qty = 2 + bom.save() + + for row in bom.items: + self.assertEqual(row.stock_uom, "Kg") + def get_default_bom(item_code="_Test FG Item 2"): return frappe.db.get_value("BOM", {"item": item_code, "is_active": 1, "is_default": 1}) From aed90f73d7cd4bac4779c5dd038c62286ce69e85 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:37:43 +0100 Subject: [PATCH 10/22] fix: add title for translation in asset.js (cherry picked from commit 61439132a4386c1867a08d141e0702e03484cf02) --- erpnext/assets/doctype/asset/asset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js index a124efc7ac3..2179961b537 100644 --- a/erpnext/assets/doctype/asset/asset.js +++ b/erpnext/assets/doctype/asset/asset.js @@ -318,7 +318,7 @@ frappe.ui.form.on("Asset", { } frm.dashboard.render_graph({ - title: "Asset Value", + title: __("Asset Value"), data: { labels: x_intervals, datasets: [ From e2aedc85b417917c8ca26e69bba923d0419fe72c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:01:49 +0530 Subject: [PATCH 11/22] fix: variant qty while making work order from BOM (backport #44548) (#44550) fix: variant qty while making work order from BOM (#44548) (cherry picked from commit 1571dff3ef4c89c91e155967c0a187e8f855fe28) Co-authored-by: rohitwaghchaure --- erpnext/manufacturing/doctype/bom/bom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index bf8cb05d8ce..77835281ae6 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -364,7 +364,7 @@ frappe.ui.form.on("BOM", { dialog.fields_dict.items.df.data.push({ item_code: d.item_code, variant_item_code: "", - qty: d.qty, + qty: (d.qty / frm.doc.quantity) * (dialog.fields_dict.qty.value || 1), source_warehouse: d.source_warehouse, operation: d.operation, }); From bad1b2a164ed8545d849219162bcc9502f190e58 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:40:00 +0100 Subject: [PATCH 12/22] fix: add labels for translation in sales_order_analysis.py (cherry picked from commit 8a554a55382cf41855a0e22af89a55c8ec79a5e7) --- .../selling/report/sales_order_analysis/sales_order_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py b/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py index 812c21ed750..ab370b0ed74 100644 --- a/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py +++ b/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py @@ -199,7 +199,7 @@ def prepare_data(data, so_elapsed_time, filters): def prepare_chart_data(pending, completed): - labels = ["Amount to Bill", "Billed Amount"] + labels = [_("Amount to Bill"), _("Billed Amount")] return { "data": {"labels": labels, "datasets": [{"values": [pending, completed]}]}, From 17dad01ab7302bc4f1a659e169dfe966f3b07572 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:20:31 +0100 Subject: [PATCH 13/22] fix: add strings for translation payment_terms_status_for_sales_order.py (cherry picked from commit 7d244051c8dd231abbd3bcd9717d95f7046ab3fc) --- .../payment_terms_status_for_sales_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py b/erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py index cf61a0e35f3..1b57a6d7390 100644 --- a/erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py +++ b/erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py @@ -270,11 +270,11 @@ def prepare_chart(s_orders): "labels": [term.payment_term for term in s_orders], "datasets": [ { - "name": "Payment Amount", + "name": _("Payment Amount"), "values": [x.base_payment_amount for x in s_orders], }, { - "name": "Paid Amount", + "name": _("Paid Amount"), "values": [x.paid_amount for x in s_orders], }, ], From 9986c26a0c6c74514c95a5df39b7e5b7e8db2c53 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:17:35 +0100 Subject: [PATCH 14/22] fix: add labels for translation in quality_inspection_summary.py (cherry picked from commit 6ff4704345fcf299f959f61f05341da76680db69) --- .../quality_inspection_summary/quality_inspection_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py b/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py index 38e05852ee8..7e0fcf14cc6 100644 --- a/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py +++ b/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py @@ -42,7 +42,7 @@ def get_data(filters): def get_chart_data(periodic_data, columns): - labels = ["Rejected", "Accepted"] + labels = [_("Rejected"), _("Accepted")] status_wise_data = {"Accepted": 0, "Rejected": 0} @@ -53,7 +53,7 @@ def get_chart_data(periodic_data, columns): datasets.append( { - "name": "Qty Wise Chart", + "name": _("Qty Wise Chart"), "values": [status_wise_data.get("Rejected"), status_wise_data.get("Accepted")], } ) From 1a7f195d8f641982e9672f7185fd781e5012410e Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:02:05 +0100 Subject: [PATCH 15/22] fix: add labels for translation in production_analytics.py (cherry picked from commit 9b09116576f7645b9bdfc4e8be3c1c90c7516935) --- .../production_analytics/production_analytics.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/manufacturing/report/production_analytics/production_analytics.py b/erpnext/manufacturing/report/production_analytics/production_analytics.py index c02c1e6fcd3..dc2b9ad62f3 100644 --- a/erpnext/manufacturing/report/production_analytics/production_analytics.py +++ b/erpnext/manufacturing/report/production_analytics/production_analytics.py @@ -131,11 +131,11 @@ def get_chart_data(periodic_data, columns): pending.append(periodic_data.get("Pending").get(d)) completed.append(periodic_data.get("Completed").get(d)) - datasets.append({"name": "All Work Orders", "values": all_data}) - datasets.append({"name": "Not Started", "values": not_start}) - datasets.append({"name": "Overdue", "values": overdue}) - datasets.append({"name": "Pending", "values": pending}) - datasets.append({"name": "Completed", "values": completed}) + datasets.append({"name": _("All Work Orders"), "values": all_data}) + datasets.append({"name": _("Not Started"), "values": not_start}) + datasets.append({"name": _("Overdue"), "values": overdue}) + datasets.append({"name": _("Pending"), "values": pending}) + datasets.append({"name": _("Completed"), "values": completed}) chart = {"data": {"labels": labels, "datasets": datasets}} chart["type"] = "line" From ce04f6d7c9b569cc3ccab0609a7daf344932390c Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:13:07 +0100 Subject: [PATCH 16/22] fix: add string for translation in delayed_tasks_summary.py (cherry picked from commit 84b54f549abc28b5b776c2833977044aa876fd34) --- .../report/delayed_tasks_summary/delayed_tasks_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py b/erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py index 17e3155e286..a3f7b433630 100644 --- a/erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py +++ b/erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py @@ -73,8 +73,8 @@ def get_chart_data(data): on_track = on_track + 1 charts = { "data": { - "labels": ["On Track", "Delayed"], - "datasets": [{"name": "Delayed", "values": [on_track, delay]}], + "labels": [_("On Track"), _("Delayed")], + "datasets": [{"name": _("Delayed"), "values": [on_track, delay]}], }, "type": "percentage", "colors": ["#84D5BA", "#CB4B5F"], From f9974f9eb068cb389fb582da9ae7bd80c20f8dfe Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:41:02 +0100 Subject: [PATCH 17/22] fix: add labels for translation in purchase_order_analysis.py (cherry picked from commit 342a398bec707688749c79b515462b5ea4bde734) --- .../report/purchase_order_analysis/purchase_order_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py index 1a250acd4d2..6d2034d1878 100644 --- a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py +++ b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py @@ -180,7 +180,7 @@ def prepare_data(data, filters): def prepare_chart_data(pending, completed): - labels = ["Amount to Bill", "Billed Amount"] + labels = [_("Amount to Bill"), _("Billed Amount")] return { "data": {"labels": labels, "datasets": [{"values": [pending, completed]}]}, From ebc8bede7fcdd77b763ad55a9920cd35cea5d9ac Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:57:52 +0100 Subject: [PATCH 18/22] fix(Bank Transaction): error in party matching should not block submitting (backport #44416) (#44573) fix(Bank Transaction): error in party matching should not block submitting (#44416) (cherry picked from commit 72256565bb2caf02f8e87b3ee0fbd0ee233c4f40) Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> --- .../bank_transaction/bank_transaction.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py index 49c5a9fe4ee..5ddba2aa728 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py @@ -156,13 +156,17 @@ class BankTransaction(StatusUpdater): if self.party_type and self.party: return - result = AutoMatchParty( - bank_party_account_number=self.bank_party_account_number, - bank_party_iban=self.bank_party_iban, - bank_party_name=self.bank_party_name, - description=self.description, - deposit=self.deposit, - ).match() + result = None + try: + result = AutoMatchParty( + bank_party_account_number=self.bank_party_account_number, + bank_party_iban=self.bank_party_iban, + bank_party_name=self.bank_party_name, + description=self.description, + deposit=self.deposit, + ).match() + except Exception: + frappe.log_error(title=_("Error in party matching for Bank Transaction {0}").format(self.name)) if result: party_type, party = result From 0a4090a7711973f6fa74ae121e34ad74ad1a917b Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:59:16 +0100 Subject: [PATCH 19/22] fix: add docstatus for translation (cherry picked from commit dda272220bcc65768ef0adcdb48d23baba576481) --- erpnext/templates/includes/issue_row.html | 2 +- erpnext/templates/includes/projects/project_row.html | 2 +- erpnext/templates/includes/transaction_row.html | 2 +- erpnext/templates/pages/timelog_info.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/templates/includes/issue_row.html b/erpnext/templates/includes/issue_row.html index a04f558509f..b55712ab189 100644 --- a/erpnext/templates/includes/issue_row.html +++ b/erpnext/templates/includes/issue_row.html @@ -18,7 +18,7 @@ {% if doc.status == "Open" %} {{ doc.priority }} {% else %} - {{ doc.status }} + {{ _(doc.status) }} {%- endif -%} diff --git a/erpnext/templates/includes/projects/project_row.html b/erpnext/templates/includes/projects/project_row.html index 686637a2014..ccb306afcdb 100644 --- a/erpnext/templates/includes/projects/project_row.html +++ b/erpnext/templates/includes/projects/project_row.html @@ -20,7 +20,7 @@ {% else %} - {{ doc.status }} + {{ _(doc.status) }} {% endif %} {% if doc["_assign"] %} diff --git a/erpnext/templates/includes/transaction_row.html b/erpnext/templates/includes/transaction_row.html index 72d498c998f..81d9dcbab67 100644 --- a/erpnext/templates/includes/transaction_row.html +++ b/erpnext/templates/includes/transaction_row.html @@ -8,7 +8,7 @@
- {{doc.status}} + {{ _(doc.status) }}
diff --git a/erpnext/templates/pages/timelog_info.html b/erpnext/templates/pages/timelog_info.html index be13826444c..9f9445661a0 100644 --- a/erpnext/templates/pages/timelog_info.html +++ b/erpnext/templates/pages/timelog_info.html @@ -38,7 +38,7 @@ - + From 966479027236f2dcf48a114cbe52b6b8ca898612 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 9 Dec 2024 12:08:54 +0530 Subject: [PATCH 20/22] chore: fix linter --- erpnext/accounts/doctype/bank_transaction/bank_transaction.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py index 5ddba2aa728..89565e9908b 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py @@ -2,6 +2,7 @@ # For license information, please see license.txt import frappe +from frappe import _ from frappe.model.docstatus import DocStatus from frappe.utils import flt From 3c8b637a8b4077757dbdfeb1b255a546a11d93f7 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 9 Dec 2024 13:00:56 +0530 Subject: [PATCH 21/22] fix: prevent set_payment_schedule on return documents --- erpnext/stock/doctype/delivery_note/delivery_note.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index b725eff05b7..039ce1c03a0 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -713,7 +713,7 @@ def make_sales_invoice(source_name, target_doc=None, args=None): automatically_fetch_payment_terms = cint( frappe.db.get_single_value("Accounts Settings", "automatically_fetch_payment_terms") ) - if automatically_fetch_payment_terms: + if automatically_fetch_payment_terms and not doc.is_return: doc.set_payment_schedule() return doc From a460bf9433f3f567be6c4474551562193efa75c9 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:12:09 +0530 Subject: [PATCH 22/22] fix: description overwrite on qty change (backport #44606) (#44608) * fix: description overwrite on qty change (#44606) (cherry picked from commit 9ad79625e02772a6c72b5eacfd7ebf5f38706675) # Conflicts: # erpnext/stock/doctype/material_request/material_request.js * chore: fix conflicts --------- Co-authored-by: rohitwaghchaure --- .../doctype/material_request/material_request.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 20bfbef8f49..c32bd53af5e 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -226,11 +226,16 @@ frappe.ui.form.on('Material Request', { }, callback: function(r) { const d = item; - const allow_to_change_fields = ['actual_qty', 'projected_qty', 'min_order_qty', 'item_name', 'description', 'stock_uom', 'uom', 'conversion_factor', 'stock_qty']; - if(!r.exc) { - $.each(r.message, function(key, value) { - if(!d[key] || allow_to_change_fields.includes(key)) { + let allow_to_change_fields = ['actual_qty', 'projected_qty', 'min_order_qty', 'item_name', 'description', 'stock_uom', 'uom', 'conversion_factor', 'stock_qty']; + + if (overwrite_warehouse) { + allow_to_change_fields.push("description"); + } + + if (!r.exc) { + $.each(r.message, function (key, value) { + if (!d[key] || allow_to_change_fields.includes(key)) { d[key] = value; } });