From a6cb6c6f4784194af96d15ece3499415be05d53e Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Wed, 3 May 2023 09:51:58 +0530 Subject: [PATCH 01/15] fix: recalculate costs in SCR while reposting --- erpnext/stock/stock_ledger.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 8b517bf1e0..aa272cbfa7 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -781,13 +781,19 @@ class update_entries_after(object): d.db_update() def update_rate_on_subcontracting_receipt(self, sle, outgoing_rate): - if frappe.db.exists(sle.voucher_type + " Item", sle.voucher_detail_no): - frappe.db.set_value(sle.voucher_type + " Item", sle.voucher_detail_no, "rate", outgoing_rate) + if frappe.db.exists("Subcontracting Receipt Item", sle.voucher_detail_no): + frappe.db.set_value("Subcontracting Receipt Item", sle.voucher_detail_no, "rate", outgoing_rate) else: frappe.db.set_value( "Subcontracting Receipt Supplied Item", sle.voucher_detail_no, "rate", outgoing_rate ) + scr = frappe.get_doc("Subcontracting Receipt", sle.voucher_no, for_update=True) + scr.set_missing_values() + scr.db_update() + for d in scr.items + scr.get("supplied_items", []): + d.db_update() + def get_serialized_values(self, sle): incoming_rate = flt(sle.incoming_rate) actual_qty = flt(sle.actual_qty) From e0b22edb2e4fba3224b3dfd26243bcf483a3d71c Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Thu, 4 May 2023 15:07:52 +0530 Subject: [PATCH 02/15] test: add test case --- .../test_subcontracting_receipt.py | 68 ++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py index 72ed4d4e2e..dfb72c3356 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py @@ -6,7 +6,7 @@ import copy import frappe from frappe.tests.utils import FrappeTestCase -from frappe.utils import cint, flt +from frappe.utils import add_days, cint, cstr, flt, today import erpnext from erpnext.accounts.doctype.account.test_account import get_inventory_account @@ -26,6 +26,9 @@ from erpnext.controllers.tests.test_subcontracting_controller import ( from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ( + create_stock_reconciliation, +) from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import ( make_subcontracting_receipt, ) @@ -528,6 +531,69 @@ class TestSubcontractingReceipt(FrappeTestCase): # consumed_qty should be (accepted_qty * qty_consumed_per_unit) = (6 * 1) = 6 self.assertEqual(scr.supplied_items[0].consumed_qty, 6) + def test_supplied_items_cost_after_reposting(self): + # Set Backflush Based On as "BOM" + set_backflush_based_on("BOM") + + # Create Material Receipt for RM's + make_stock_entry( + item_code="_Test Item", + qty=100, + target="_Test Warehouse 1 - _TC", + basic_rate=100, + posting_date=add_days(today(), -2), + ) + make_stock_entry( + item_code="_Test Item Home Desktop 100", + qty=100, + target="_Test Warehouse 1 - _TC", + basic_rate=100, + ) + + service_items = [ + { + "warehouse": "_Test Warehouse - _TC", + "item_code": "Subcontracted Service Item 1", + "qty": 10, + "rate": 100, + "fg_item": "_Test FG Item", + "fg_item_qty": 10, + }, + ] + + # Create Subcontracting Order + sco = get_subcontracting_order(service_items=service_items) + + # Transfer RM's + rm_items = get_rm_items(sco.supplied_items) + + itemwise_details = make_stock_in_entry(rm_items=rm_items) + make_stock_transfer_entry( + sco_no=sco.name, + rm_items=rm_items, + itemwise_details=copy.deepcopy(itemwise_details), + ) + + # Create Subcontracting Receipt + scr = make_subcontracting_receipt(sco.name) + scr.save() + scr.submit() + + # Create Backdated Stock Reconciliation + sr = create_stock_reconciliation( + item_code=rm_items[0].get("item_code"), + warehouse="_Test Warehouse 1 - _TC", + qty=100, + rate=50, + posting_date=add_days(today(), -1), + ) + + # Cost should be updated in Subcontracting Receipt after reposting + prev_cost = scr.supplied_items[0].rate + scr.load_from_db() + self.assertNotEqual(scr.supplied_items[0].rate, prev_cost) + self.assertEqual(scr.supplied_items[0].rate, sr.items[0].valuation_rate) + def make_return_subcontracting_receipt(**args): args = frappe._dict(args) From d6433f803b497511873acb7ff3889853e4b06e0e Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Fri, 12 May 2023 11:45:33 +0530 Subject: [PATCH 03/15] refactor(minor): rename function to be more descriptive --- erpnext/controllers/subcontracting_controller.py | 2 +- .../tests/test_subcontracting_controller.py | 2 +- .../subcontracting_order/subcontracting_order.py | 14 +++++++------- .../subcontracting_receipt.py | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py index 05754293b7..c3fa894e89 100644 --- a/erpnext/controllers/subcontracting_controller.py +++ b/erpnext/controllers/subcontracting_controller.py @@ -741,7 +741,7 @@ class SubcontractingController(StockController): sco_doc = frappe.get_doc("Subcontracting Order", sco) sco_doc.update_status() - def set_missing_values_in_additional_costs(self): + def calculate_additional_costs(self): self.total_additional_costs = sum(flt(item.amount) for item in self.get("additional_costs")) if self.total_additional_costs: diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py index 0e6fe95d45..4ea4fd11b4 100644 --- a/erpnext/controllers/tests/test_subcontracting_controller.py +++ b/erpnext/controllers/tests/test_subcontracting_controller.py @@ -36,7 +36,7 @@ class TestSubcontractingController(FrappeTestCase): sco.remove_empty_rows() self.assertEqual((len_before - 1), len(sco.service_items)) - def test_set_missing_values_in_additional_costs(self): + def test_calculate_additional_costs(self): sco = get_subcontracting_order(do_not_submit=1) rate_without_additional_cost = sco.items[0].rate diff --git a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py index e6de72d494..39197332c1 100644 --- a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py +++ b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py @@ -77,22 +77,22 @@ class SubcontractingOrder(SubcontractingController): frappe.throw(_(msg)) def set_missing_values(self): - self.set_missing_values_in_additional_costs() - self.set_missing_values_in_service_items() - self.set_missing_values_in_supplied_items() - self.set_missing_values_in_items() + self.calculate_additional_costs() + self.calculate_service_costs() + self.calculate_supplied_items_qty_and_amount() + self.calculate_items_qty_and_amount() - def set_missing_values_in_service_items(self): + def calculate_service_costs(self): for idx, item in enumerate(self.get("service_items")): self.items[idx].service_cost_per_qty = item.amount / self.items[idx].qty - def set_missing_values_in_supplied_items(self): + def calculate_supplied_items_qty_and_amount(self): for item in self.get("items"): bom = frappe.get_doc("BOM", item.bom) rm_cost = sum(flt(rm_item.amount) for rm_item in bom.items) item.rm_cost_per_qty = rm_cost / flt(bom.quantity) - def set_missing_values_in_items(self): + def calculate_items_qty_and_amount(self): total_qty = total = 0 for item in self.items: item.rate = item.rm_cost_per_qty + item.service_cost_per_qty + flt(item.additional_cost_per_qty) diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py index 4f8e045d70..2c84262273 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py @@ -113,9 +113,9 @@ class SubcontractingReceipt(SubcontractingController): @frappe.whitelist() def set_missing_values(self): - self.set_missing_values_in_additional_costs() - self.set_missing_values_in_supplied_items() - self.set_missing_values_in_items() + self.calculate_additional_costs() + self.calculate_supplied_items_qty_and_amount() + self.calculate_items_qty_and_amount() def set_available_qty_for_consumption(self): supplied_items_details = {} @@ -147,13 +147,13 @@ class SubcontractingReceipt(SubcontractingController): item.rm_item_code, 0 ) - def set_missing_values_in_supplied_items(self): + def calculate_supplied_items_qty_and_amount(self): for item in self.get("supplied_items") or []: item.amount = item.rate * item.consumed_qty self.set_available_qty_for_consumption() - def set_missing_values_in_items(self): + def calculate_items_qty_and_amount(self): rm_supp_cost = {} for item in self.get("supplied_items") or []: if item.reference_name in rm_supp_cost: From 9c72c2a6cb11197b292b0f589f312e038ac5cc3a Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Fri, 12 May 2023 11:46:32 +0530 Subject: [PATCH 04/15] refactor: use `calculate_items_qty_and_amount()` to update scr items rate --- erpnext/stock/stock_ledger.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index aa272cbfa7..c7f0acd453 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -785,13 +785,15 @@ class update_entries_after(object): frappe.db.set_value("Subcontracting Receipt Item", sle.voucher_detail_no, "rate", outgoing_rate) else: frappe.db.set_value( - "Subcontracting Receipt Supplied Item", sle.voucher_detail_no, "rate", outgoing_rate + "Subcontracting Receipt Supplied Item", + sle.voucher_detail_no, + {"rate": outgoing_rate, "amount": abs(sle.actual_qty) * outgoing_rate}, ) scr = frappe.get_doc("Subcontracting Receipt", sle.voucher_no, for_update=True) - scr.set_missing_values() + scr.calculate_items_qty_and_amount() scr.db_update() - for d in scr.items + scr.get("supplied_items", []): + for d in scr.items: d.db_update() def get_serialized_values(self, sle): From 2a609616d9da0eaf078ef3f6763aa4b643eafc97 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Mon, 15 May 2023 13:24:39 +0530 Subject: [PATCH 05/15] fix: port option for additional_conditions in item wise sales register (#35187) Co-authored-by: Deepesh Garg --- .../item_wise_sales_register.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index c987231fe1..dd9c073612 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -19,14 +19,19 @@ def execute(filters=None): return _execute(filters) -def _execute(filters=None, additional_table_columns=None, additional_query_columns=None): +def _execute( + filters=None, + additional_table_columns=None, + additional_query_columns=None, + additional_conditions=None, +): if not filters: filters = {} columns = get_columns(additional_table_columns, filters) company_currency = frappe.get_cached_value("Company", filters.get("company"), "default_currency") - item_list = get_items(filters, additional_query_columns) + item_list = get_items(filters, additional_query_columns, additional_conditions) if item_list: itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency) @@ -328,7 +333,7 @@ def get_columns(additional_table_columns, filters): return columns -def get_conditions(filters): +def get_conditions(filters, additional_conditions=None): conditions = "" for opts in ( @@ -341,6 +346,9 @@ def get_conditions(filters): if filters.get(opts[0]): conditions += opts[1] + if additional_conditions: + conditions += additional_conditions + if filters.get("mode_of_payment"): conditions += """ and exists(select name from `tabSales Invoice Payment` where parent=`tabSales Invoice`.name @@ -376,8 +384,8 @@ def get_group_by_conditions(filters, doctype): return "ORDER BY `tab{0}`.{1}".format(doctype, frappe.scrub(filters.get("group_by"))) -def get_items(filters, additional_query_columns): - conditions = get_conditions(filters) +def get_items(filters, additional_query_columns, additional_conditions=None): + conditions = get_conditions(filters, additional_conditions) if additional_query_columns: additional_query_columns = ", " + ", ".join(additional_query_columns) From c236979508c00f4104fa2f45bcc925634f5905fd Mon Sep 17 00:00:00 2001 From: Wolfram Schmidt Date: Mon, 15 May 2023 09:55:23 +0200 Subject: [PATCH 06/15] fix: Update de.csv (#35278) added many fixes on the base of 'No' which is often wrongly translated to 'Kein'. Also removed translation of Naming Seris like ACC-INV-.YYYY.- to ACC-INV-.YYYY.- --- erpnext/translations/de.csv | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv index 57556f3ef1..b4fd76d46c 100644 --- a/erpnext/translations/de.csv +++ b/erpnext/translations/de.csv @@ -7638,20 +7638,19 @@ Restaurant Order Entry Item,Restaurantbestellzugangsposten, Served,Serviert, Restaurant Reservation,Restaurant Reservierung, Waitlisted,Auf der Warteliste, -No Show,Keine Show, -No of People,Nein von Menschen, +No Show,Nicht angetreten, +No of People,Anzahl von Personen, Reservation Time,Reservierungszeit, Reservation End Time,Reservierungsendzeit, No of Seats,Anzahl der Sitze, Minimum Seating,Mindestbestuhlung, "Keep Track of Sales Campaigns. Keep track of Leads, Quotations, Sales Order etc from Campaigns to gauge Return on Investment. ","Verkaufskampagne verfolgen: Leads, Angebote, Aufträge usw. von Kampagnen beobachten um die Kapitalverzinsung (RoI) zu messen.", -SAL-CAM-.YYYY.-,SAL-CAM-.YYYY.-, Campaign Schedules,Kampagnenpläne, Buyer of Goods and Services.,Käufer von Waren und Dienstleistungen., -CUST-.YYYY.-,CUST-.YYYY.-, Default Company Bank Account,Standard-Bankkonto des Unternehmens, From Lead,Aus Lead, -Account Manager,Buchhalter, +Account Manager,Kundenberater, +Accounts Manager,Buchhalter, Allow Sales Invoice Creation Without Sales Order,Ermöglichen Sie die Erstellung von Kundenrechnungen ohne Auftrag, Allow Sales Invoice Creation Without Delivery Note,Ermöglichen Sie die Erstellung einer Ausgangsrechnung ohne Lieferschein, Default Price List,Standardpreisliste, @@ -7692,7 +7691,6 @@ Quantity of Items,Anzahl der Artikel, "Aggregate group of **Items** into another **Item**. This is useful if you are bundling a certain **Items** into a package and you maintain stock of the packed **Items** and not the aggregate **Item**. \n\nThe package **Item** will have ""Is Stock Item"" as ""No"" and ""Is Sales Item"" as ""Yes"".\n\nFor Example: If you are selling Laptops and Backpacks separately and have a special price if the customer buys both, then the Laptop + Backpack will be a new Product Bundle Item.\n\nNote: BOM = Bill of Materials","Fassen Sie eine Gruppe von Artikeln zu einem neuen Artikel zusammen. Dies ist nützlich, wenn Sie bestimmte Artikel zu einem Paket bündeln und einen Bestand an Artikel-Bündeln erhalten und nicht einen Bestand der einzelnen Artikel. Das Artikel-Bündel erhält für das Attribut ""Ist Lagerartikel"" den Wert ""Nein"" und für das Attribut ""Ist Verkaufsartikel"" den Wert ""Ja"". Beispiel: Wenn Sie Laptops und Tragetaschen getrennt verkaufen und einen bestimmten Preis anbieten, wenn der Kunde beides zusammen kauft, dann wird der Laptop mit der Tasche zusammen ein neuer Bündel-Artikel. Anmerkung: BOM = Stückliste", Parent Item,Übergeordneter Artikel, List items that form the package.,"Die Artikel auflisten, die das Paket bilden.", -SAL-QTN-.YYYY.-,SAL-QTN-.YYYY.-, Quotation To,Angebot für, Rate at which customer's currency is converted to company's base currency,"Kurs, zu dem die Währung des Kunden in die Basiswährung des Unternehmens umgerechnet wird", Rate at which Price list currency is converted to company's base currency,"Kurs, zu dem die Währung der Preisliste in die Basiswährung des Unternehmens umgerechnet wird", @@ -7704,7 +7702,6 @@ Quotation Item,Angebotsposition, Against Doctype,Zu DocType, Against Docname,Zu Dokumentenname, Additional Notes,Zusätzliche Bemerkungen, -SAL-ORD-.YYYY.-,SAL-ORD-.YYYY.-, Skip Delivery Note,Lieferschein überspringen, In Words will be visible once you save the Sales Order.,"""In Worten"" wird sichtbar, sobald Sie den Auftrag speichern.", Track this Sales Order against any Project,Diesen Auftrag in jedem Projekt nachverfolgen, @@ -7935,7 +7932,7 @@ For reference,Zu Referenzzwecken, Territory Targets,Ziele für die Region, Set Item Group-wise budgets on this Territory. You can also include seasonality by setting the Distribution.,Artikelgruppenbezogene Budgets für diese Region erstellen. Durch Setzen der Auslieferungseinstellungen können auch saisonale Aspekte mit einbezogen werden., UOM Name,Maßeinheit-Name, -Check this to disallow fractions. (for Nos),"Hier aktivieren, um keine Bruchteile zuzulassen (für Nr.)", +Check this to disallow fractions. (for Nos),"Hier aktivieren, um keine Bruchteile zuzulassen (für Anzahl)", Website Item Group,Webseiten-Artikelgruppe, Cross Listing of Item in multiple groups,Kreuzweise Auflistung des Artikels in mehreren Gruppen, Default settings for Shopping Cart,Standardeinstellungen für den Warenkorb, @@ -8016,7 +8013,6 @@ Contact Information,Kontaktinformationen, Email sent to,E-Mail versandt an, Dispatch Information,Versandinformationen, Estimated Arrival,Voraussichtliche Ankunft, -MAT-DT-.YYYY.-,MAT-DT-.YYYY.-, Initial Email Notification Sent,Erste E-Mail-Benachrichtigung gesendet, Delivery Details,Lieferdetails, Driver Email,Fahrer-E-Mail, @@ -8176,7 +8172,6 @@ Purchase Receipt Item,Kaufbeleg-Artikel, Landed Cost Purchase Receipt,Einstandspreis-Kaufbeleg, Landed Cost Taxes and Charges,Einstandspreis Steuern und Gebühren, Landed Cost Voucher,Beleg über Einstandskosten, -MAT-LCV-.YYYY.-,MAT-LCV-.YYYY.-, Purchase Receipts,Kaufbelege, Purchase Receipt Items,Kaufbeleg-Artikel, Get Items From Purchase Receipts,Artikel vom Kaufbeleg übernehmen, @@ -8184,7 +8179,6 @@ Distribute Charges Based On,Kosten auf folgender Grundlage verteilen, Landed Cost Help,Hilfe zum Einstandpreis, Manufacturers used in Items,Hersteller im Artikel verwendet, Limited to 12 characters,Limitiert auf 12 Zeichen, -MAT-MR-.YYYY.-,MAT-MR-.YYYY.-, Partially Ordered,Teilweise bestellt, Transferred,Übergeben, % Ordered,% bestellt, @@ -8199,7 +8193,6 @@ Prevdoc DocType,Prevdoc DocType, Parent Detail docname,Übergeordnetes Detail Dokumentenname, "Generate packing slips for packages to be delivered. Used to notify package number, package contents and its weight.","Packzettel für zu liefernde Pakete generieren. Wird verwendet, um Paketnummer, Packungsinhalt und das Gewicht zu dokumentieren.", Indicates that the package is a part of this delivery (Only Draft),"Zeigt an, dass das Paket ein Teil dieser Lieferung ist (nur Entwurf)", -MAT-PAC-.YYYY.-,MAT-PAC-.YYYY.-, From Package No.,Von Paket Nr., Identification of the package for the delivery (for print),Kennzeichnung des Paketes für die Lieferung (für den Druck), To Package No.,Bis Paket Nr., @@ -8290,7 +8283,6 @@ Under AMC,Innerhalb des jährlichen Wartungsvertrags, Out of AMC,Außerhalb des jährlichen Wartungsvertrags, Warranty Period (Days),Garantiefrist (Tage), Serial No Details,Details zur Seriennummer, -MAT-STE-.YYYY.-,MAT-STE-.JJJJ.-, Stock Entry Type,Bestandsbuchungsart, Stock Entry (Outward GIT),Bestandsbuchung (Outward GIT), Material Consumption for Manufacture,Materialverbrauch für die Herstellung, @@ -8336,7 +8328,6 @@ Stock Queue (FIFO),Lagerverfahren (FIFO), Is Cancelled,Ist storniert, Stock Reconciliation,Bestandsabgleich, This tool helps you to update or fix the quantity and valuation of stock in the system. It is typically used to synchronise the system values and what actually exists in your warehouses.,"Dieses Werkzeug hilft Ihnen dabei, die Menge und die Bewertung von Bestand im System zu aktualisieren oder zu ändern. Es wird in der Regel verwendet, um die Systemwerte und den aktuellen Bestand Ihrer Lager zu synchronisieren.", -MAT-RECO-.YYYY.-,MAT-RECO-.YYYY.-, Reconciliation JSON,Abgleich JSON (JavaScript Object Notation), Stock Reconciliation Item,Bestandsabgleich-Artikel, Before reconciliation,Vor Ausgleich, @@ -8796,8 +8787,7 @@ Availed ITC State/UT Tax,Verfügbare ITC State / UT Tax, Availed ITC Cess,ITC Cess verfügbar, Is Nil Rated or Exempted,Ist gleich Null oder ausgenommen, Is Non GST,Ist nicht GST, -ACC-SINV-RET-.YYYY.-,ACC-SINV-RET-.YYYY.-, -E-Way Bill No.,E-Way Bill No., +E-Way Bill No.,E-Way Bill Nr., Is Consolidated,Ist konsolidiert, Billing Address GSTIN,Rechnungsadresse GSTIN, Customer GSTIN,Kunde GSTIN, @@ -9216,7 +9206,7 @@ Id,Ich würde, Time Required (In Mins),Erforderliche Zeit (in Minuten), From Posting Date,Ab dem Buchungsdatum, To Posting Date,Zum Buchungsdatum, -No records found,Keine Aufzeichnungen gefunden, +No records found,Keine Einträge gefunden, Customer/Lead Name,Name des Kunden / Lead, Unmarked Days,Nicht markierte Tage, Jan,Jan., @@ -9275,7 +9265,7 @@ Delay (in Days),Verzögerung (in Tagen), Group by Sales Order,Nach Auftrag gruppieren, Sales Value,Verkaufswert, Stock Qty vs Serial No Count,Lagermenge vs Seriennummer, -Serial No Count,Seriennummer nicht gezählt, +Serial No Count,Seriennummern gezählt, Work Order Summary,Arbeitsauftragsübersicht, Produce Qty,Menge produzieren, Lead Time (in mins),Vorlaufzeit (in Minuten), @@ -9569,7 +9559,7 @@ Row #{}: Selling rate for item {} is lower than its {}. Selling {} should be atl You can alternatively disable selling price validation in {} to bypass this validation.,"Alternativ können Sie die Validierung des Verkaufspreises in {} deaktivieren, um diese Validierung zu umgehen.", Invalid Selling Price,Ungültiger Verkaufspreis, Address needs to be linked to a Company. Please add a row for Company in the Links table.,Die Adresse muss mit einem Unternehmen verknüpft sein. Bitte fügen Sie eine Zeile für Firma in die Tabelle Links ein., -Company Not Linked,Firma nicht verbunden, +Company Not Linked,Firma nicht verknüpft, Import Chart of Accounts from CSV / Excel files,Kontenplan aus CSV / Excel-Dateien importieren, Completed Qty cannot be greater than 'Qty to Manufacture',Die abgeschlossene Menge darf nicht größer sein als die Menge bis zur Herstellung., "Row {0}: For Supplier {1}, Email Address is Required to send an email","Zeile {0}: Für Lieferant {1} ist eine E-Mail-Adresse erforderlich, um eine E-Mail zu senden", @@ -9656,7 +9646,7 @@ Hide Customer's Tax ID from Sales Transactions,Steuer-ID des Kunden vor Verkaufs Action If Quality Inspection Is Not Submitted,Maßnahme Wenn keine Qualitätsprüfung eingereicht wird, Auto Insert Price List Rate If Missing,"Preisliste automatisch einfügen, falls fehlt", Automatically Set Serial Nos Based on FIFO,Seriennummern basierend auf FIFO automatisch einstellen, -Set Qty in Transactions Based on Serial No Input,Stellen Sie die Menge in Transaktionen basierend auf Seriennummer ohne Eingabe ein, +Set Qty in Transactions Based on Serial No Input,Setze die Anzahl in der Transaktion basierend auf den Seriennummern, Raise Material Request When Stock Reaches Re-order Level,"Erhöhen Sie die Materialanforderung, wenn der Lagerbestand die Nachbestellmenge erreicht", Notify by Email on Creation of Automatic Material Request,Benachrichtigen Sie per E-Mail über die Erstellung einer automatischen Materialanforderung, Allow Material Transfer from Delivery Note to Sales Invoice,Materialübertragung vom Lieferschein zur Ausgangsrechnung zulassen, @@ -9765,7 +9755,7 @@ Open Form View,Öffnen Sie die Formularansicht, POS invoice {0} created succesfully,POS-Rechnung {0} erfolgreich erstellt, Stock quantity not enough for Item Code: {0} under warehouse {1}. Available quantity {2}.,Lagermenge nicht ausreichend für Artikelcode: {0} unter Lager {1}. Verfügbare Menge {2}., Serial No: {0} has already been transacted into another POS Invoice.,Seriennummer: {0} wurde bereits in eine andere POS-Rechnung übertragen., -Balance Serial No,Balance Seriennr, +Balance Serial No,Stand Seriennummern, Warehouse: {0} does not belong to {1},Lager: {0} gehört nicht zu {1}, Please select batches for batched item {0},Bitte wählen Sie Chargen für Chargenartikel {0} aus, Please select quantity on row {0},Bitte wählen Sie die Menge in Zeile {0}, From 0489e302442a6e8a643dbabda922d8c2258dd53e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 16 May 2023 00:48:52 +0530 Subject: [PATCH 07/15] fix: item list view not working --- erpnext/stock/doctype/item/item_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item/item_list.js b/erpnext/stock/doctype/item/item_list.js index 534b341920..22d38e8893 100644 --- a/erpnext/stock/doctype/item/item_list.js +++ b/erpnext/stock/doctype/item/item_list.js @@ -1,5 +1,5 @@ frappe.listview_settings['Item'] = { - add_fields: ["item_name", "stock_uom", "item_group", "image", "variant_of", + add_fields: ["item_name", "stock_uom", "item_group", "image", "has_variants", "end_of_life", "disabled"], filters: [["disabled", "=", "0"]], From 9feda1b82977c69ef75d2f64fe4a3df46655abe9 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 16 May 2023 13:11:47 +0530 Subject: [PATCH 08/15] perf: cache and simplify queries for holiday list (#35315) --- erpnext/setup/doctype/employee/employee.py | 4 +++- erpnext/setup/doctype/holiday_list/holiday_list.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/employee/employee.py b/erpnext/setup/doctype/employee/employee.py index ece5a7d554..566392c327 100755 --- a/erpnext/setup/doctype/employee/employee.py +++ b/erpnext/setup/doctype/employee/employee.py @@ -257,7 +257,9 @@ def get_employee_email(employee_doc): def get_holiday_list_for_employee(employee, raise_exception=True): if employee: - holiday_list, company = frappe.db.get_value("Employee", employee, ["holiday_list", "company"]) + holiday_list, company = frappe.get_cached_value( + "Employee", employee, ["holiday_list", "company"] + ) else: holiday_list = "" company = frappe.db.get_single_value("Global Defaults", "default_company") diff --git a/erpnext/setup/doctype/holiday_list/holiday_list.py b/erpnext/setup/doctype/holiday_list/holiday_list.py index fad827ad8a..84d0d35287 100644 --- a/erpnext/setup/doctype/holiday_list/holiday_list.py +++ b/erpnext/setup/doctype/holiday_list/holiday_list.py @@ -115,6 +115,8 @@ def is_holiday(holiday_list, date=None): if date is None: date = today() if holiday_list: - return bool(frappe.get_all("Holiday List", dict(name=holiday_list, holiday_date=date))) + return bool( + frappe.db.exists("Holiday", {"parent": holiday_list, "holiday_date": date}, cache=True) + ) else: return False From 5574d9a72d8e4d372e01035ab44a1254538feb50 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 16 May 2023 13:38:55 +0530 Subject: [PATCH 09/15] fix(UX): misc "home" onboarding improvements (#35319) * fix(UX): cleanup "Home" onboarding - Remove company, letterhead, data import etc from home onboarding step * fix(UX): Show quick entry for item * chore: fix copy here and there --- .../setup/module_onboarding/home/home.json | 19 +++++-------------- .../company_set_up/company_set_up.json | 4 ++-- .../create_a_customer/create_a_customer.json | 6 +++--- .../create_a_quotation.json | 4 ++-- .../create_a_supplier/create_a_supplier.json | 6 +++--- .../create_an_item/create_an_item.json | 8 ++++---- .../data_import/data_import.json | 4 ++-- .../letterhead/letterhead.json | 4 ++-- .../navigation_help/navigation_help.json | 6 +++--- 9 files changed, 26 insertions(+), 35 deletions(-) diff --git a/erpnext/setup/module_onboarding/home/home.json b/erpnext/setup/module_onboarding/home/home.json index f02fc454c0..516f12229c 100644 --- a/erpnext/setup/module_onboarding/home/home.json +++ b/erpnext/setup/module_onboarding/home/home.json @@ -22,24 +22,18 @@ "creation": "2021-11-22 12:19:15.888642", "docstatus": 0, "doctype": "Module Onboarding", - "documentation_url": "https://docs.erpnext.com/docs/v13/user/manual/en/setting-up/company-setup", + "documentation_url": "https://docs.erpnext.com/docs/v14/user/manual/en/setting-up/company-setup", "idx": 0, "is_complete": 0, - "modified": "2022-06-07 14:31:00.575193", + "modified": "2023-05-16 13:13:24.043792", "modified_by": "Administrator", "module": "Setup", "name": "Home", "owner": "Administrator", "steps": [ - { - "step": "Company Set Up" - }, { "step": "Navigation Help" }, - { - "step": "Data import" - }, { "step": "Create an Item" }, @@ -51,12 +45,9 @@ }, { "step": "Create a Quotation" - }, - { - "step": "Letterhead" } ], - "subtitle": "Company, Item, Customer, Supplier, Navigation Help, Data Import, Letter Head, Quotation", - "success_message": "Masters are all set up!", - "title": "Let's Set Up Some Masters" + "subtitle": "Item, Customer, Supplier, Navigation Help and Quotation", + "success_message": "You're ready to start your journey with ERPNext", + "title": "Let's begin your journey with ERPNext" } \ No newline at end of file diff --git a/erpnext/setup/onboarding_step/company_set_up/company_set_up.json b/erpnext/setup/onboarding_step/company_set_up/company_set_up.json index 6f6583231f..fae2de0112 100644 --- a/erpnext/setup/onboarding_step/company_set_up/company_set_up.json +++ b/erpnext/setup/onboarding_step/company_set_up/company_set_up.json @@ -5,11 +5,11 @@ "description": "# Set Up a Company\n\nA company is a legal entity for which you will set up your books of account and create accounting transactions. In ERPNext, you can create multiple companies, and establish relationships (group/subsidiary) among them.\n\nWithin the company master, you can capture various default accounts for that Company and set crucial settings related to the accounting methodology followed for a company.\n", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:22:18.317423", + "modified": "2023-05-15 09:18:42.895537", "modified_by": "Administrator", "name": "Company Set Up", "owner": "Administrator", diff --git a/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json b/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json index f74d745be9..e1a8f90866 100644 --- a/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json +++ b/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json @@ -5,17 +5,17 @@ "description": "# Create a Customer\n\nThe Customer master is at the heart of your sales transactions. Customers are linked in Quotations, Sales Orders, Invoices, and Payments. Customers can be either numbered or identified by name (you would typically do this based on the number of customers you have).\n\nThrough Customer\u2019s master, you can effectively track essentials like:\n - Customer\u2019s multiple address and contacts\n - Account Receivables\n - Credit Limit and Credit Period\n", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:20:31.197564", + "modified": "2023-05-16 12:54:54.112364", "modified_by": "Administrator", "name": "Create a Customer", "owner": "Administrator", "reference_document": "Customer", "show_form_tour": 0, "show_full_form": 0, - "title": "Manage Customers", + "title": "Create a Customer", "validate_action": 1 } \ No newline at end of file diff --git a/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json b/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json index 8bdb621c0a..92b45b4ff8 100644 --- a/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json +++ b/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json @@ -5,11 +5,11 @@ "description": "# Create a Quotation\n\nLet\u2019s get started with business transactions by creating your first Quotation. You can create a Quotation for an existing customer or a prospect. It will be an approved document, with items you sell and the proposed price + taxes applied. After completing the instructions, you will get a Quotation in a ready to share print format.", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:21:31.675330", + "modified": "2023-05-15 09:18:42.984170", "modified_by": "Administrator", "name": "Create a Quotation", "owner": "Administrator", diff --git a/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json b/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json index 9574141eaa..ef493fe00d 100644 --- a/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json +++ b/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json @@ -5,17 +5,17 @@ "description": "# Create a Supplier\n\nAlso known as Vendor, is a master at the center of your purchase transactions. Suppliers are linked in Request for Quotation, Purchase Orders, Receipts, and Payments. Suppliers can be either numbered or identified by name.\n\nThrough Supplier\u2019s master, you can effectively track essentials like:\n - Supplier\u2019s multiple address and contacts\n - Account Receivables\n - Credit Limit and Credit Period\n", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:21:23.518301", + "modified": "2023-05-16 12:55:08.610113", "modified_by": "Administrator", "name": "Create a Supplier", "owner": "Administrator", "reference_document": "Supplier", "show_form_tour": 0, "show_full_form": 0, - "title": "Manage Suppliers", + "title": "Create a Supplier", "validate_action": 1 } \ No newline at end of file diff --git a/erpnext/setup/onboarding_step/create_an_item/create_an_item.json b/erpnext/setup/onboarding_step/create_an_item/create_an_item.json index cd29683346..15f36bec81 100644 --- a/erpnext/setup/onboarding_step/create_an_item/create_an_item.json +++ b/erpnext/setup/onboarding_step/create_an_item/create_an_item.json @@ -6,18 +6,18 @@ "docstatus": 0, "doctype": "Onboarding Step", "form_tour": "Item General", - "idx": 0, + "idx": 1, "intro_video_url": "", "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:19:56.297772", + "modified": "2023-05-16 12:56:40.355878", "modified_by": "Administrator", "name": "Create an Item", "owner": "Administrator", "reference_document": "Item", "show_form_tour": 1, - "show_full_form": 1, - "title": "Manage Items", + "show_full_form": 0, + "title": "Create an Item", "validate_action": 1 } \ No newline at end of file diff --git a/erpnext/setup/onboarding_step/data_import/data_import.json b/erpnext/setup/onboarding_step/data_import/data_import.json index 4999a368d3..e5dd7da29d 100644 --- a/erpnext/setup/onboarding_step/data_import/data_import.json +++ b/erpnext/setup/onboarding_step/data_import/data_import.json @@ -5,11 +5,11 @@ "description": "# Import Data from Spreadsheet\n\nIn ERPNext, you can easily migrate your historical data using spreadsheets. You can use it for migrating not just masters (like Customer, Supplier, Items), but also for transactions like (outstanding invoices, opening stock and accounting entries, etc).", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2022-06-07 14:28:51.390813", + "modified": "2023-05-15 09:18:42.962231", "modified_by": "Administrator", "name": "Data import", "owner": "Administrator", diff --git a/erpnext/setup/onboarding_step/letterhead/letterhead.json b/erpnext/setup/onboarding_step/letterhead/letterhead.json index 8e1bb8ce82..584fd481ba 100644 --- a/erpnext/setup/onboarding_step/letterhead/letterhead.json +++ b/erpnext/setup/onboarding_step/letterhead/letterhead.json @@ -5,11 +5,11 @@ "description": "# Create a Letter Head\n\nA Letter Head contains your organization's name, logo, address, etc which appears at the header and footer portion in documents. You can learn more about Setting up Letter Head in ERPNext here.\n", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:21:39.037742", + "modified": "2023-05-15 09:18:42.995184", "modified_by": "Administrator", "name": "Letterhead", "owner": "Administrator", diff --git a/erpnext/setup/onboarding_step/navigation_help/navigation_help.json b/erpnext/setup/onboarding_step/navigation_help/navigation_help.json index cf07968bc7..f57818b9f7 100644 --- a/erpnext/setup/onboarding_step/navigation_help/navigation_help.json +++ b/erpnext/setup/onboarding_step/navigation_help/navigation_help.json @@ -2,14 +2,14 @@ "action": "Watch Video", "action_label": "Learn about Navigation options", "creation": "2021-11-22 12:09:52.233872", - "description": "# Navigation in ERPNext\n\nEase of navigating and browsing around the ERPNext is one of our core strengths. In the following video, you will learn how to reach a specific feature in ERPNext via module page or awesome bar\u2019s shortcut.\n", + "description": "# Navigation in ERPNext\n\nEase of navigating and browsing around the ERPNext is one of our core strengths. In the following video, you will learn how to reach a specific feature in ERPNext via module page or AwesomeBar.", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2022-06-07 14:28:00.901082", + "modified": "2023-05-16 12:53:25.939908", "modified_by": "Administrator", "name": "Navigation Help", "owner": "Administrator", From 776a83066db63e84cc6e7dac804c581343f81ccd Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 16 May 2023 15:54:46 +0530 Subject: [PATCH 10/15] fix: cancelled vouchers in tax withheld vouchers list (#35309) --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 5c9168bf9c..ab7884d520 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -303,7 +303,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying. apply_tds(frm) { var me = this; - + me.frm.set_value("tax_withheld_vouchers", []); if (!me.frm.doc.apply_tds) { me.frm.set_value("tax_withholding_category", ''); me.frm.set_df_property("tax_withholding_category", "hidden", 1); From 6e661e7c0e8251f458d699254423cfb76dc3b5dd Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 16 May 2023 16:23:52 +0530 Subject: [PATCH 11/15] fix: force to do reposting for cancelled document --- erpnext/controllers/stock_controller.py | 3 +++ .../test_repost_item_valuation.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 09089be861..befde71775 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -770,6 +770,9 @@ class StockController(AccountsController): } ) + if self.docstatus == 2: + force = True + if force or future_sle_exists(args) or repost_required_for_queue(self): item_based_reposting = cint( frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting") diff --git a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py index 96ac4352dc..9c4d997b31 100644 --- a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py @@ -376,3 +376,19 @@ class TestRepostItemValuation(FrappeTestCase, StockTestMixin): accounts_settings.acc_frozen_upto = "" accounts_settings.save() + + def test_create_repost_entry_for_cancelled_document(self): + pr = make_purchase_receipt( + company="_Test Company with perpetual inventory", + warehouse="Stores - TCP1", + get_multiple_items=True, + ) + + self.assertTrue(pr.docstatus == 1) + self.assertFalse(frappe.db.exists("Repost Item Valuation", {"voucher_no": pr.name})) + + pr.load_from_db() + + pr.cancel() + self.assertTrue(pr.docstatus == 2) + self.assertTrue(frappe.db.exists("Repost Item Valuation", {"voucher_no": pr.name})) From ae4e56747c63f0335259cb0949ae1d429d2de2a0 Mon Sep 17 00:00:00 2001 From: Ashish Shah Date: Wed, 10 May 2023 10:51:20 +0530 Subject: [PATCH 12/15] refactor: use 'flt' for base_total_taxes_and_charges difference_amount calculation is broken, as calculation gives NaN. Fix is make frm.doc.base_total_taxes_and_charges as flt(frm.doc.base_total_taxes_and_charges) --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 07761c7705..2843824934 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -904,7 +904,7 @@ frappe.ui.form.on('Payment Entry', { function(d) { return flt(d.amount) })); frm.set_value("difference_amount", difference_amount - total_deductions + - frm.doc.base_total_taxes_and_charges); + flt(frm.doc.base_total_taxes_and_charges)); frm.events.hide_unhide_fields(frm); }, From 0da6c1688b3d37b21d25de81e202e3451fd8dac9 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 16 May 2023 18:57:42 +0530 Subject: [PATCH 13/15] fix: unable to create partial invoice with auto fetch terms enabled (#35285) fix: fetch so/po terms if auto fetch is enabled --- erpnext/controllers/accounts_controller.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 3d930d67e0..78bb05671d 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1682,6 +1682,9 @@ class AccountsController(TransactionBase): d.base_payment_amount = flt( d.payment_amount * self.get("conversion_rate"), d.precision("base_payment_amount") ) + else: + self.fetch_payment_terms_from_order(po_or_so, doctype) + self.ignore_default_payment_terms_template = 1 def get_order_details(self): if self.doctype == "Sales Invoice": From adf2474d9ded01ed89aedddd1fd3da3514cd68b0 Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Tue, 16 May 2023 15:12:47 +0530 Subject: [PATCH 14/15] fix(ux): SCR consumed-qty read-only property --- .../subcontracting_receipt.js | 18 ++++-------------- .../subcontracting_receipt.py | 8 ++++++++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js index 45289b1dab..4bf008ac40 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js @@ -76,26 +76,14 @@ frappe.ui.form.on('Subcontracting Receipt', { } }); - let batch_no_field = frm.get_docfield("items", "batch_no"); + let batch_no_field = frm.get_docfield('items', 'batch_no'); if (batch_no_field) { batch_no_field.get_route_options_for_new_doc = function(row) { return { - "item": row.doc.item_code + 'item': row.doc.item_code } }; } - - frappe.db.get_single_value('Buying Settings', 'backflush_raw_materials_of_subcontract_based_on').then(val => { - if (val == 'Material Transferred for Subcontract') { - frm.fields_dict['supplied_items'].grid.grid_rows.forEach((grid_row) => { - grid_row.docfields.forEach((df) => { - if (df.fieldname == 'consumed_qty') { - df.read_only = 0; - } - }); - }); - } - }); }, refresh: (frm) => { @@ -157,6 +145,8 @@ frappe.ui.form.on('Subcontracting Receipt', { } }); }, __('Get Items From')); + + frm.fields_dict.supplied_items.grid.update_docfield_property('consumed_qty', 'read_only', frm.doc.__onload && frm.doc.__onload.backflush_based_on === 'BOM'); } }, diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py index 2c84262273..416f4f80a2 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py @@ -28,6 +28,14 @@ class SubcontractingReceipt(SubcontractingController): }, ] + def onload(self): + self.set_onload( + "backflush_based_on", + frappe.db.get_single_value( + "Buying Settings", "backflush_raw_materials_of_subcontract_based_on" + ), + ) + def update_status_updater_args(self): if cint(self.is_return): self.status_updater.extend( From e5c86bc2e82202522bd803f66dc1bdc00f8e4432 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 17 May 2023 16:04:49 +0530 Subject: [PATCH 15/15] fix: consider 0 if rate/qty are null (#35338) [skip ci] --- .../patches/v13_0/update_amt_in_work_order_required_items.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py b/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py index e37f291233..64170edb71 100644 --- a/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py +++ b/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py @@ -7,4 +7,6 @@ def execute(): frappe.reload_doc("manufacturing", "doctype", "work_order") frappe.reload_doc("manufacturing", "doctype", "work_order_item") - frappe.db.sql("""UPDATE `tabWork Order Item` SET amount = rate * required_qty""") + frappe.db.sql( + """UPDATE `tabWork Order Item` SET amount = ifnull(rate, 0.0) * ifnull(required_qty, 0.0)""" + )