From 50da6937e1a4523e3393bce06b104b71e213ee4e Mon Sep 17 00:00:00 2001 From: sudarshan-g Date: Mon, 9 Mar 2026 13:32:59 +0530 Subject: [PATCH 001/217] feat: add cost center field to the stock entry accounting dimension tab (cherry picked from commit 47772f4e7763161d01c6987207327cbf4d428107) --- erpnext/stock/doctype/stock_entry/stock_entry.js | 4 +++- erpnext/stock/doctype/stock_entry/stock_entry.json | 14 +++++++++++++- erpnext/stock/doctype/stock_entry/stock_entry.py | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 3bdb5fb3596..4fdd9df1adf 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -565,7 +565,9 @@ frappe.ui.form.on("Stock Entry", { frm.fields_dict.items.grid.refresh(); frm.cscript.toggle_related_fields(frm.doc); }, - + cost_center(frm, cdt, cdn) { + erpnext.utils.copy_value_in_all_rows(frm.doc, cdt, cdn, "items", "cost_center"); + }, validate_purpose_consumption: function (frm) { frappe .call({ diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index 7f889b04610..7c9dadb9a55 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -65,6 +65,8 @@ "address_display", "accounting_dimensions_section", "project", + "column_break_wgvc", + "cost_center", "other_info_tab", "printing_settings", "select_print_heading", @@ -739,6 +741,16 @@ { "fieldname": "column_break_qpvo", "fieldtype": "Column Break" + }, + { + "fieldname": "column_break_wgvc", + "fieldtype": "Column Break" + }, + { + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center" } ], "grid_page_length": 50, @@ -747,7 +759,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2026-02-06 19:26:59.518312", + "modified": "2026-03-04 19:03:23.426082", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index bdcbbed0e18..97da1eac681 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -106,6 +106,7 @@ class StockEntry(StockController, SubcontractingInwardController): asset_repair: DF.Link | None bom_no: DF.Link | None company: DF.Link + cost_center: DF.Link | None credit_note: DF.Link | None delivery_note_no: DF.Link | None fg_completed_qty: DF.Float From 91ee45a698c1dd8332808d63df7005681663df77 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 13:30:29 +0530 Subject: [PATCH 002/217] fix(stock): add company filter while fetching batches (backport #53369) (#53581) Co-authored-by: Sudharsanan Ashok <135326972+Sudharsanan11@users.noreply.github.com> Co-authored-by: Mihir Kandoi fix(stock): add company filter while fetching batches (#53369) --- erpnext/manufacturing/doctype/bom/bom.js | 1 + .../doctype/work_order/work_order.py | 7 +- erpnext/stock/doctype/pick_list/pick_list.py | 39 ++++++ .../stock/doctype/pick_list/test_pick_list.py | 114 ++++++++++++++++++ .../pick_list_item/pick_list_item.json | 3 +- .../serial_and_batch_bundle.py | 60 ++++++--- 6 files changed, 204 insertions(+), 20 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 9ae05611b6c..454f1934e13 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -297,6 +297,7 @@ frappe.ui.form.on("BOM", { bom_no: frm.doc.name, item: item, qty: data.qty || 0.0, + company: frm.doc.company, project: frm.doc.project, variant_items: variant_items, use_multi_level_bom: frm.doc?.track_semi_finished_goods ? 0 : use_multi_level_bom, diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index 3c27d502088..4c317203295 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -2261,7 +2261,11 @@ def get_item_details(item, project=None, skip_bom_info=False, throw=True): @frappe.whitelist() -def make_work_order(bom_no, item, qty=0, project=None, variant_items=None, use_multi_level_bom=None): +def make_work_order( + bom_no, item, qty=0, company=None, project=None, variant_items=None, use_multi_level_bom=None +): + from erpnext import get_default_company + if not frappe.has_permission("Work Order", "write"): frappe.throw(_("Not permitted"), frappe.PermissionError) @@ -2277,6 +2281,7 @@ def make_work_order(bom_no, item, qty=0, project=None, variant_items=None, use_m wo_doc = frappe.new_doc("Work Order") wo_doc.track_semi_finished_goods = frappe.db.get_value("BOM", bom_no, "track_semi_finished_goods") wo_doc.production_item = item + wo_doc.company = company or get_default_company() wo_doc.update(item_details) wo_doc.bom_no = bom_no wo_doc.use_multi_level_bom = cint(use_multi_level_bom) diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py index 472502bd80e..ef80966c2a6 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.py +++ b/erpnext/stock/doctype/pick_list/pick_list.py @@ -28,6 +28,15 @@ from erpnext.stock.serial_batch_bundle import ( ) from erpnext.utilities.transaction_base import TransactionBase + +class MissingWarehouseValidationError(frappe.ValidationError): + pass + + +class IncorrectWarehouseValidationError(frappe.ValidationError): + pass + + # TODO: Prioritize SO or WO group warehouse @@ -108,6 +117,7 @@ class PickList(TransactionBase): if self.get("locations"): self.validate_sales_order_percentage() + self.validate_warehouses() def validate_stock_qty(self): from erpnext.stock.doctype.batch.batch import get_batch_qty @@ -152,6 +162,31 @@ class PickList(TransactionBase): title=_("Insufficient Stock"), ) + def validate_warehouses(self): + for location in self.locations: + if not location.warehouse: + frappe.throw( + _("Row {0}: Warehouse is required").format(location.idx), + title=_("Missing Warehouse"), + exc=MissingWarehouseValidationError, + ) + + company = frappe.get_cached_value("Warehouse", location.warehouse, "company") + + if company != self.company: + frappe.throw( + _( + "Row {0}: Warehouse {1} is linked to company {2}. Please select a warehouse belonging to company {3}." + ).format( + location.idx, + frappe.bold(location.warehouse), + frappe.bold(company), + frappe.bold(self.company), + ), + title=_("Incorrect Warehouse"), + exc=IncorrectWarehouseValidationError, + ) + def check_serial_no_status(self): from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos @@ -958,6 +993,7 @@ def get_available_item_locations( locations = get_available_item_locations_for_batched_item( item_code, from_warehouses, + company, consider_rejected_warehouses=consider_rejected_warehouses, ) else: @@ -1058,6 +1094,7 @@ def get_available_item_locations_for_serial_and_batched_item( locations = get_available_item_locations_for_batched_item( item_code, from_warehouses, + company, consider_rejected_warehouses=consider_rejected_warehouses, ) @@ -1138,6 +1175,7 @@ def get_available_item_locations_for_serialized_item( def get_available_item_locations_for_batched_item( item_code, from_warehouses, + company, consider_rejected_warehouses=False, ): locations = [] @@ -1146,6 +1184,7 @@ def get_available_item_locations_for_batched_item( { "item_code": item_code, "warehouse": from_warehouses, + "company": company, "based_on": frappe.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"), } ) diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py index 87c2275d3d1..12c92310147 100644 --- a/erpnext/stock/doctype/pick_list/test_pick_list.py +++ b/erpnext/stock/doctype/pick_list/test_pick_list.py @@ -211,6 +211,7 @@ class TestPickList(IntegrationTestCase): "qty": 1000, "stock_qty": 1000, "conversion_factor": 1, + "warehouse": "_Test Warehouse - _TC", "sales_order": so.name, "sales_order_item": so.items[0].name, } @@ -268,6 +269,119 @@ class TestPickList(IntegrationTestCase): pr1.cancel() pr2.cancel() + def test_pick_list_warehouse_for_batched_item(self): + """ + Test that pick list respects company based warehouse assignment for batched items. + + This test verifies that when creating a pick list for a batched item, + the system correctly identifies and assigns the appropriate warehouse + based on the company. + """ + from erpnext.stock.doctype.batch.test_batch import make_new_batch + + batch_company = frappe.get_doc( + {"doctype": "Company", "company_name": "Batch Company", "default_currency": "INR"} + ) + batch_company.insert() + + batch_warehouse = frappe.get_doc( + { + "doctype": "Warehouse", + "warehouse_name": "Batch Warehouse", + "company": batch_company.name, + } + ) + batch_warehouse.insert() + + batch_item = frappe.db.exists("Item", "Batch Warehouse Item") + if not batch_item: + batch_item = create_item("Batch Warehouse Item") + batch_item.has_batch_no = 1 + batch_item.create_new_batch = 1 + batch_item.save() + else: + batch_item = frappe.get_doc("Item", "Batch Warehouse Item") + + batch_no = make_new_batch(item_code=batch_item.name, batch_id="B-WH-ITEM-001") + + make_stock_entry( + item_code=batch_item.name, + qty=5, + company=batch_company.name, + to_warehouse=batch_warehouse.name, + batch_no=batch_no.name, + rate=100.0, + ) + make_stock_entry( + item_code=batch_item.name, + qty=5, + to_warehouse="_Test Warehouse - _TC", + batch_no=batch_no.name, + rate=100.0, + ) + + pick_list = frappe.get_doc( + { + "doctype": "Pick List", + "company": batch_company.name, + "purpose": "Material Transfer", + "locations": [ + { + "item_code": batch_item.name, + "qty": 10, + "stock_qty": 10, + "conversion_factor": 1, + } + ], + } + ) + + pick_list.set_item_locations() + self.assertEqual(len(pick_list.locations), 1) + self.assertEqual(pick_list.locations[0].qty, 5) + self.assertEqual(pick_list.locations[0].batch_no, batch_no.name) + self.assertEqual(pick_list.locations[0].warehouse, batch_warehouse.name) + + def test_pick_list_warehouse_validation(self): + """check if the warehouse validations are triggered""" + from erpnext.stock.doctype.pick_list.pick_list import ( + IncorrectWarehouseValidationError, + MissingWarehouseValidationError, + ) + + warehouse_item = create_item("Warehouse Item") + temp_company = frappe.get_doc( + {"doctype": "Company", "company_name": "Temp Company", "default_currency": "INR"} + ).insert() + temp_warehouse = frappe.get_doc( + {"doctype": "Warehouse", "warehouse_name": "Temp Warehouse", "company": temp_company.name} + ).insert() + + make_stock_entry(item_code=warehouse_item.name, qty=10, rate=100.0, to_warehouse=temp_warehouse.name) + + pick_list = frappe.get_doc( + { + "doctype": "Pick List", + "company": temp_company.name, + "purpose": "Material Transfer", + "pick_manually": 1, + "locations": [ + { + "item_code": warehouse_item.name, + "qty": 5, + "stock_qty": 5, + "conversion_factor": 1, + } + ], + } + ) + + self.assertRaises(MissingWarehouseValidationError, pick_list.insert) + pick_list.locations[0].warehouse = "_Test Warehouse - _TC" + self.assertRaises(IncorrectWarehouseValidationError, pick_list.insert) + pick_list.locations[0].warehouse = temp_warehouse.name + pick_list.insert() + def test_pick_list_for_batched_and_serialised_item(self): # check if oldest batch no and serial nos are picked item = frappe.db.exists("Item", {"item_name": "Batched and Serialised Item"}) diff --git a/erpnext/stock/doctype/pick_list_item/pick_list_item.json b/erpnext/stock/doctype/pick_list_item/pick_list_item.json index e4ee15f04b0..01630278168 100644 --- a/erpnext/stock/doctype/pick_list_item/pick_list_item.json +++ b/erpnext/stock/doctype/pick_list_item/pick_list_item.json @@ -62,6 +62,7 @@ "fieldtype": "Link", "in_list_view": 1, "label": "Warehouse", + "mandatory_depends_on": "eval: parent.pick_manually", "options": "Warehouse", "read_only": 1 }, @@ -284,7 +285,7 @@ ], "istable": 1, "links": [], - "modified": "2025-12-18 21:09:12.737036", + "modified": "2026-03-17 16:25:10.358013", "modified_by": "Administrator", "module": "Stock", "name": "Pick List Item", diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 76031397b01..aa7f276ddc1 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -2673,26 +2673,38 @@ def get_reserved_batches_for_pos(kwargs) -> dict: """Returns a dict of `Batch No` followed by the `Qty` reserved in POS Invoices.""" pos_batches = frappe._dict() - pos_invoices = frappe.get_all( - "POS Invoice", - fields=[ - "`tabPOS Invoice Item`.batch_no", - "`tabPOS Invoice Item`.qty", - "`tabPOS Invoice`.is_return", - "`tabPOS Invoice Item`.warehouse", - "`tabPOS Invoice Item`.name as child_docname", - "`tabPOS Invoice`.name as parent_docname", - "`tabPOS Invoice Item`.use_serial_batch_fields", - "`tabPOS Invoice Item`.serial_and_batch_bundle", - ], - filters=[ - ["POS Invoice", "consolidated_invoice", "is", "not set"], - ["POS Invoice", "docstatus", "=", 1], - ["POS Invoice Item", "item_code", "=", kwargs.item_code], - ["POS Invoice", "name", "not in", kwargs.ignore_voucher_nos], - ], + POS_Invoice = frappe.qb.DocType("POS Invoice") + POS_Invoice_Item = frappe.qb.DocType("POS Invoice Item") + + pos_invoices = ( + frappe.qb.from_(POS_Invoice) + .inner_join(POS_Invoice_Item) + .on(POS_Invoice.name == POS_Invoice_Item.parent) + .select( + POS_Invoice_Item.batch_no, + POS_Invoice_Item.qty, + POS_Invoice.is_return, + POS_Invoice_Item.warehouse, + POS_Invoice_Item.name.as_("child_docname"), + POS_Invoice.name.as_("parent_docname"), + POS_Invoice_Item.use_serial_batch_fields, + POS_Invoice_Item.serial_and_batch_bundle, + ) + .where( + (POS_Invoice.consolidated_invoice.isnull()) + & (POS_Invoice.docstatus == 1) + & (POS_Invoice_Item.item_code == kwargs.item_code) + ) ) + if kwargs.get("company"): + pos_invoices = pos_invoices.where(POS_Invoice.company == kwargs.get("company")) + + if kwargs.get("ignore_voucher_nos"): + pos_invoices = pos_invoices.where(POS_Invoice.name.notin(kwargs.get("ignore_voucher_nos"))) + + pos_invoices = pos_invoices.run(as_dict=True) + ids = [ pos_invoice.serial_and_batch_bundle for pos_invoice in pos_invoices @@ -2755,6 +2767,9 @@ def get_reserved_batches_for_sre(kwargs) -> dict: .groupby(sb_entry.batch_no, sre.warehouse) ) + if kwargs.get("company"): + query = query.where(sre.company == kwargs.get("company")) + if kwargs.batch_no: if isinstance(kwargs.batch_no, list): query = query.where(sb_entry.batch_no.isin(kwargs.batch_no)) @@ -2979,6 +2994,9 @@ def get_available_batches(kwargs): .groupby(batch_ledger.batch_no, batch_ledger.warehouse) ) + if kwargs.get("company"): + query = query.where(stock_ledger_entry.company == kwargs.get("company")) + if not kwargs.get("for_stock_levels"): query = query.where((batch_table.expiry_date >= today()) | (batch_table.expiry_date.isnull())) @@ -3088,6 +3106,9 @@ def get_picked_batches(kwargs) -> dict[str, dict]: ) ) + if kwargs.get("company"): + query = query.where(table.company == kwargs.get("company")) + if kwargs.get("item_code"): query = query.where(table.item_code == kwargs.get("item_code")) @@ -3304,6 +3325,9 @@ def get_stock_ledgers_batches(kwargs): .groupby(stock_ledger_entry.batch_no, stock_ledger_entry.warehouse) ) + if kwargs.get("company"): + query = query.where(stock_ledger_entry.company == kwargs.get("company")) + for field in ["warehouse", "item_code", "batch_no"]: if not kwargs.get(field): continue From 55bad49cf0a1583b58b66670c579543476915532 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 18 Mar 2026 18:49:30 +0530 Subject: [PATCH 003/217] fix: incorrect sle calculation when doc has project (#53599) (cherry picked from commit 6cb6a52ded9addd3e0e54b0b59ebd6d34d357b4a) --- erpnext/stock/report/stock_ledger/stock_ledger.py | 1 + erpnext/stock/stock_ledger.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index 225d9010592..e2bcc3dc6f3 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -689,6 +689,7 @@ def get_opening_balance(filters, columns, sl_entries, inv_dimension_wise_value=N "posting_time": "00:00:00", "project": project, }, + for_report=True, ) # check if any SLEs are actually Opening Stock Reconciliation diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index dadc586edb4..ae643406982 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -1781,7 +1781,7 @@ def get_previous_sle_of_current_voucher(args, operator="<", exclude_current_vouc return sle[0] if sle else frappe._dict() -def get_previous_sle(args, for_update=False, extra_cond=None): +def get_previous_sle(args, for_update=False, extra_cond=None, for_report=False): """ get the last sle on or before the current time-bucket, to get actual qty before transaction, this function @@ -1797,7 +1797,7 @@ def get_previous_sle(args, for_update=False, extra_cond=None): """ args["name"] = args.get("sle", None) or "" sle = get_stock_ledger_entries( - args, "<=", "desc", "limit 1", for_update=for_update, extra_cond=extra_cond + args, "<=", "desc", "limit 1", for_update=for_update, extra_cond=extra_cond, for_report=for_report ) return sle and sle[0] or {} @@ -1811,6 +1811,7 @@ def get_stock_ledger_entries( debug=False, check_serial_no=True, extra_cond=None, + for_report=False, ): """get stock ledger entries filtered by specific posting datetime conditions""" conditions = f" and posting_datetime {operator} %(posting_datetime)s" @@ -1865,7 +1866,7 @@ def get_stock_ledger_entries( if extra_cond: conditions += f"{extra_cond}" - if previous_sle.get("project"): + if for_report and previous_sle.get("project"): conditions += " and project = %(project)s" # nosemgrep From 9889ef24554248a840136b828a71b1cca16127d0 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 27 Feb 2026 10:30:12 +0530 Subject: [PATCH 004/217] refactor: remove frappe.flags and make use of cache decorator (cherry picked from commit 565542879eb8523135ae5a68016581947eff086a) --- .../accounting_dimension.py | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py index ff8094ba432..70253c674c5 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py @@ -103,10 +103,6 @@ class AccountingDimension(Document): if not self.fieldname: self.fieldname = scrub(self.label) - def on_update(self): - frappe.flags.accounting_dimensions = None - frappe.flags.accounting_dimensions_details = None - def make_dimension_in_accounting_doctypes(doc, doclist=None): if not doclist: @@ -241,34 +237,26 @@ def get_doctypes_with_dimensions(): return frappe.get_hooks("accounting_dimension_doctypes") -def get_accounting_dimensions(as_list=True, filters=None): - if not filters: - filters = {"disabled": 0} - - if frappe.flags.accounting_dimensions is None: - frappe.flags.accounting_dimensions = frappe.get_all( - "Accounting Dimension", - fields=["label", "fieldname", "disabled", "document_type"], - filters=filters, - ) +def get_accounting_dimensions(as_list=True): + accounting_dimensions = frappe.get_all( + "Accounting Dimension", + fields=["label", "fieldname", "disabled", "document_type"], + filters={"disabled": 0}, + ) if as_list: - return [d.fieldname for d in frappe.flags.accounting_dimensions] + return [d.fieldname for d in accounting_dimensions] else: - return frappe.flags.accounting_dimensions + return accounting_dimensions def get_checks_for_pl_and_bs_accounts(): - if frappe.flags.accounting_dimensions_details is None: - # nosemgrep - frappe.flags.accounting_dimensions_details = frappe.db.sql( - """SELECT p.label, p.disabled, p.fieldname, c.default_dimension, c.company, c.mandatory_for_pl, c.mandatory_for_bs + return frappe.db.sql( + """SELECT p.label, p.disabled, p.fieldname, c.default_dimension, c.company, c.mandatory_for_pl, c.mandatory_for_bs FROM `tabAccounting Dimension`p ,`tabAccounting Dimension Detail` c WHERE p.name = c.parent AND p.disabled = 0""", - as_dict=1, - ) - - return frappe.flags.accounting_dimensions_details + as_dict=1, + ) def get_dimension_with_children(doctype, dimensions): From dbf795e8106011166d150e9d01c107f6b797f03b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 27 Feb 2026 16:37:27 +0530 Subject: [PATCH 005/217] refactor: remove frappe.flags from accounting dimensions filter (cherry picked from commit 290f979fd3767716bb1dd250a0b7f1fb155ad04e) --- .../accounting_dimension_filter.py | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py index 6eff320e3a3..3c6b29546ff 100644 --- a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py +++ b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py @@ -69,37 +69,34 @@ class AccountingDimensionFilter(Document): def get_dimension_filter_map(): - if not frappe.flags.get("dimension_filter_map"): - filters = frappe.db.sql( - """ - SELECT - a.applicable_on_account, d.dimension_value, p.accounting_dimension, - p.allow_or_restrict, p.fieldname, a.is_mandatory - FROM - `tabApplicable On Account` a, - `tabAccounting Dimension Filter` p - LEFT JOIN `tabAllowed Dimension` d ON d.parent = p.name - WHERE - p.name = a.parent - AND p.disabled = 0 - """, - as_dict=1, + filters = frappe.db.sql( + """ + SELECT + a.applicable_on_account, d.dimension_value, p.accounting_dimension, + p.allow_or_restrict, p.fieldname, a.is_mandatory + FROM + `tabApplicable On Account` a, + `tabAccounting Dimension Filter` p + LEFT JOIN `tabAllowed Dimension` d ON d.parent = p.name + WHERE + p.name = a.parent + AND p.disabled = 0 + """, + as_dict=1, + ) + + dimension_filter_map = {} + + for f in filters: + build_map( + dimension_filter_map, + f.fieldname, + f.applicable_on_account, + f.dimension_value, + f.allow_or_restrict, + f.is_mandatory, ) - - dimension_filter_map = {} - - for f in filters: - build_map( - dimension_filter_map, - f.fieldname, - f.applicable_on_account, - f.dimension_value, - f.allow_or_restrict, - f.is_mandatory, - ) - frappe.flags.dimension_filter_map = dimension_filter_map - - return frappe.flags.dimension_filter_map + return dimension_filter_map def build_map(map_object, dimension, account, filter_value, allow_or_restrict, is_mandatory): From 2ccac6c47982a79975bc63cec59df89db2d260de Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 04:46:51 +0000 Subject: [PATCH 006/217] fix: ignore cost center (backport #53063) (#53614) Co-authored-by: Sowmya <106989392+SowmyaArunachalam@users.noreply.github.com> fix: ignore cost center (#53063) --- .../doctype/sales_invoice/sales_invoice.py | 2 +- .../sales_invoice/test_sales_invoice.py | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 75a9fae92e9..ba5aa9dfd93 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -2777,7 +2777,7 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None): "doctype": target_doctype, "postprocess": update_details, "set_target_warehouse": "set_from_warehouse", - "field_no_map": ["taxes_and_charges", "set_warehouse", "shipping_address"], + "field_no_map": ["taxes_and_charges", "set_warehouse", "shipping_address", "cost_center"], }, doctype + " Item": item_field_map, }, diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index c00924a4394..6a0eb0e5014 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -4805,6 +4805,33 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(stock_ledger_entry.incoming_rate, 0.0) + def test_inter_company_transaction_cost_center(self): + si = create_sales_invoice( + company="Wind Power LLC", + customer="_Test Internal Customer", + debit_to="Debtors - WP", + warehouse="Stores - WP", + income_account="Sales - WP", + expense_account="Cost of Goods Sold - WP", + parent_cost_center="Main - WP", + cost_center="Main - WP", + currency="USD", + do_not_save=1, + ) + + si.selling_price_list = "_Test Price List Rest of the World" + si.submit() + + cost_center = frappe.db.get_value("Company", "_Test Company 1", "cost_center") + frappe.db.set_value("Company", "_Test Company 1", "cost_center", None) + + target_doc = make_inter_company_transaction("Sales Invoice", si.name) + + self.assertEqual(target_doc.cost_center, None) + self.assertEqual(target_doc.items[0].cost_center, None) + + frappe.db.set_value("Company", "_Test Company 1", "cost_center", cost_center) + def make_item_for_si(item_code, properties=None): from erpnext.stock.doctype.item.test_item import make_item From f394ead878642ef8feea7d91fb500d3285b17845 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 05:01:34 +0000 Subject: [PATCH 007/217] fix: check posting_date in args (backport #53303) (#53612) Co-authored-by: Vishnu Priya Baskaran <145791817+ervishnucs@users.noreply.github.com> fix: check posting_date in args (#53303) --- erpnext/accounts/doctype/pricing_rule/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py index efbd0ce5fae..56ba6a040dc 100644 --- a/erpnext/accounts/doctype/pricing_rule/utils.py +++ b/erpnext/accounts/doctype/pricing_rule/utils.py @@ -243,8 +243,10 @@ def get_other_conditions(conditions, values, args): if group_condition: conditions += " and " + group_condition - date = args.get("transaction_date") or frappe.get_value( - args.get("doctype"), args.get("name"), "posting_date", ignore=True + date = ( + args.get("transaction_date") + or args.get("posting_date") + or frappe.get_value(args.get("doctype"), args.get("name"), "posting_date", ignore=True) ) if date: conditions += """ and %(transaction_date)s between ifnull(`tabPricing Rule`.valid_from, '2000-01-01') From 10a40a6d9b044f1b7d97d391785f54f5ecbf6a03 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 05:15:51 +0000 Subject: [PATCH 008/217] fix: python error in manufacture entry if transfer against is job card (backport #53615) (#53618) Co-authored-by: Mihir Kandoi fix: python error in manufacture entry if transfer against is job card (#53615) --- erpnext/stock/doctype/stock_entry/stock_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 97da1eac681..728096880d0 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -2421,7 +2421,7 @@ class StockEntry(StockController, SubcontractingInwardController): self.to_warehouse if self.purpose == "Send to Subcontractor" else "" ) - if original_item != item.get("item_code"): + if isinstance(original_item, str) and original_item != item.get("item_code"): item["original_item"] = original_item self.add_to_stock_entry_detail(item_dict) From dd7cc56dfe4ff316d87352719ce269481f44e049 Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Mon, 5 Jan 2026 16:44:06 +0530 Subject: [PATCH 009/217] fix(test): Use the system-configured float precision (cherry picked from commit 1296829b9cb37a9d45d69d7ff5b5a9531938653f) --- erpnext/assets/doctype/asset/asset.py | 6 ++---- erpnext/assets/doctype/asset/test_asset.py | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 95011c8bba1..6954a1d752d 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -598,9 +598,7 @@ class Asset(AccountsController): def set_depreciation_rate(self): for d in self.get("finance_books"): self.validate_asset_finance_books(d) - d.rate_of_depreciation = flt( - self.get_depreciation_rate(d, on_validate=True), d.precision("rate_of_depreciation") - ) + d.rate_of_depreciation = self.get_depreciation_rate(d, on_validate=True) def validate_asset_finance_books(self, row): row.expected_value_after_useful_life = flt( @@ -990,7 +988,7 @@ class Asset(AccountsController): if isinstance(args, str): args = json.loads(args) - rate_field_precision = frappe.get_precision(args.doctype, "rate_of_depreciation") or 2 + rate_field_precision = frappe.get_single_value("System Settings", "float_precision") or 2 if args.get("depreciation_method") == "Double Declining Balance": return self.get_double_declining_balance_rate(args, rate_field_precision) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 6440fcfad62..44429ee7327 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -37,12 +37,14 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( make_purchase_invoice as make_invoice, ) from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class AssetSetup(IntegrationTestCase): +class AssetSetup(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() + frappe.db.set_single_value("System Settings", "float_precision", 3) set_depreciation_settings_in_company() create_asset_data() enable_cwip_accounting("Computers") From 1efbc60df1c934476090cd484299541591578a91 Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Mon, 5 Jan 2026 16:47:32 +0530 Subject: [PATCH 010/217] fix: use correct test class (cherry picked from commit 8d186d6b3ff38c99eba310f45297994447b08bf7) --- erpnext/assets/doctype/asset/test_asset.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 44429ee7327..cf49c5e3463 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -37,10 +37,9 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( make_purchase_invoice as make_invoice, ) from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt -from erpnext.tests.utils import ERPNextTestSuite -class AssetSetup(ERPNextTestSuite): +class AssetSetup(IntegrationTestCase): @classmethod def setUpClass(cls): super().setUpClass() From b855f30600ca2ae468721fc23cc5445b797b9596 Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Tue, 6 Jan 2026 14:39:31 +0530 Subject: [PATCH 011/217] refactor: modify test cases to handle float precision rounded to 2 decimals (cherry picked from commit 007258d657ef0b03c9bef37b9b69de3dc55f1a44) --- erpnext/assets/doctype/asset/test_asset.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index cf49c5e3463..a2503c3907c 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -924,9 +924,9 @@ class TestDepreciationMethods(AssetSetup): self.assertEqual(asset.status, "Draft") expected_schedules = [ - ["2030-12-31", 66667.00, 66667.00], - ["2031-12-31", 22222.11, 88889.11], - ["2032-12-31", 1110.89, 90000.0], + ["2030-12-31", 66670.0, 66670.0], + ["2031-12-31", 22221.11, 88891.11], + ["2032-12-31", 1108.89, 90000.0], ] schedules = [ @@ -952,7 +952,7 @@ class TestDepreciationMethods(AssetSetup): self.assertEqual(asset.status, "Draft") - expected_schedules = [["2031-12-31", 33333.50, 83333.50], ["2032-12-31", 6666.50, 90000.0]] + expected_schedules = [["2031-12-31", 33335.0, 83335.0], ["2032-12-31", 6665.0, 90000.0]] schedules = [ [cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount] @@ -1070,12 +1070,12 @@ class TestDepreciationMethods(AssetSetup): ) expected_schedules = [ - ["2022-02-28", 337.72, 337.72], - ["2022-03-31", 675.45, 1013.17], - ["2022-04-30", 675.45, 1688.62], - ["2022-05-31", 675.45, 2364.07], - ["2022-06-30", 675.45, 3039.52], - ["2022-07-15", 1960.48, 5000.0], + ["2022-02-28", 337.71, 337.71], + ["2022-03-31", 675.42, 1013.13], + ["2022-04-30", 675.42, 1688.55], + ["2022-05-31", 675.42, 2363.97], + ["2022-06-30", 675.42, 3039.39], + ["2022-07-15", 1960.61, 5000.0], ] schedules = [ From 0af4cd9098ef3d871ff426fb400cfdb605f610bb Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Tue, 6 Jan 2026 14:41:36 +0530 Subject: [PATCH 012/217] fix: do not update float precision on setup (cherry picked from commit 825e3717ca2760cde11fd5510718f8c0b2500947) --- erpnext/assets/doctype/asset/test_asset.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index a2503c3907c..eb399b1e6f0 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -43,7 +43,6 @@ class AssetSetup(IntegrationTestCase): @classmethod def setUpClass(cls): super().setUpClass() - frappe.db.set_single_value("System Settings", "float_precision", 3) set_depreciation_settings_in_company() create_asset_data() enable_cwip_accounting("Computers") From b000224a93eac3fcc4ce9ba8797aab4ce580a67f Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Tue, 6 Jan 2026 23:49:21 +0530 Subject: [PATCH 013/217] test: set up float precision (cherry picked from commit c0a85faa68777ece2fed91026de0f4d6c7a568c1) --- erpnext/assets/doctype/asset/test_asset.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index eb399b1e6f0..62e532f322f 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -826,6 +826,18 @@ class TestAsset(AssetSetup): class TestDepreciationMethods(AssetSetup): + @classmethod + def setUpClass(cls): + super().setUpClass() + + cls._old_float_precision = frappe.db.get_single_value("System Settings", "float_precision") + frappe.db.set_single_value("System Settings", "float_precision", 2) + + @classmethod + def tearDownClass(cls): + frappe.db.set_single_value("System Settings", "float_precision", cls._old_float_precision) + super().tearDownClass() + def test_schedule_for_straight_line_method(self): asset = create_asset( calculate_depreciation=1, From 1a6e96818d76560e1d433e77d7f4d3c0c8bdbb32 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 5 Jun 2025 14:55:21 +0530 Subject: [PATCH 014/217] ci: run parallel test in lightmode - modify individual test CI. let it be dormat for now. Acked-by: ruthra kumar --- ...dual-tests.yml => run-individual-tests.yml} | 18 ++++++++++++++---- .github/workflows/server-tests-mariadb.yml | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) rename .github/workflows/{run-indinvidual-tests.yml => run-individual-tests.yml} (82%) diff --git a/.github/workflows/run-indinvidual-tests.yml b/.github/workflows/run-individual-tests.yml similarity index 82% rename from .github/workflows/run-indinvidual-tests.yml rename to .github/workflows/run-individual-tests.yml index 3e4b8371f8a..a70a2394757 100644 --- a/.github/workflows/run-indinvidual-tests.yml +++ b/.github/workflows/run-individual-tests.yml @@ -4,8 +4,8 @@ on: workflow_dispatch: concurrency: - group: server-individual-tests-develop-${{ github.event_name }}-${{ github.event.number || github.event_name == 'workflow_dispatch' && github.run_id || '' }} - cancel-in-progress: false + group: server-individual-tests-lightmode-develop + cancel-in-progress: true permissions: contents: read @@ -21,7 +21,7 @@ jobs: - id: set-matrix run: | # Use grep and find to get the list of test files - matrix=$(find . -path '*/doctype/*/test_*.py' | xargs grep -l 'def test_' | awk '{ + matrix=$(find . -path '*/test_*.py' | xargs grep -l 'def test_' | sort | awk '{ # Remove ./ prefix, file extension, and replace / with . gsub(/^\.\//, "", $0) gsub(/\.py$/, "", $0) @@ -58,6 +58,7 @@ jobs: strategy: fail-fast: false matrix: ${{fromJson(needs.discover.outputs.matrix)}} + max-parallel: 14 name: Test @@ -130,4 +131,13 @@ jobs: FRAPPE_BRANCH: ${{ github.event.inputs.branch }} - name: Run Tests - run: 'cd ~/frappe-bench/ && bench --site test_site run-tests --app erpnext --module ${{ matrix.test }}' + run: | + site_name=$(echo "${{matrix.test}}" | sed -e 's/.*\.\(test_.*$\)/\1/') + echo "$site_name" + mkdir ~/frappe-bench/sites/$site_name + cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config_mariadb.json" ~/frappe-bench/sites/$site_name/site_config.json + cd ~/frappe-bench/ + bench --site $site_name reinstall --yes + bench --site $site_name set-config allow_tests true + bench --site $site_name run-tests --module ${{ matrix.test }} --lightmode + diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml index 2bfe5e7065d..b8e88d1b5f3 100644 --- a/.github/workflows/server-tests-mariadb.yml +++ b/.github/workflows/server-tests-mariadb.yml @@ -129,7 +129,7 @@ jobs: FRAPPE_BRANCH: ${{ github.event.client_payload.sha || github.event.inputs.branch }} - name: Run Tests - run: 'cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --total-builds ${{ strategy.job-total }} --build-number ${{ matrix.container }} --with-coverage' + run: 'cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --lightmode --app erpnext --total-builds ${{ strategy.job-total }} --build-number ${{ matrix.container }} --with-coverage' env: TYPE: server From f7e4d07a7e5770c6e8df54ede441ac2d3e469e91 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 May 2025 09:00:40 +0530 Subject: [PATCH 015/217] chore: delete all test_records.json --- .../doctype/account/test_records.json | 6 - .../doctype/cost_center/test_records.json | 23 - .../doctype/dunning_type/test_records.json | 36 -- .../item_tax_template/test_records.json | 79 --- .../doctype/journal_entry/test_records.json | 94 ---- .../doctype/payment_term/test_records.json | 34 -- .../payment_terms_template/test_records.json | 60 --- .../purchase_invoice/test_records.json | 209 -------- .../doctype/sales_invoice/test_records.json | 387 --------------- .../test_records.json | 209 -------- .../doctype/share_type/test_records.json | 10 - .../doctype/shareholder/test_records.json | 20 - .../doctype/shipping_rule/test_records.json | 108 ----- .../doctype/tax_category/test_records.json | 14 - .../doctype/tax_rule/test_records.json | 28 -- .../asset_maintenance/test_records.json | 68 --- .../assets/doctype/location/test_records.json | 44 -- .../doctype/purchase_order/test_records.json | 36 -- .../buying/doctype/supplier/test_records.json | 50 -- .../supplier_quotation/test_records.json | 31 -- .../maintenance_visit/test_records.json | 2 - .../doctype/operation/test_records.json | 7 - .../doctype/work_order/test_records.json | 12 - .../doctype/workstation/test_records.json | 19 - .../doctype/activity_cost/test_records.json | 1 - .../doctype/activity_type/test_records.json | 11 - .../doctype/customer/test_records.json | 64 --- .../doctype/industry_type/test_records.json | 10 - .../installation_note/test_records.json | 2 - .../doctype/product_bundle/test_records.json | 20 - .../doctype/quotation/test_records.json | 37 -- .../doctype/sales_order/test_records.json | 39 -- .../setup/doctype/branch/test_records.json | 1 - erpnext/setup/doctype/brand/test_records.json | 17 - .../setup/doctype/company/test_records.json | 109 ----- .../currency_exchange/test_records.json | 56 --- .../doctype/customer_group/test_records.json | 14 - .../doctype/department/test_records.json | 4 - .../doctype/designation/test_records.json | 1 - .../doctype/holiday_list/test_records.json | 22 - .../doctype/item_group/test_records.json | 108 ----- .../quotation_lost_reason/test_records.json | 6 - .../doctype/sales_partner/test_records.json | 1 - .../doctype/supplier_group/test_records.json | 8 - .../terms_and_conditions/test_records.json | 6 - .../setup/doctype/territory/test_records.json | 32 -- erpnext/setup/doctype/uom/test_records.json | 11 - erpnext/stock/doctype/item/test_records.json | 450 ------------------ .../doctype/item_attribute/test_records.json | 25 - .../doctype/item_price/test_records.json | 56 --- .../material_request/test_records.json | 57 --- .../doctype/price_list/test_records.json | 51 -- .../purchase_receipt/test_records.json | 87 ---- .../test_records.json | 17 - .../stock/doctype/serial_no/test_records.json | 1 - .../doctype/stock_entry/test_records.json | 105 ---- .../stock/doctype/warehouse/test_records.json | 64 --- 57 files changed, 3079 deletions(-) delete mode 100644 erpnext/accounts/doctype/account/test_records.json delete mode 100644 erpnext/accounts/doctype/cost_center/test_records.json delete mode 100644 erpnext/accounts/doctype/dunning_type/test_records.json delete mode 100644 erpnext/accounts/doctype/item_tax_template/test_records.json delete mode 100644 erpnext/accounts/doctype/journal_entry/test_records.json delete mode 100644 erpnext/accounts/doctype/payment_term/test_records.json delete mode 100644 erpnext/accounts/doctype/payment_terms_template/test_records.json delete mode 100644 erpnext/accounts/doctype/purchase_invoice/test_records.json delete mode 100644 erpnext/accounts/doctype/sales_invoice/test_records.json delete mode 100644 erpnext/accounts/doctype/sales_taxes_and_charges_template/test_records.json delete mode 100644 erpnext/accounts/doctype/share_type/test_records.json delete mode 100644 erpnext/accounts/doctype/shareholder/test_records.json delete mode 100644 erpnext/accounts/doctype/shipping_rule/test_records.json delete mode 100644 erpnext/accounts/doctype/tax_category/test_records.json delete mode 100644 erpnext/accounts/doctype/tax_rule/test_records.json delete mode 100644 erpnext/assets/doctype/asset_maintenance/test_records.json delete mode 100644 erpnext/assets/doctype/location/test_records.json delete mode 100644 erpnext/buying/doctype/purchase_order/test_records.json delete mode 100644 erpnext/buying/doctype/supplier/test_records.json delete mode 100644 erpnext/buying/doctype/supplier_quotation/test_records.json delete mode 100644 erpnext/maintenance/doctype/maintenance_visit/test_records.json delete mode 100644 erpnext/manufacturing/doctype/operation/test_records.json delete mode 100644 erpnext/manufacturing/doctype/work_order/test_records.json delete mode 100644 erpnext/manufacturing/doctype/workstation/test_records.json delete mode 100644 erpnext/projects/doctype/activity_cost/test_records.json delete mode 100644 erpnext/projects/doctype/activity_type/test_records.json delete mode 100644 erpnext/selling/doctype/customer/test_records.json delete mode 100644 erpnext/selling/doctype/industry_type/test_records.json delete mode 100644 erpnext/selling/doctype/installation_note/test_records.json delete mode 100644 erpnext/selling/doctype/product_bundle/test_records.json delete mode 100644 erpnext/selling/doctype/quotation/test_records.json delete mode 100644 erpnext/selling/doctype/sales_order/test_records.json delete mode 100644 erpnext/setup/doctype/branch/test_records.json delete mode 100644 erpnext/setup/doctype/brand/test_records.json delete mode 100644 erpnext/setup/doctype/company/test_records.json delete mode 100644 erpnext/setup/doctype/currency_exchange/test_records.json delete mode 100644 erpnext/setup/doctype/customer_group/test_records.json delete mode 100644 erpnext/setup/doctype/department/test_records.json delete mode 100644 erpnext/setup/doctype/designation/test_records.json delete mode 100644 erpnext/setup/doctype/holiday_list/test_records.json delete mode 100644 erpnext/setup/doctype/item_group/test_records.json delete mode 100644 erpnext/setup/doctype/quotation_lost_reason/test_records.json delete mode 100644 erpnext/setup/doctype/sales_partner/test_records.json delete mode 100644 erpnext/setup/doctype/supplier_group/test_records.json delete mode 100644 erpnext/setup/doctype/terms_and_conditions/test_records.json delete mode 100644 erpnext/setup/doctype/territory/test_records.json delete mode 100644 erpnext/setup/doctype/uom/test_records.json delete mode 100644 erpnext/stock/doctype/item/test_records.json delete mode 100644 erpnext/stock/doctype/item_attribute/test_records.json delete mode 100644 erpnext/stock/doctype/item_price/test_records.json delete mode 100644 erpnext/stock/doctype/material_request/test_records.json delete mode 100644 erpnext/stock/doctype/price_list/test_records.json delete mode 100644 erpnext/stock/doctype/purchase_receipt/test_records.json delete mode 100644 erpnext/stock/doctype/quality_inspection_template/test_records.json delete mode 100644 erpnext/stock/doctype/serial_no/test_records.json delete mode 100644 erpnext/stock/doctype/stock_entry/test_records.json delete mode 100644 erpnext/stock/doctype/warehouse/test_records.json diff --git a/erpnext/accounts/doctype/account/test_records.json b/erpnext/accounts/doctype/account/test_records.json deleted file mode 100644 index d15f7ad4c0a..00000000000 --- a/erpnext/accounts/doctype/account/test_records.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "doctype": "Account", - "name": "_Test Account 1" - } -] diff --git a/erpnext/accounts/doctype/cost_center/test_records.json b/erpnext/accounts/doctype/cost_center/test_records.json deleted file mode 100644 index 941a85b382d..00000000000 --- a/erpnext/accounts/doctype/cost_center/test_records.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "company": "_Test Company", - "cost_center_name": "_Test Cost Center", - "doctype": "Cost Center", - "is_group": 0, - "parent_cost_center": "_Test Company - _TC" - }, - { - "company": "_Test Company", - "cost_center_name": "_Test Cost Center 2", - "doctype": "Cost Center", - "is_group": 0, - "parent_cost_center": "_Test Company - _TC" - }, - { - "company": "_Test Company", - "cost_center_name": "_Test Write Off Cost Center", - "doctype": "Cost Center", - "is_group": 0, - "parent_cost_center": "_Test Company - _TC" - } -] diff --git a/erpnext/accounts/doctype/dunning_type/test_records.json b/erpnext/accounts/doctype/dunning_type/test_records.json deleted file mode 100644 index 7f28aab873c..00000000000 --- a/erpnext/accounts/doctype/dunning_type/test_records.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "doctype": "Dunning Type", - "dunning_type": "_Test First Notice", - "company": "_Test Company", - "is_default": 1, - "dunning_fee": 0.0, - "rate_of_interest": 0.0, - "dunning_letter_text": [ - { - "language": "en", - "body_text": "We have still not received payment for our invoice", - "closing_text": "We kindly request that you pay the outstanding amount immediately, including interest and late fees." - } - ], - "income_account": "Sales - _TC", - "cost_center": "_Test Cost Center - _TC" - }, - { - "doctype": "Dunning Type", - "dunning_type": "_Test Second Notice", - "company": "_Test Company", - "is_default": 0, - "dunning_fee": 10.0, - "rate_of_interest": 10.0, - "dunning_letter_text": [ - { - "language": "en", - "body_text": "We have still not received payment for our invoice", - "closing_text": "We kindly request that you pay the outstanding amount immediately, including interest and late fees." - } - ], - "income_account": "Sales - _TC", - "cost_center": "_Test Cost Center - _TC" - } -] diff --git a/erpnext/accounts/doctype/item_tax_template/test_records.json b/erpnext/accounts/doctype/item_tax_template/test_records.json deleted file mode 100644 index 4d9537d4b89..00000000000 --- a/erpnext/accounts/doctype/item_tax_template/test_records.json +++ /dev/null @@ -1,79 +0,0 @@ -[ - { - "doctype": "Item Tax Template", - "title": "_Test Account Excise Duty @ 10", - "company": "_Test Company", - "taxes": [ - { - "doctype": "Item Tax Template Detail", - "parentfield": "taxes", - "tax_rate": 10, - "tax_type": "_Test Account Excise Duty - _TC" - } - ] - }, - { - "doctype": "Item Tax Template", - "title": "_Test Account Excise Duty @ 12", - "company": "_Test Company", - "taxes": [ - { - "doctype": "Item Tax Template Detail", - "parentfield": "taxes", - "tax_rate": 12, - "tax_type": "_Test Account Excise Duty - _TC" - } - ] - }, - { - "doctype": "Item Tax Template", - "title": "_Test Account Excise Duty @ 15", - "company": "_Test Company", - "taxes": [ - { - "doctype": "Item Tax Template Detail", - "parentfield": "taxes", - "tax_rate": 15, - "tax_type": "_Test Account Excise Duty - _TC" - } - ] - }, - { - "doctype": "Item Tax Template", - "title": "_Test Account Excise Duty @ 20", - "company": "_Test Company", - "taxes": [ - { - "doctype": "Item Tax Template Detail", - "parentfield": "taxes", - "tax_rate": 20, - "tax_type": "_Test Account Excise Duty - _TC" - } - ] - }, - { - "doctype": "Item Tax Template", - "title": "_Test Item Tax Template 1", - "company": "_Test Company", - "taxes": [ - { - "doctype": "Item Tax Template Detail", - "parentfield": "taxes", - "tax_rate": 5, - "tax_type": "_Test Account Excise Duty - _TC" - }, - { - "doctype": "Item Tax Template Detail", - "parentfield": "taxes", - "tax_rate": 10, - "tax_type": "_Test Account Education Cess - _TC" - }, - { - "doctype": "Item Tax Template Detail", - "parentfield": "taxes", - "tax_rate": 15, - "tax_type": "_Test Account S&H Education Cess - _TC" - } - ] - } -] diff --git a/erpnext/accounts/doctype/journal_entry/test_records.json b/erpnext/accounts/doctype/journal_entry/test_records.json deleted file mode 100644 index 717c579c7a3..00000000000 --- a/erpnext/accounts/doctype/journal_entry/test_records.json +++ /dev/null @@ -1,94 +0,0 @@ -[ - { - "cheque_date": "2013-03-14", - "cheque_no": "33", - "company": "_Test Company", - "doctype": "Journal Entry", - "accounts": [ - { - "account": "Debtors - _TC", - "party_type": "Customer", - "party": "_Test Customer", - "credit_in_account_currency": 400.0, - "debit_in_account_currency": 0.0, - "doctype": "Journal Entry Account", - "parentfield": "accounts", - "cost_center": "_Test Cost Center - _TC" - }, - { - "account": "_Test Bank - _TC", - "credit_in_account_currency": 0.0, - "debit_in_account_currency": 400.0, - "doctype": "Journal Entry Account", - "parentfield": "accounts", - "cost_center": "_Test Cost Center - _TC" - } - ], - "naming_series": "_T-Journal Entry-", - "posting_date": "2013-02-14", - "user_remark": "test", - "voucher_type": "Bank Entry" - }, - - { - "cheque_date": "2013-02-14", - "cheque_no": "33", - "company": "_Test Company", - "doctype": "Journal Entry", - "accounts": [ - { - "account": "_Test Payable - _TC", - "party_type": "Supplier", - "party": "_Test Supplier", - "credit_in_account_currency": 0.0, - "debit_in_account_currency": 400.0, - "doctype": "Journal Entry Account", - "parentfield": "accounts", - "cost_center": "_Test Cost Center - _TC" - }, - { - "account": "_Test Bank - _TC", - "credit_in_account_currency": 400.0, - "debit_in_account_currency": 0.0, - "doctype": "Journal Entry Account", - "parentfield": "accounts", - "cost_center": "_Test Cost Center - _TC" - } - ], - "naming_series": "_T-Journal Entry-", - "posting_date": "2013-02-14", - "user_remark": "test", - "voucher_type": "Bank Entry" - }, - - { - "cheque_date": "2013-02-14", - "cheque_no": "33", - "company": "_Test Company", - "doctype": "Journal Entry", - "accounts": [ - { - "account": "Debtors - _TC", - "party_type": "Customer", - "party": "_Test Customer", - "credit_in_account_currency": 0.0, - "debit_in_account_currency": 400.0, - "doctype": "Journal Entry Account", - "parentfield": "accounts", - "cost_center": "_Test Cost Center - _TC" - }, - { - "account": "Sales - _TC", - "credit_in_account_currency": 400.0, - "debit_in_account_currency": 0.0, - "doctype": "Journal Entry Account", - "parentfield": "accounts", - "cost_center": "_Test Cost Center - _TC" - } - ], - "naming_series": "_T-Journal Entry-", - "posting_date": "2013-02-14", - "user_remark": "test", - "voucher_type": "Bank Entry" - } -] diff --git a/erpnext/accounts/doctype/payment_term/test_records.json b/erpnext/accounts/doctype/payment_term/test_records.json deleted file mode 100644 index ef6e0693b3c..00000000000 --- a/erpnext/accounts/doctype/payment_term/test_records.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "doctype":"Payment Term", - "due_date_based_on":"Day(s) after invoice date", - "payment_term_name":"_Test N30", - "description":"_Test Net 30 Days", - "invoice_portion":50, - "credit_days":30 - }, - { - "doctype":"Payment Term", - "due_date_based_on":"Day(s) after invoice date", - "payment_term_name":"_Test COD", - "description":"_Test Cash on Delivery", - "invoice_portion":50, - "credit_days":0 - }, - { - "doctype":"Payment Term", - "due_date_based_on":"Month(s) after the end of the invoice month", - "payment_term_name":"_Test EONM", - "description":"_Test End of Next Month", - "invoice_portion":100, - "credit_months":1 - }, - { - "doctype":"Payment Term", - "due_date_based_on":"Day(s) after invoice date", - "payment_term_name":"_Test N30 1", - "description":"_Test Net 30 Days", - "invoice_portion":100, - "credit_days":30 - } -] \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_terms_template/test_records.json b/erpnext/accounts/doctype/payment_terms_template/test_records.json deleted file mode 100644 index fea0b35c112..00000000000 --- a/erpnext/accounts/doctype/payment_terms_template/test_records.json +++ /dev/null @@ -1,60 +0,0 @@ -[ - { - "doctype":"Payment Terms Template", - "terms":[ - { - "doctype":"Payment Terms Template Detail", - "due_date_based_on":"Day(s) after invoice date", - "idx":1, - "description":"Cash on Delivery", - "invoice_portion":50, - "credit_days":0, - "credit_months":0, - "payment_term":"_Test COD" - }, - { - "doctype":"Payment Terms Template Detail", - "due_date_based_on":"Day(s) after invoice date", - "idx":2, - "description":"Net 30 Days ", - "invoice_portion":50, - "credit_days":30, - "credit_months":0, - "payment_term":"_Test N30" - } - ], - "template_name":"_Test Payment Term Template" - }, - { - "doctype":"Payment Terms Template", - "terms":[ - { - "doctype":"Payment Terms Template Detail", - "due_date_based_on":"Month(s) after the end of the invoice month", - "idx":1, - "description":"_Test End of Next Months", - "invoice_portion":100, - "credit_days":0, - "credit_months":1, - "payment_term":"_Test EONM" - } - ], - "template_name":"_Test Payment Term Template 1" - }, - { - "doctype":"Payment Terms Template", - "terms":[ - { - "doctype":"Payment Terms Template Detail", - "due_date_based_on":"Day(s) after invoice date", - "idx":1, - "description":"_Test Net Within 30 days", - "invoice_portion":100, - "credit_days":30, - "credit_months":0, - "payment_term":"_Test N30 1" - } - ], - "template_name":"_Test Payment Term Template 3" - } -] \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_invoice/test_records.json b/erpnext/accounts/doctype/purchase_invoice/test_records.json deleted file mode 100644 index 9f9e90d8a75..00000000000 --- a/erpnext/accounts/doctype/purchase_invoice/test_records.json +++ /dev/null @@ -1,209 +0,0 @@ -[ - { - "bill_no": "NA", - "buying_price_list": "_Test Price List", - "company": "_Test Company", - "conversion_rate": 1, - "credit_to": "_Test Payable - _TC", - "currency": "INR", - "doctype": "Purchase Invoice", - "items": [ - { - "amount": 500, - "base_amount": 500, - "base_rate": 50, - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Purchase Invoice Item", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item Home Desktop 100", - "item_name": "_Test Item Home Desktop 100", - "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", - "parentfield": "items", - "qty": 10, - "rate": 50, - "uom": "_Test UOM", - "warehouse": "_Test Warehouse - _TC" - }, - { - "amount": 750, - "base_amount": 750, - "base_rate": 150, - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Purchase Invoice Item", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item Home Desktop 200", - "item_name": "_Test Item Home Desktop 200", - "parentfield": "items", - "qty": 5, - "rate": 150, - "uom": "_Test UOM", - "warehouse": "_Test Warehouse - _TC" - } - ], - "grand_total": 0, - "naming_series": "T-PINV-", - "taxes": [ - { - "account_head": "_Test Account Shipping Charges - _TC", - "add_deduct_tax": "Add", - "category": "Valuation and Total", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Shipping Charges", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "tax_amount": 100 - }, - { - "account_head": "_Test Account Customs Duty - _TC", - "add_deduct_tax": "Add", - "category": "Valuation", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Customs Duty", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 10 - }, - { - "account_head": "_Test Account Excise Duty - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Excise Duty", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 12 - }, - { - "account_head": "_Test Account Education Cess - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "Education Cess", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 2, - "row_id": 3 - }, - { - "account_head": "_Test Account S&H Education Cess - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "S&H Education Cess", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 1, - "row_id": 3 - }, - { - "account_head": "_Test Account CST - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "CST", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 2, - "row_id": 5 - }, - { - "account_head": "_Test Account VAT - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "VAT", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 12.5 - }, - { - "account_head": "_Test Account Discount - _TC", - "add_deduct_tax": "Deduct", - "category": "Total", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Discount", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 10, - "row_id": 7 - } - ], - "supplier": "_Test Supplier", - "supplier_name": "_Test Supplier" - }, - - - - { - "bill_no": "NA", - "buying_price_list": "_Test Price List", - "company": "_Test Company", - "conversion_rate": 1.0, - "credit_to": "_Test Payable - _TC", - "currency": "INR", - "doctype": "Purchase Invoice", - "items": [ - { - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Purchase Invoice Item", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item", - "item_name": "_Test Item", - "parentfield": "items", - "qty": 10.0, - "rate": 50.0, - "uom": "_Test UOM" - } - ], - "grand_total": 0, - "naming_series": "T-PINV-", - "taxes": [ - { - "account_head": "_Test Account Shipping Charges - _TC", - "add_deduct_tax": "Add", - "category": "Valuation and Total", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Shipping Charges", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "tax_amount": 100.0 - }, - { - "account_head": "_Test Account VAT - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "VAT", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "tax_amount": 120.0 - }, - { - "account_head": "_Test Account Customs Duty - _TC", - "add_deduct_tax": "Add", - "category": "Valuation", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Customs Duty", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "tax_amount": 150.0 - } - ], - "supplier": "_Test Supplier", - "supplier_name": "_Test Supplier" - } -] diff --git a/erpnext/accounts/doctype/sales_invoice/test_records.json b/erpnext/accounts/doctype/sales_invoice/test_records.json deleted file mode 100644 index 814c6757d38..00000000000 --- a/erpnext/accounts/doctype/sales_invoice/test_records.json +++ /dev/null @@ -1,387 +0,0 @@ -[ - { - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "cost_center": "_Test Cost Center - _TC", - "customer": "_Test Customer", - "customer_name": "_Test Customer", - "debit_to": "Debtors - _TC", - "doctype": "Sales Invoice", - "items": [ - { - "amount": 500.0, - "base_amount": 500.0, - "base_rate": 500.0, - "cost_center": "_Test Cost Center - _TC", - "description": "138-CMS Shoe", - "doctype": "Sales Invoice Item", - "income_account": "Sales - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "138-CMS Shoe", - "item_name": "138-CMS Shoe", - "parentfield": "items", - "qty": 1.0, - "rate": 500.0, - "uom": "_Test UOM", - "conversion_factor": 1, - "stock_uom": "_Test UOM" - } - ], - "base_grand_total": 561.8, - "grand_total": 561.8, - "is_pos": 0, - "naming_series": "T-SINV-", - "base_net_total": 500.0, - "taxes": [ - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "cost_center": "_Test Cost Center - _TC", - "rate": 6 - }, - { - "account_head": "_Test Account Service Tax - _TC", - "charge_type": "On Net Total", - "description": "Service Tax", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "cost_center": "_Test Cost Center - _TC", - "rate": 6.36 - } - ], - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", - "selling_price_list": "_Test Price List", - "territory": "_Test Territory" - }, - { - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "customer": "_Test Customer", - "customer_name": "_Test Customer", - "debit_to": "Debtors - _TC", - "doctype": "Sales Invoice", - "cost_center": "_Test Cost Center - _TC", - "items": [ - { - "amount": 500.0, - "base_amount": 500.0, - "base_rate": 500.0, - "cost_center": "_Test Cost Center - _TC", - "description": "_Test Item", - "doctype": "Sales Invoice Item", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "income_account": "Sales - _TC", - "item_code": "_Test Item", - "item_name": "_Test Item", - "parentfield": "items", - "price_list_rate": 500.0, - "qty": 1.0, - "uom": "_Test UOM", - "conversion_factor": 1, - "stock_uom": "_Test UOM" - } - ], - "base_grand_total": 630.0, - "grand_total": 630.0, - "is_pos": 0, - "naming_series": "T-SINV-", - "base_net_total": 500.0, - "taxes": [ - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "cost_center": "_Test Cost Center - _TC", - "rate": 16 - }, - { - "account_head": "_Test Account Service Tax - _TC", - "charge_type": "On Net Total", - "description": "Service Tax", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "cost_center": "_Test Cost Center - _TC", - "rate": 10 - } - ], - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", - "selling_price_list": "_Test Price List", - "territory": "_Test Territory" - }, - { - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "customer": "_Test Customer", - "customer_name": "_Test Customer", - "debit_to": "Debtors - _TC", - "doctype": "Sales Invoice", - "cost_center": "_Test Cost Center - _TC", - "items": [ - { - "cost_center": "_Test Cost Center - _TC", - "doctype": "Sales Invoice Item", - "income_account": "Sales - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item Home Desktop 100", - "item_name": "_Test Item Home Desktop 100", - "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", - "parentfield": "items", - "price_list_rate": 50, - "qty": 10, - "rate": 50, - "uom": "_Test UOM 1", - "conversion_factor": 1, - "stock_uom": "_Test UOM 1" - }, - { - "cost_center": "_Test Cost Center - _TC", - "doctype": "Sales Invoice Item", - "income_account": "Sales - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item Home Desktop 200", - "item_name": "_Test Item Home Desktop 200", - "parentfield": "items", - "price_list_rate": 150, - "qty": 5, - "uom": "_Test UOM", - "conversion_factor": 1, - "rate": 150, - "stock_uom": "_Test UOM" - } - ], - "grand_total": 0, - "is_pos": 0, - "naming_series": "T-SINV-", - "taxes": [ - { - "account_head": "_Test Account Shipping Charges - _TC", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Shipping Charges", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "tax_amount": 100 - }, - { - "account_head": "_Test Account Customs Duty - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Customs Duty", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 10 - }, - { - "account_head": "_Test Account Excise Duty - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Excise Duty", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 12 - }, - { - "account_head": "_Test Account Education Cess - _TC", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "Education Cess", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 2, - "row_id": 3 - }, - { - "account_head": "_Test Account S&H Education Cess - _TC", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "S&H Education Cess", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 1, - "row_id": 3 - }, - { - "account_head": "_Test Account CST - _TC", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "CST", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 2, - "row_id": 5 - }, - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 12.5 - }, - { - "account_head": "_Test Account Discount - _TC", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Discount", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": -10, - "row_id": 7 - } - ], - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", - "selling_price_list": "_Test Price List", - "territory": "_Test Territory" - }, - { - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "customer": "_Test Customer", - "customer_name": "_Test Customer", - "debit_to": "Debtors - _TC", - "doctype": "Sales Invoice", - "cost_center": "_Test Cost Center - _TC", - "items": [ - { - "cost_center": "_Test Cost Center - _TC", - "doctype": "Sales Invoice Item", - "income_account": "Sales - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item Home Desktop 100", - "item_name": "_Test Item Home Desktop 100", - "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", - "parentfield": "items", - "price_list_rate": 62.5, - "qty": 10, - "uom": "_Test UOM 1", - "conversion_factor": 1, - "stock_uom": "_Test UOM 1" - }, - { - "cost_center": "_Test Cost Center - _TC", - "doctype": "Sales Invoice Item", - "income_account": "Sales - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item Home Desktop 200", - "item_name": "_Test Item Home Desktop 200", - "parentfield": "items", - "price_list_rate": 190.66, - "qty": 5, - "uom": "_Test UOM", - "conversion_factor": 1, - "stock_uom": "_Test UOM" - } - ], - "grand_total": 0, - "is_pos": 0, - "naming_series": "T-SINV-", - "taxes": [ - { - "account_head": "_Test Account Excise Duty - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Excise Duty", - "doctype": "Sales Taxes and Charges", - "idx": 1, - "included_in_print_rate": 1, - "parentfield": "taxes", - "rate": 12 - }, - { - "account_head": "_Test Account Education Cess - _TC", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "Education Cess", - "doctype": "Sales Taxes and Charges", - "idx": 2, - "included_in_print_rate": 1, - "parentfield": "taxes", - "rate": 2, - "row_id": 1 - }, - { - "account_head": "_Test Account S&H Education Cess - _TC", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "S&H Education Cess", - "doctype": "Sales Taxes and Charges", - "idx": 3, - "included_in_print_rate": 1, - "parentfield": "taxes", - "rate": 1, - "row_id": 1 - }, - { - "account_head": "_Test Account CST - _TC", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "CST", - "doctype": "Sales Taxes and Charges", - "idx": 4, - "included_in_print_rate": 1, - "parentfield": "taxes", - "rate": 2, - "row_id": 3 - }, - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "idx": 5, - "included_in_print_rate": 1, - "parentfield": "taxes", - "rate": 12.5 - }, - { - "account_head": "_Test Account Customs Duty - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Customs Duty", - "doctype": "Sales Taxes and Charges", - "idx": 6, - "parentfield": "taxes", - "rate": 10 - }, - { - "account_head": "_Test Account Shipping Charges - _TC", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Shipping Charges", - "doctype": "Sales Taxes and Charges", - "idx": 7, - "parentfield": "taxes", - "tax_amount": 100 - }, - { - "account_head": "_Test Account Discount - _TC", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Discount", - "doctype": "Sales Taxes and Charges", - "idx": 8, - "parentfield": "taxes", - "rate": -10, - "row_id": 7 - } - ], - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", - "selling_price_list": "_Test Price List", - "territory": "_Test Territory" - } -] diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_records.json b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_records.json deleted file mode 100644 index 74db08d5b86..00000000000 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_records.json +++ /dev/null @@ -1,209 +0,0 @@ -[ - { - "company": "_Test Company", - "doctype": "Sales Taxes and Charges Template", - "taxes": [ - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "cost_center": "Main - _TC", - "parentfield": "taxes", - "rate": 6 - }, - { - "account_head": "_Test Account Service Tax - _TC", - "charge_type": "On Net Total", - "description": "Service Tax", - "doctype": "Sales Taxes and Charges", - "cost_center": "Main - _TC", - "parentfield": "taxes", - "rate": 6.36 - } - ], - "title": "_Test Sales Taxes and Charges Template" - }, - { - "company": "_Test Company", - "doctype": "Sales Taxes and Charges Template", - "taxes": [ - { - "account_head": "_Test Account Shipping Charges - _TC", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Shipping Charges", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "tax_amount": 100 - }, - { - "account_head": "_Test Account Customs Duty - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Customs Duty", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 10 - }, - { - "account_head": "_Test Account Excise Duty - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Excise Duty", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 12 - }, - { - "account_head": "_Test Account Education Cess - _TC", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "Education Cess", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 2, - "row_id": 3 - }, - { - "account_head": "_Test Account S&H Education Cess - _TC", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "S&H Education Cess", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 1, - "row_id": 3 - }, - { - "account_head": "_Test Account CST - _TC", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "CST", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 2, - "row_id": 5 - }, - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": 12.5 - }, - { - "account_head": "_Test Account Discount - _TC", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Discount", - "doctype": "Sales Taxes and Charges", - "parentfield": "taxes", - "rate": -10, - "row_id": 7 - } - ], - "title": "_Test India Tax Master" - }, - { - "company": "_Test Company", - "doctype": "Sales Taxes and Charges Template", - "taxes": [ - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "cost_center": "Main - _TC", - "parentfield": "taxes", - "rate": 12 - }, - { - "account_head": "_Test Account Service Tax - _TC", - "charge_type": "On Net Total", - "description": "Service Tax", - "doctype": "Sales Taxes and Charges", - "cost_center": "Main - _TC", - "parentfield": "taxes", - "rate": 4 - } - ], - "title": "_Test Sales Taxes and Charges Template - Rest of the World" - }, - { - "company": "_Test Company", - "doctype": "Sales Taxes and Charges Template", - "taxes": [ - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "cost_center": "Main - _TC", - "parentfield": "taxes", - "rate": 12 - }, - { - "account_head": "_Test Account Service Tax - _TC", - "charge_type": "On Net Total", - "description": "Service Tax", - "doctype": "Sales Taxes and Charges", - "cost_center": "Main - _TC", - "parentfield": "taxes", - "rate": 4 - } - ], - "title": "_Test Sales Taxes and Charges Template 1" - }, - { - "company": "_Test Company", - "doctype": "Sales Taxes and Charges Template", - "taxes": [ - { - "account_head": "_Test Account VAT - _TC", - "charge_type": "On Net Total", - "description": "VAT", - "doctype": "Sales Taxes and Charges", - "cost_center": "Main - _TC", - "parentfield": "taxes", - "rate": 12 - }, - { - "account_head": "_Test Account Service Tax - _TC", - "charge_type": "On Net Total", - "description": "Service Tax", - "doctype": "Sales Taxes and Charges", - "cost_center": "Main - _TC", - "parentfield": "taxes", - "rate": 4 - } - ], - "title": "_Test Sales Taxes and Charges Template 2" - }, - { - "doctype" : "Sales Taxes and Charges Template", - "title": "_Test Tax 1", - "company": "_Test Company", - "taxes":[{ - "charge_type": "Actual", - "account_head": "Sales Expenses - _TC", - "cost_center": "Main - _TC", - "description": "Test Shopping cart taxes with Tax Rule", - "tax_amount": 1000 - }] - }, - { - "doctype" : "Sales Taxes and Charges Template", - "title": "_Test Tax 2", - "company": "_Test Company", - "taxes":[{ - "charge_type": "Actual", - "account_head": "Sales Expenses - _TC", - "cost_center": "Main - _TC", - "description": "Test Shopping cart taxes with Tax Rule", - "tax_amount": 200 - }] - } -] diff --git a/erpnext/accounts/doctype/share_type/test_records.json b/erpnext/accounts/doctype/share_type/test_records.json deleted file mode 100644 index 88cb8c056fe..00000000000 --- a/erpnext/accounts/doctype/share_type/test_records.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "doctype": "Share Type", - "title": "Class A" - }, - { - "doctype": "Share Type", - "title": "Class B" - } -] \ No newline at end of file diff --git a/erpnext/accounts/doctype/shareholder/test_records.json b/erpnext/accounts/doctype/shareholder/test_records.json deleted file mode 100644 index 39b72d47770..00000000000 --- a/erpnext/accounts/doctype/shareholder/test_records.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "doctype": "Shareholder", - "naming_series": "SH-", - "title": "Iron Man", - "company": "_Test Company" - }, - { - "doctype": "Shareholder", - "naming_series": "SH-", - "title": "Thor", - "company": "_Test Company" - }, - { - "doctype": "Shareholder", - "naming_series": "SH-", - "title": "Hulk", - "company": "_Test Company" - } -] \ No newline at end of file diff --git a/erpnext/accounts/doctype/shipping_rule/test_records.json b/erpnext/accounts/doctype/shipping_rule/test_records.json deleted file mode 100644 index 26b37374433..00000000000 --- a/erpnext/accounts/doctype/shipping_rule/test_records.json +++ /dev/null @@ -1,108 +0,0 @@ -[ - { - "account": "_Test Account Shipping Charges - _TC", - "calculate_based_on": "Net Total", - "company": "_Test Company", - "cost_center": "_Test Cost Center - _TC", - "doctype": "Shipping Rule", - "label": "_Test Shipping Rule", - "name": "_Test Shipping Rule", - "shipping_rule_type": "Selling", - "conditions": [ - { - "doctype": "Shipping Rule Condition", - "from_value": 0, - "parentfield": "conditions", - "shipping_amount": 50.0, - "to_value": 100 - }, - { - "doctype": "Shipping Rule Condition", - "from_value": 101, - "parentfield": "conditions", - "shipping_amount": 100.0, - "to_value": 200 - }, - { - "doctype": "Shipping Rule Condition", - "from_value": 201, - "parentfield": "conditions", - "shipping_amount": 200.0 - } - ], - "countries": [ - {"country": "India"} - ], - "worldwide_shipping": 1 - }, - { - "account": "_Test Account Shipping Charges - _TC", - "calculate_based_on": "Net Total", - "company": "_Test Company", - "cost_center": "_Test Cost Center - _TC", - "doctype": "Shipping Rule", - "label": "_Test Shipping Rule - India", - "name": "_Test Shipping Rule - India", - "conditions": [ - { - "doctype": "Shipping Rule Condition", - "from_value": 0, - "parentfield": "conditions", - "shipping_amount": 50.0, - "to_value": 100 - }, - { - "doctype": "Shipping Rule Condition", - "from_value": 101, - "parentfield": "conditions", - "shipping_amount": 100.0, - "to_value": 200 - }, - { - "doctype": "Shipping Rule Condition", - "from_value": 201, - "parentfield": "conditions", - "shipping_amount": 0.0 - } - ], - "countries": [ - {"country": "India"} - ] - }, - { - "account": "_Test Account Shipping Charges - _TC", - "calculate_based_on": "Net Total", - "company": "_Test Company", - "cost_center": "_Test Cost Center - _TC", - "doctype": "Shipping Rule", - "label": "_Test Shipping Rule - Rest of the World", - "name": "_Test Shipping Rule - Rest of the World", - "shipping_rule_type": "Buying", - "conditions": [ - { - "doctype": "Shipping Rule Condition", - "from_value": 0, - "parentfield": "conditions", - "shipping_amount": 500.0, - "to_value": 1000 - }, - { - "doctype": "Shipping Rule Condition", - "from_value": 1001, - "parentfield": "conditions", - "shipping_amount": 1000.0, - "to_value": 2000 - }, - { - "doctype": "Shipping Rule Condition", - "from_value": 2001, - "parentfield": "conditions", - "shipping_amount": 1500.0 - } - ], - "worldwide_shipping": 1, - "countries": [ - {"country": "Germany"} - ] - } -] diff --git a/erpnext/accounts/doctype/tax_category/test_records.json b/erpnext/accounts/doctype/tax_category/test_records.json deleted file mode 100644 index 1bb7f5ed876..00000000000 --- a/erpnext/accounts/doctype/tax_category/test_records.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "doctype": "Tax Category", - "title": "_Test Tax Category 1" - }, - { - "doctype": "Tax Category", - "title": "_Test Tax Category 2" - }, - { - "doctype": "Tax Category", - "title": "_Test Tax Category 3" - } -] diff --git a/erpnext/accounts/doctype/tax_rule/test_records.json b/erpnext/accounts/doctype/tax_rule/test_records.json deleted file mode 100644 index e80b12f73ea..00000000000 --- a/erpnext/accounts/doctype/tax_rule/test_records.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "doctype": "Tax Rule", - "tax_type" : "Sales", - "sales_tax_template": "_Test Tax 1 - _TC", - "use_for_shopping_cart": 1, - "billing_city": "_Test City", - "billing_state": "Test State", - "billing_country": "India", - "shipping_city": "_Test City", - "shipping_country": "India", - "priority": 1, - "company": "_Test Company" - }, - { - "doctype": "Tax Rule", - "tax_type" : "Sales", - "sales_tax_template": "_Test Tax 2 - _TC", - "use_for_shopping_cart": 0, - "billing_city": "_Test City", - "billing_country": "India", - "shipping_city": "_Test City", - "shipping_state": "Test State", - "shipping_country": "India", - "priority": 2, - "company": "_Test Company" - } -] \ No newline at end of file diff --git a/erpnext/assets/doctype/asset_maintenance/test_records.json b/erpnext/assets/doctype/asset_maintenance/test_records.json deleted file mode 100644 index 8306fad6cba..00000000000 --- a/erpnext/assets/doctype/asset_maintenance/test_records.json +++ /dev/null @@ -1,68 +0,0 @@ -[ - { - "doctype": "Asset Category", - "asset_category_name": "Equipment", - "total_number_of_depreciations": 3, - "frequency_of_depreciation": 3, - "accounts": [ - { - "company_name": "_Test Company", - "fixed_asset_account": "_Test Fixed Asset - _TC", - "accumulated_depreciation_account": "_Test Accumulated Depreciations - _TC", - "depreciation_expense_account": "_Test Depreciations - _TC" - } - ] - }, - { - "doctype": "Location", - "location_name": "Test Location" - }, - { - "doctype": "Role", - "role_name": "Technician" - }, - { - "doctype": "User", - "email": "marcus@abc.com", - "first_name": "marcus@abc.com", - "new_password": "password", - "roles": [{"doctype": "Has Role", "role": "Technician"}] - }, - { - "doctype": "User", - "email": "thalia@abc.com", - "first_name": "thalia@abc.com", - "new_password": "password", - "roles": [{"doctype": "Has Role", "role": "Technician"}] - }, - { - "doctype": "User", - "email": "mathias@abc.com", - "first_name": "mathias@abc.com", - "new_password": "password", - "roles": [{"doctype": "Has Role", "role": "Technician"}] - }, - { - "doctype": "Asset Maintenance Team", - "maintenance_manager": "marcus@abc.com", - "maintenance_team_name": "Team Awesome", - "company": "_Test Company", - "maintenance_team_members": [ - {"team_member": "marcus@abc.com", "full_name": "marcus@abc.com", "maintenance_role": "Technician"}, - {"team_member": "thalia@abc.com", "full_name": "thalia@abc.com", "maintenance_role": "Technician"}, - {"team_member": "mathias@abc.com", "full_name": "mathias@abc.com", "maintenance_role": "Technician"} - ] - }, - { - "doctype": "Item", - "item_code": "Photocopier", - "item_name": "Photocopier", - "item_group": "All Item Groups", - "company": "_Test Company", - "is_fixed_asset": 1, - "is_stock_item": 0, - "asset_category": "Equipment", - "auto_create_assets": 1, - "asset_naming_series": "ABC.###" - } -] diff --git a/erpnext/assets/doctype/location/test_records.json b/erpnext/assets/doctype/location/test_records.json deleted file mode 100644 index 8a89cf8bdd3..00000000000 --- a/erpnext/assets/doctype/location/test_records.json +++ /dev/null @@ -1,44 +0,0 @@ -[ - { - "doctype": "Location", - "location_name": "Test Location Area", - "is_group": 1, - "is_container": 1 - }, - { - "doctype": "Location", - "location_name": "Basil Farm", - "location": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"point_type\":\"circle\",\"radius\":884.5625420736483},\"geometry\":{\"type\":\"Point\",\"coordinates\":[72.875834,19.100566]}}]}", - "parent_location": "Test Location Area", - "parent": "Test Location Area", - "is_group": 1, - "is_container": 1 - }, - { - "doctype": "Location", - "location_name": "Division 1", - "location": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"point_type\":\"circle\",\"radius\":542.3424997060739},\"geometry\":{\"type\":\"Point\",\"coordinates\":[72.852359,19.11557]}}]}", - "parent_location": "Basil Farm", - "parent": "Basil Farm", - "is_group": 1, - "is_container": 1 - }, - { - "doctype": "Location", - "location_name": "Field 1", - "location": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[72.846758,19.118287],[72.846758,19.121206],[72.850535,19.121206],[72.850535,19.118287],[72.846758,19.118287]]]}}]}", - "parent_location": "Division 1", - "parent": "Division 1", - "is_group": 1, - "is_container": 1 - }, - { - "doctype": "Location", - "location_name": "Block 1", - "location": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[72.921495,19.073313],[72.924929,19.068121],[72.934713,19.06585],[72.929392,19.05579],[72.94158,19.056926],[72.951365,19.095213],[72.921495,19.073313]]]}}]}", - "parent_location": "Field 1", - "parent": "Field 1", - "is_group": 0, - "is_container": 1 - } -] \ No newline at end of file diff --git a/erpnext/buying/doctype/purchase_order/test_records.json b/erpnext/buying/doctype/purchase_order/test_records.json deleted file mode 100644 index 4df994a68c6..00000000000 --- a/erpnext/buying/doctype/purchase_order/test_records.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "advance_paid": 0.0, - "buying_price_list": "_Test Price List", - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "doctype": "Purchase Order", - "base_grand_total": 5000.0, - "grand_total": 5000.0, - "is_subcontracted": 0, - "naming_series": "_T-Purchase Order-", - "base_net_total": 5000.0, - "items": [ - { - "base_amount": 5000.0, - "conversion_factor": 1.0, - "description": "_Test Item", - "doctype": "Purchase Order Item", - "item_code": "_Test Item", - "item_name": "_Test Item", - "parentfield": "items", - "qty": 10.0, - "rate": 500.0, - "schedule_date": "2013-03-01", - "stock_uom": "_Test UOM", - "uom": "_Test UOM", - "warehouse": "_Test Warehouse - _TC" - } - ], - "supplier": "_Test Supplier", - "supplier_name": "_Test Supplier", - "transaction_date": "2013-02-12", - "schedule_date": "2013-02-13" - } -] diff --git a/erpnext/buying/doctype/supplier/test_records.json b/erpnext/buying/doctype/supplier/test_records.json deleted file mode 100644 index 1bb9899cc85..00000000000 --- a/erpnext/buying/doctype/supplier/test_records.json +++ /dev/null @@ -1,50 +0,0 @@ -[ - { - "doctype": "Supplier", - "supplier_name": "_Test Supplier With Template 1", - "supplier_group": "_Test Supplier Group", - "payment_terms": "_Test Payment Term Template 3" - }, - { - "doctype": "Supplier", - "supplier_name": "_Test Supplier P", - "supplier_group": "_Test Supplier Group" - }, - { - "doctype": "Supplier", - "supplier_name": "_Test Supplier with Country", - "supplier_group": "_Test Supplier Group", - "country": "Greece" - }, - { - "doctype": "Supplier", - "supplier_name": "_Test Supplier", - "supplier_group": "_Test Supplier Group" - }, - { - "doctype": "Supplier", - "supplier_name": "_Test Supplier 1", - "supplier_group": "_Test Supplier Group" - }, - { - "doctype": "Supplier", - "supplier_name": "_Test Supplier 2", - "supplier_group": "_Test Supplier Group" - }, - { - "doctype": "Supplier", - "supplier_name": "_Test Supplier USD", - "supplier_group": "_Test Supplier Group", - "default_currency": "USD", - "accounts": [{ - "company": "_Test Company", - "account": "_Test Payable USD - _TC" - }] - }, - { - "doctype": "Supplier", - "supplier_name": "_Test Supplier With Tax Category", - "supplier_group": "_Test Supplier Group", - "tax_category": "_Test Tax Category 1" - } -] diff --git a/erpnext/buying/doctype/supplier_quotation/test_records.json b/erpnext/buying/doctype/supplier_quotation/test_records.json deleted file mode 100644 index 8acac3210d5..00000000000 --- a/erpnext/buying/doctype/supplier_quotation/test_records.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "buying_price_list": "_Test Price List", - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "doctype": "Supplier Quotation", - "base_grand_total": 5000.0, - "grand_total": 5000.0, - "is_subcontracted": 0, - "naming_series": "_T-Supplier Quotation-", - "base_net_total": 5000.0, - "items": [ - { - "base_amount": 5000.0, - "description": "_Test FG Item", - "doctype": "Supplier Quotation Item", - "item_code": "_Test FG Item", - "item_name": "_Test FG Item", - "parentfield": "items", - "qty": 10.0, - "rate": 500.0, - "uom": "_Test UOM", - "warehouse": "_Test Warehouse - _TC" - } - ], - "supplier": "_Test Supplier", - "supplier_name": "_Test Supplier", - "transaction_date": "2013-02-12" - } -] \ No newline at end of file diff --git a/erpnext/maintenance/doctype/maintenance_visit/test_records.json b/erpnext/maintenance/doctype/maintenance_visit/test_records.json deleted file mode 100644 index 0d4f101c7a3..00000000000 --- a/erpnext/maintenance/doctype/maintenance_visit/test_records.json +++ /dev/null @@ -1,2 +0,0 @@ -[ -] diff --git a/erpnext/manufacturing/doctype/operation/test_records.json b/erpnext/manufacturing/doctype/operation/test_records.json deleted file mode 100644 index 5a24d440653..00000000000 --- a/erpnext/manufacturing/doctype/operation/test_records.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "doctype": "Operation", - "name": "_Test Operation 1", - "workstation": "_Test Workstation 1" - } -] diff --git a/erpnext/manufacturing/doctype/work_order/test_records.json b/erpnext/manufacturing/doctype/work_order/test_records.json deleted file mode 100644 index e7c7039ed43..00000000000 --- a/erpnext/manufacturing/doctype/work_order/test_records.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "bom_no": "BOM-_Test FG Item-001", - "company": "_Test Company", - "doctype": "Work Order", - "fg_warehouse": "_Test Warehouse 1 - _TC", - "production_item": "_Test FG Item", - "qty": 10.0, - "stock_uom": "_Test UOM", - "wip_warehouse": "_Test Warehouse - _TC" - } -] \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/workstation/test_records.json b/erpnext/manufacturing/doctype/workstation/test_records.json deleted file mode 100644 index 6d54cb29127..00000000000 --- a/erpnext/manufacturing/doctype/workstation/test_records.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "doctype": "Workstation", - "name": "_Test Workstation 1", - "workstation_name": "_Test Workstation 1", - "warehouse": "_Test warehouse - _TC", - "hour_rate_labour": 25, - "hour_rate_electricity": 25, - "hour_rate_consumable": 25, - "hour_rate_rent": 25, - "holiday_list": "_Test Holiday List", - "working_hours": [ - { - "start_time": "10:00:00", - "end_time": "20:00:00" - } - ] - } -] diff --git a/erpnext/projects/doctype/activity_cost/test_records.json b/erpnext/projects/doctype/activity_cost/test_records.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/erpnext/projects/doctype/activity_cost/test_records.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/erpnext/projects/doctype/activity_type/test_records.json b/erpnext/projects/doctype/activity_type/test_records.json deleted file mode 100644 index 45fc1496fbe..00000000000 --- a/erpnext/projects/doctype/activity_type/test_records.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "activity_type": "_Test Activity Type" - }, - { - "activity_type": "_Test Activity Type 1" - }, - { - "activity_type": "_Test Activity Type 2" - } -] \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/test_records.json b/erpnext/selling/doctype/customer/test_records.json deleted file mode 100644 index 6040f4dd75b..00000000000 --- a/erpnext/selling/doctype/customer/test_records.json +++ /dev/null @@ -1,64 +0,0 @@ -[ - { - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer With Template", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory" - }, - { - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer P", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory" - }, - { - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory" - }, - { - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer 1", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory" - }, - { - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer 2", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory" - }, - { - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer 3", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory" - }, - { - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer USD", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory", - "default_currency": "USD", - "accounts": [{ - "company": "_Test Company", - "account": "_Test Receivable USD - _TC" - }] - }, - { - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer With Tax Category", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory", - "tax_category": "_Test Tax Category 1" - } -] diff --git a/erpnext/selling/doctype/industry_type/test_records.json b/erpnext/selling/doctype/industry_type/test_records.json deleted file mode 100644 index 2b593bb3ac2..00000000000 --- a/erpnext/selling/doctype/industry_type/test_records.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "doctype": "Industry Type", - "industry": "_Test Industry" - }, - { - "doctype": "Industry Type", - "industry": "_Test Industry 1" - } -] \ No newline at end of file diff --git a/erpnext/selling/doctype/installation_note/test_records.json b/erpnext/selling/doctype/installation_note/test_records.json deleted file mode 100644 index 0d4f101c7a3..00000000000 --- a/erpnext/selling/doctype/installation_note/test_records.json +++ /dev/null @@ -1,2 +0,0 @@ -[ -] diff --git a/erpnext/selling/doctype/product_bundle/test_records.json b/erpnext/selling/doctype/product_bundle/test_records.json deleted file mode 100644 index b92892f1bf4..00000000000 --- a/erpnext/selling/doctype/product_bundle/test_records.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "doctype": "Product Bundle", - "new_item_code": "_Test Product Bundle Item", - "items": [ - { - "doctype": "Product Bundle Item", - "item_code": "_Test Item", - "parentfield": "items", - "qty": 5.0 - }, - { - "doctype": "Product Bundle Item", - "item_code": "_Test Item Home Desktop 100", - "parentfield": "items", - "qty": 2.0 - } - ] - } -] \ No newline at end of file diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json deleted file mode 100644 index 1564f7de0ce..00000000000 --- a/erpnext/selling/doctype/quotation/test_records.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - { - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "party_name": "_Test Customer", - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer", - "doctype": "Quotation", - "base_grand_total": 1000.0, - "grand_total": 1000.0, - "order_type": "Sales", - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", - "items": [ - { - "base_amount": 1000.0, - "base_rate": 100.0, - "description": "CPU", - "doctype": "Quotation Item", - "item_code": "_Test Item Home Desktop 100", - "item_name": "CPU", - "parentfield": "items", - "qty": 10.0, - "rate": 100.0, - "uom": "_Test UOM 1", - "stock_uom": "_Test UOM 1", - "conversion_factor": 1.0 - } - ], - "quotation_to": "Customer", - "selling_price_list": "_Test Price List", - "territory": "_Test Territory", - "transaction_date": "2013-02-21", - "valid_till": "2013-03-21" - } -] \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_order/test_records.json b/erpnext/selling/doctype/sales_order/test_records.json deleted file mode 100644 index 8a090e6d3d3..00000000000 --- a/erpnext/selling/doctype/sales_order/test_records.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "advance_paid": 0.0, - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "customer": "_Test Customer", - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer", - "doctype": "Sales Order", - "base_grand_total": 1000.0, - "grand_total": 1000.0, - "naming_series": "_T-Sales Order-", - "order_type": "Sales", - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", - "items": [ - { - "base_amount": 1000.0, - "base_rate": 100.0, - "description": "CPU", - "doctype": "Sales Order Item", - "item_code": "_Test Item", - "item_name": "_Test Item 1", - "delivery_date": "2013-02-23", - "parentfield": "items", - "qty": 10.0, - "rate": 100.0, - "warehouse": "_Test Warehouse - _TC", - "stock_uom": "_Test UOM", - "conversion_factor": 1.0, - "uom": "_Test UOM" - } - ], - "selling_price_list": "_Test Price List", - "territory": "_Test Territory", - "transaction_date": "2013-02-21" - } -] \ No newline at end of file diff --git a/erpnext/setup/doctype/branch/test_records.json b/erpnext/setup/doctype/branch/test_records.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/erpnext/setup/doctype/branch/test_records.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/erpnext/setup/doctype/brand/test_records.json b/erpnext/setup/doctype/brand/test_records.json deleted file mode 100644 index eeed9e77334..00000000000 --- a/erpnext/setup/doctype/brand/test_records.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "brand": "_Test Brand", - "doctype": "Brand" - }, - { - "brand": "_Test Brand With Item Defaults", - "doctype": "Brand", - "brand_defaults": [{ - "company": "_Test Company", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "income_account": "_Test Account Sales - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC" - }] - } -] \ No newline at end of file diff --git a/erpnext/setup/doctype/company/test_records.json b/erpnext/setup/doctype/company/test_records.json deleted file mode 100644 index e21bd2a3ce8..00000000000 --- a/erpnext/setup/doctype/company/test_records.json +++ /dev/null @@ -1,109 +0,0 @@ -[ - { - "abbr": "_TC", - "company_name": "_Test Company", - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - "allow_account_creation_against_child_company": 1 - }, - { - "abbr": "_TC1", - "company_name": "_Test Company 1", - "country": "United States", - "default_currency": "USD", - "doctype": "Company", - "domain": "Retail", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0 - }, - { - "abbr": "_TC2", - "company_name": "_Test Company 2", - "default_currency": "EUR", - "country": "Germany", - "doctype": "Company", - "domain": "Retail", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0 - }, - { - "abbr": "_TC3", - "company_name": "_Test Company 3", - "is_group": 1, - "country": "Pakistan", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0 - }, - { - "abbr": "_TC4", - "company_name": "_Test Company 4", - "parent_company": "_Test Company 3", - "is_group": 1, - "country": "Pakistan", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0 - }, - { - "abbr": "_TC5", - "company_name": "_Test Company 5", - "parent_company": "_Test Company 4", - "country": "Pakistan", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0 - }, - { - "abbr": "TCP1", - "company_name": "_Test Company with perpetual inventory", - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "enable_perpetual_inventory": 1, - "default_holiday_list": "_Test Holiday List" - }, - { - "abbr": "_TC6", - "company_name": "_Test Company 6", - "is_group": 1, - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0 - }, - { - "abbr": "_TC7", - "company_name": "_Test Company 7", - "parent_company": "_Test Company 6", - "is_group": 1, - "country": "United States", - "default_currency": "USD", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0 - } -] diff --git a/erpnext/setup/doctype/currency_exchange/test_records.json b/erpnext/setup/doctype/currency_exchange/test_records.json deleted file mode 100644 index 152060edfc4..00000000000 --- a/erpnext/setup/doctype/currency_exchange/test_records.json +++ /dev/null @@ -1,56 +0,0 @@ -[ - { - "doctype": "Currency Exchange", - "date": "2016-01-01", - "exchange_rate": 60.0, - "from_currency": "USD", - "to_currency": "INR", - "for_buying": 1, - "for_selling": 0 - }, - { - "doctype": "Currency Exchange", - "date": "2016-01-01", - "exchange_rate": 0.773, - "from_currency": "USD", - "to_currency": "EUR", - "for_buying": 0, - "for_selling": 1 - }, - { - "doctype": "Currency Exchange", - "date": "2016-01-01", - "exchange_rate": 0.0167, - "from_currency": "INR", - "to_currency": "USD", - "for_buying": 1, - "for_selling": 0 - }, - { - "doctype": "Currency Exchange", - "date": "2016-01-10", - "exchange_rate": 65.1, - "from_currency": "USD", - "to_currency": "INR", - "for_buying": 1, - "for_selling": 0 - }, - { - "doctype": "Currency Exchange", - "date": "2016-01-30", - "exchange_rate": 62.9, - "from_currency": "USD", - "to_currency": "INR", - "for_buying": 1, - "for_selling": 1 - }, - { - "doctype": "Currency Exchange", - "date": "2016-01-10", - "exchange_rate": 65.1, - "from_currency": "INR", - "to_currency": "NGN", - "for_buying": 1, - "for_selling": 1 - } -] diff --git a/erpnext/setup/doctype/customer_group/test_records.json b/erpnext/setup/doctype/customer_group/test_records.json deleted file mode 100644 index 4c472b886a6..00000000000 --- a/erpnext/setup/doctype/customer_group/test_records.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "customer_group_name": "_Test Customer Group", - "doctype": "Customer Group", - "is_group": 0, - "parent_customer_group": "All Customer Groups" - }, - { - "customer_group_name": "_Test Customer Group 1", - "doctype": "Customer Group", - "is_group": 0, - "parent_customer_group": "All Customer Groups" - } -] diff --git a/erpnext/setup/doctype/department/test_records.json b/erpnext/setup/doctype/department/test_records.json deleted file mode 100644 index e3421f28b8d..00000000000 --- a/erpnext/setup/doctype/department/test_records.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - {"doctype":"Department", "department_name":"_Test Department", "company": "_Test Company", "parent_department": "All Departments"}, - {"doctype":"Department", "department_name":"_Test Department 1", "company": "_Test Company", "parent_department": "All Departments"} -] \ No newline at end of file diff --git a/erpnext/setup/doctype/designation/test_records.json b/erpnext/setup/doctype/designation/test_records.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/erpnext/setup/doctype/designation/test_records.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/erpnext/setup/doctype/holiday_list/test_records.json b/erpnext/setup/doctype/holiday_list/test_records.json deleted file mode 100644 index 0bd096c415a..00000000000 --- a/erpnext/setup/doctype/holiday_list/test_records.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "doctype": "Holiday List", - "from_date": "2013-01-01", - "to_date":"2013-12-31", - "holidays": [ - { - "description": "New Year", - "holiday_date": "2013-01-01" - }, - { - "description": "Republic Day", - "holiday_date": "2013-01-26" - }, - { - "description": "Test Holiday", - "holiday_date": "2013-02-01" - } - ], - "holiday_list_name": "_Test Holiday List" - } -] diff --git a/erpnext/setup/doctype/item_group/test_records.json b/erpnext/setup/doctype/item_group/test_records.json deleted file mode 100644 index ce1d718375a..00000000000 --- a/erpnext/setup/doctype/item_group/test_records.json +++ /dev/null @@ -1,108 +0,0 @@ -[ - { - "doctype": "Item Group", - "is_group": 0, - "item_group_name": "_Test Item Group", - "parent_item_group": "All Item Groups", - "item_group_defaults": [{ - "company": "_Test Company", - "buying_cost_center": "_Test Cost Center 2 - _TC", - "selling_cost_center": "_Test Cost Center 2 - _TC", - "default_warehouse": "_Test Warehouse - _TC" - }] - }, - { - "doctype": "Item Group", - "is_group": 0, - "item_group_name": "_Test Item Group Desktops", - "parent_item_group": "All Item Groups" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group A", - "parent_item_group": "All Item Groups" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group B", - "parent_item_group": "All Item Groups" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group B - 1", - "parent_item_group": "_Test Item Group B" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group B - 2", - "parent_item_group": "_Test Item Group B" - }, - { - "doctype": "Item Group", - "is_group": 0, - "item_group_name": "_Test Item Group B - 3", - "parent_item_group": "_Test Item Group B" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group C", - "parent_item_group": "All Item Groups" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group C - 1", - "parent_item_group": "_Test Item Group C" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group C - 2", - "parent_item_group": "_Test Item Group C" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group D", - "parent_item_group": "All Item Groups" - }, - { - "doctype": "Item Group", - "is_group": 1, - "item_group_name": "_Test Item Group Tax Parent", - "parent_item_group": "All Item Groups", - "taxes": [ - { - "doctype": "Item Tax", - "parentfield": "taxes", - "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", - "tax_category": "" - }, - { - "doctype": "Item Tax", - "parentfield": "taxes", - "item_tax_template": "_Test Account Excise Duty @ 12 - _TC", - "tax_category": "_Test Tax Category 1" - } - ] - }, - { - "doctype": "Item Group", - "is_group": 0, - "item_group_name": "_Test Item Group Tax Child Override", - "parent_item_group": "_Test Item Group Tax Parent", - "taxes": [ - { - "doctype": "Item Tax", - "parentfield": "taxes", - "item_tax_template": "_Test Account Excise Duty @ 15 - _TC", - "tax_category": "" - } - ] - } -] diff --git a/erpnext/setup/doctype/quotation_lost_reason/test_records.json b/erpnext/setup/doctype/quotation_lost_reason/test_records.json deleted file mode 100644 index 29f04de0081..00000000000 --- a/erpnext/setup/doctype/quotation_lost_reason/test_records.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "doctype": "Quotation Lost Reason", - "order_lost_reason": "_Test Quotation Lost Reason" - } -] \ No newline at end of file diff --git a/erpnext/setup/doctype/sales_partner/test_records.json b/erpnext/setup/doctype/sales_partner/test_records.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/erpnext/setup/doctype/sales_partner/test_records.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/erpnext/setup/doctype/supplier_group/test_records.json b/erpnext/setup/doctype/supplier_group/test_records.json deleted file mode 100644 index 58489637c3c..00000000000 --- a/erpnext/setup/doctype/supplier_group/test_records.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "doctype": "Supplier Group", - "supplier_group_name": "_Test Supplier Group", - "parent_supplier_group": "All Supplier Groups" - } -] - \ No newline at end of file diff --git a/erpnext/setup/doctype/terms_and_conditions/test_records.json b/erpnext/setup/doctype/terms_and_conditions/test_records.json deleted file mode 100644 index 9ba107706ca..00000000000 --- a/erpnext/setup/doctype/terms_and_conditions/test_records.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "terms": "_Test Terms", - "title": "_Test Terms and Conditions" - } -] \ No newline at end of file diff --git a/erpnext/setup/doctype/territory/test_records.json b/erpnext/setup/doctype/territory/test_records.json deleted file mode 100644 index 6011a388646..00000000000 --- a/erpnext/setup/doctype/territory/test_records.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "doctype": "Territory", - "is_group": 0, - "parent_territory": "All Territories", - "territory_name": "_Test Territory" - }, - { - "doctype": "Territory", - "is_group": 1, - "parent_territory": "All Territories", - "territory_name": "_Test Territory India" - }, - { - "doctype": "Territory", - "is_group": 0, - "parent_territory": "_Test Territory India", - "territory_name": "_Test Territory Maharashtra" - }, - { - "doctype": "Territory", - "is_group": 0, - "parent_territory": "All Territories", - "territory_name": "_Test Territory Rest Of The World" - }, - { - "doctype": "Territory", - "is_group": 0, - "parent_territory": "All Territories", - "territory_name": "_Test Territory United States" - } -] \ No newline at end of file diff --git a/erpnext/setup/doctype/uom/test_records.json b/erpnext/setup/doctype/uom/test_records.json deleted file mode 100644 index ddca542315d..00000000000 --- a/erpnext/setup/doctype/uom/test_records.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "doctype": "UOM", - "must_be_whole_number": 1, - "uom_name": "_Test UOM" - }, - { - "doctype": "UOM", - "uom_name": "_Test UOM 1" - } -] \ No newline at end of file diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json deleted file mode 100644 index 30eaed272e4..00000000000 --- a/erpnext/stock/doctype/item/test_records.json +++ /dev/null @@ -1,450 +0,0 @@ -[ - { - "description": "_Test Item 1", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item", - "item_group": "_Test Item Group", - "item_name": "_Test Item", - "apply_warehouse_wise_reorder_level": 1, - "opening_stock": 10, - "valuation_rate": 100, - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }], - "reorder_levels": [ - { - "material_request_type": "Purchase", - "warehouse": "_Test Warehouse - _TC", - "warehouse_reorder_level": 20, - "warehouse_reorder_qty": 20 - } - ], - "uoms": [ - { - "uom": "_Test UOM", - "conversion_factor": 1.0 - }, - { - "uom": "_Test UOM 1", - "conversion_factor": 10.0 - } - ], - "stock_uom": "_Test UOM" - }, - { - "description": "_Test Item 2", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item 2", - "item_group": "_Test Item Group", - "item_name": "_Test Item 2", - "stock_uom": "_Test UOM", - "opening_stock": 10, - "valuation_rate": 100, - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Item Home Desktop 100 3", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item Home Desktop 100", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test Item Home Desktop 100", - "valuation_rate": 100, - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }], - "taxes": [ - { - "doctype": "Item Tax", - "parentfield": "taxes", - "item_tax_template": "_Test Account Excise Duty @ 10 - _TC" - } - ], - "stock_uom": "_Test UOM 1" - }, - { - "description": "_Test Item Home Desktop 200 4", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_sub_contracted_item": 0, - "item_code": "_Test Item Home Desktop 200", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test Item Home Desktop 200", - "stock_uom": "_Test UOM 1", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Product Bundle Item 5", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 0, - "is_sub_contracted_item": 0, - "item_code": "_Test Product Bundle Item", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test Product Bundle Item", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test FG Item 6", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 1, - "item_code": "_Test FG Item", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test FG Item", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Non Stock Item 7", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 0, - "is_sub_contracted_item": 0, - "item_code": "_Test Non Stock Item", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test Non Stock Item", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Serialized Item 8", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 1, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Serialized Item", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test Serialized Item", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Serialized Item 9", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 1, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Serialized Item With Series", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test Serialized Item With Series", - "serial_no_series": "ABCD.#####", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Item Home Desktop Manufactured 10", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item Home Desktop Manufactured", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test Item Home Desktop Manufactured", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test FG Item 2 11", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 1, - "item_code": "_Test FG Item 2", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test FG Item 2", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Variant Item 12", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 1, - "item_code": "_Test Variant Item", - "item_group": "_Test Item Group Desktops", - "item_name": "_Test Variant Item", - "stock_uom": "_Test UOM", - "has_variants": 1, - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }], - "attributes": [ - { - "attribute": "Test Size" - } - ], - "apply_warehouse_wise_reorder_level": 1, - "reorder_levels": [ - { - "material_request_type": "Purchase", - "warehouse": "_Test Warehouse - _TC", - "warehouse_reorder_level": 20, - "warehouse_reorder_qty": 20 - } - ] - }, - { - "description": "_Test Item 1", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item Warehouse Group Wise Reorder", - "item_group": "_Test Item Group", - "item_name": "_Test Item Warehouse Group Wise Reorder", - "apply_warehouse_wise_reorder_level": 1, - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse Group-C1 - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }], - "reorder_levels": [ - { - "warehouse_group": "_Test Warehouse Group - _TC", - "material_request_type": "Purchase", - "warehouse": "_Test Warehouse Group-C1 - _TC", - "warehouse_reorder_level": 20, - "warehouse_reorder_qty": 20 - } - ], - "stock_uom": "_Test UOM" - }, - { - "description": "_Test Item With Item Tax Template", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item With Item Tax Template", - "item_group": "_Test Item Group", - "item_name": "_Test Item With Item Tax Template", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }], - "taxes": [ - { - "doctype": "Item Tax", - "parentfield": "taxes", - "item_tax_template": "_Test Account Excise Duty @ 10 - _TC" - }, - { - "doctype": "Item Tax", - "parentfield": "taxes", - "item_tax_template": "_Test Account Excise Duty @ 12 - _TC", - "tax_category": "_Test Tax Category 1" - } - ] - }, - { - "description": "_Test Item Inherit Group Item Tax Template 1", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item Inherit Group Item Tax Template 1", - "item_group": "_Test Item Group Tax Parent", - "item_name": "_Test Item Inherit Group Item Tax Template 1", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Item Inherit Group Item Tax Template 2", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item Inherit Group Item Tax Template 2", - "item_group": "_Test Item Group Tax Child Override", - "item_name": "_Test Item Inherit Group Item Tax Template 2", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }] - }, - { - "description": "_Test Item Override Group Item Tax Template", - "doctype": "Item", - "has_batch_no": 0, - "has_serial_no": 0, - "inspection_required": 0, - "is_stock_item": 1, - "is_sub_contracted_item": 0, - "item_code": "_Test Item Override Group Item Tax Template", - "item_group": "_Test Item Group Tax Child Override", - "item_name": "_Test Item Override Group Item Tax Template", - "stock_uom": "_Test UOM", - "item_defaults": [{ - "company": "_Test Company", - "default_warehouse": "_Test Warehouse - _TC", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "buying_cost_center": "_Test Cost Center - _TC", - "selling_cost_center": "_Test Cost Center - _TC", - "income_account": "Sales - _TC" - }], - "taxes": [ - { - "doctype": "Item Tax", - "parentfield": "taxes", - "item_tax_template": "_Test Account Excise Duty @ 20 - _TC" - }, - { - "doctype": "Item Tax", - "parentfield": "taxes", - "tax_category": "_Test Tax Category 1", - "item_tax_template": "_Test Item Tax Template 1 - _TC" - } - ] - }, - { - "description": "_Test", - "doctype": "Item", - "is_stock_item": 1, - "item_code": "138-CMS Shoe", - "item_group": "_Test Item Group", - "item_name": "138-CMS Shoe", - "stock_uom": "_Test UOM" - } -] diff --git a/erpnext/stock/doctype/item_attribute/test_records.json b/erpnext/stock/doctype/item_attribute/test_records.json deleted file mode 100644 index 6aa6ffd6c9b..00000000000 --- a/erpnext/stock/doctype/item_attribute/test_records.json +++ /dev/null @@ -1,25 +0,0 @@ -[ - { - "doctype": "Item Attribute", - "attribute_name": "Test Size", - "priority": 1, - "item_attribute_values": [ - {"attribute_value": "Extra Small", "abbr": "XSL"}, - {"attribute_value": "Small", "abbr": "S"}, - {"attribute_value": "Medium", "abbr": "M"}, - {"attribute_value": "Large", "abbr": "L"}, - {"attribute_value": "Extra Large", "abbr": "XL"}, - {"attribute_value": "2XL", "abbr": "2XL"} - ] - }, - { - "doctype": "Item Attribute", - "attribute_name": "Test Colour", - "priority": 2, - "item_attribute_values": [ - {"attribute_value": "Red", "abbr": "R"}, - {"attribute_value": "Green", "abbr": "G"}, - {"attribute_value": "Blue", "abbr": "B"} - ] - } -] diff --git a/erpnext/stock/doctype/item_price/test_records.json b/erpnext/stock/doctype/item_price/test_records.json deleted file mode 100644 index afe5ad65b75..00000000000 --- a/erpnext/stock/doctype/item_price/test_records.json +++ /dev/null @@ -1,56 +0,0 @@ -[ - { - "doctype": "Item Price", - "item_code": "_Test Item", - "price_list": "_Test Price List", - "price_list_rate": 100, - "valid_from": "2017-04-18", - "valid_upto": "2017-04-26" - }, - { - "doctype": "Item Price", - "item_code": "_Test Item", - "price_list": "_Test Price List Rest of the World", - "price_list_rate": 10 - }, - { - "doctype": "Item Price", - "item_code": "_Test Item 2", - "price_list": "_Test Price List Rest of the World", - "price_list_rate": 20, - "valid_from": "2017-04-18", - "valid_upto": "2017-04-26", - "customer": "_Test Customer", - "uom": "_Test UOM" - }, - { - "doctype": "Item Price", - "item_code": "_Test Item Home Desktop 100", - "price_list": "_Test Price List", - "price_list_rate": 1000, - "valid_from": "2017-04-10", - "valid_upto": "2017-04-17" - }, - { - "doctype": "Item Price", - "item_code": "_Test Item Home Desktop Manufactured", - "price_list": "_Test Price List", - "price_list_rate": 1000, - "valid_from": "2017-04-10", - "valid_upto": "2017-04-17" - }, - { - "doctype": "Item Price", - "item_code": "_Test Item", - "price_list": "_Test Buying Price List", - "price_list_rate": 100, - "supplier": "_Test Supplier" - }, - { - "doctype": "Item Price", - "item_code": "_Test Item", - "price_list": "_Test Selling Price List", - "price_list_rate": 200, - "customer": "_Test Customer" - } -] diff --git a/erpnext/stock/doctype/material_request/test_records.json b/erpnext/stock/doctype/material_request/test_records.json deleted file mode 100644 index 1c714969eb3..00000000000 --- a/erpnext/stock/doctype/material_request/test_records.json +++ /dev/null @@ -1,57 +0,0 @@ -[ - { - "company": "_Test Company", - "doctype": "Material Request", - "fiscal_year": "_Test Fiscal Year 2013", - "items": [ - { - "description": "_Test Item Home Desktop 100", - "doctype": "Material Request Item", - "item_code": "_Test Item Home Desktop 100", - "item_name": "_Test Item Home Desktop 100", - "parentfield": "items", - "qty": 54.0, - "schedule_date": "2013-02-18", - "uom": "_Test UOM 1", - "warehouse": "_Test Warehouse - _TC" - }, - { - "description": "_Test Item Home Desktop 200", - "doctype": "Material Request Item", - "item_code": "_Test Item Home Desktop 200", - "item_name": "_Test Item Home Desktop 200", - "parentfield": "items", - "qty": 3.0, - "schedule_date": "2013-02-19", - "uom": "_Test UOM 1", - "warehouse": "_Test Warehouse - _TC" - } - ], - "material_request_type": "Purchase", - "naming_series": "_T-Material Request-", - "transaction_date": "2013-02-18", - "schedule_date": "2013-02-19" - }, - { - "company": "_Test Company", - "doctype": "Material Request", - "fiscal_year": "_Test Fiscal Year 2013", - "items": [ - { - "description": "_Test FG Item", - "doctype": "Material Request Item", - "item_code": "_Test FG Item", - "item_name": "_Test FG Item", - "parentfield": "items", - "qty": 5, - "schedule_date": "2013-02-19", - "uom": "_Test UOM 1", - "warehouse": "_Test Warehouse - _TC" - } - ], - "material_request_type": "Manufacture", - "naming_series": "_T-Material Request-", - "transaction_date": "2013-02-18", - "schedule_date": "2013-02-19" - } -] \ No newline at end of file diff --git a/erpnext/stock/doctype/price_list/test_records.json b/erpnext/stock/doctype/price_list/test_records.json deleted file mode 100644 index e02a7adbd8b..00000000000 --- a/erpnext/stock/doctype/price_list/test_records.json +++ /dev/null @@ -1,51 +0,0 @@ -[ - { - "buying": 1, - "currency": "INR", - "doctype": "Price List", - "enabled": 1, - "price_not_uom_dependant": 1, - "price_list_name": "_Test Price List", - "selling": 1 - }, - { - "buying": 1, - "currency": "INR", - "doctype": "Price List", - "enabled": 1, - "price_list_name": "_Test Price List 2", - "selling": 1 - }, - { - "buying": 1, - "currency": "INR", - "doctype": "Price List", - "enabled": 1, - "price_list_name": "_Test Price List India", - "selling": 1 - }, - { - "buying": 1, - "currency": "USD", - "doctype": "Price List", - "enabled": 1, - "price_list_name": "_Test Price List Rest of the World", - "selling": 1 - }, - { - "buying": 0, - "currency": "USD", - "doctype": "Price List", - "enabled": 1, - "price_list_name": "_Test Selling Price List", - "selling": 1 - }, - { - "buying": 1, - "currency": "USD", - "doctype": "Price List", - "enabled": 1, - "price_list_name": "_Test Buying Price List", - "selling": 0 - } -] diff --git a/erpnext/stock/doctype/purchase_receipt/test_records.json b/erpnext/stock/doctype/purchase_receipt/test_records.json deleted file mode 100644 index e7ea9af6b9d..00000000000 --- a/erpnext/stock/doctype/purchase_receipt/test_records.json +++ /dev/null @@ -1,87 +0,0 @@ -[ - { - "buying_price_list": "_Test Price List", - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "doctype": "Purchase Receipt", - "base_grand_total": 720.0, - "naming_series": "_T-Purchase Receipt-", - "base_net_total": 500.0, - "taxes": [ - { - "account_head": "_Test Account Shipping Charges - _TC", - "add_deduct_tax": "Add", - "category": "Valuation and Total", - "charge_type": "Actual", - "description": "Shipping Charges", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 100.0, - "tax_amount": 100.0, - "cost_center": "Main - _TC" - }, - { - "account_head": "_Test Account VAT - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "Actual", - "description": "VAT", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 120.0, - "tax_amount": 120.0, - "cost_center": "Main - _TC" - }, - { - "account_head": "_Test Account Customs Duty - _TC", - "add_deduct_tax": "Add", - "category": "Valuation", - "charge_type": "Actual", - "description": "Customs Duty", - "doctype": "Purchase Taxes and Charges", - "parentfield": "taxes", - "rate": 150.0, - "tax_amount": 150.0, - "cost_center": "Main - _TC" - } - ], - "items": [ - { - "base_amount": 250.0, - "conversion_factor": 1.0, - "description": "_Test Item", - "doctype": "Purchase Receipt Item", - "item_code": "_Test Item", - "item_name": "_Test Item", - "parentfield": "items", - "qty": 5.0, - "rate": 50.0, - "received_qty": 5.0, - "rejected_qty": 0.0, - "stock_uom": "_Test UOM", - "uom": "_Test UOM", - "warehouse": "_Test Warehouse - _TC", - "cost_center": "Main - _TC" - }, - { - "base_amount": 250.0, - "conversion_factor": 1.0, - "description": "_Test Item Home Desktop 100", - "doctype": "Purchase Receipt Item", - "item_code": "_Test Item Home Desktop 100", - "item_name": "_Test Item Home Desktop 100", - "parentfield": "items", - "qty": 5.0, - "rate": 50.0, - "received_qty": 5.0, - "rejected_qty": 0.0, - "stock_uom": "_Test UOM", - "uom": "_Test UOM", - "warehouse": "_Test Warehouse 1 - _TC", - "cost_center": "Main - _TC" - } - ], - "supplier": "_Test Supplier" - } -] \ No newline at end of file diff --git a/erpnext/stock/doctype/quality_inspection_template/test_records.json b/erpnext/stock/doctype/quality_inspection_template/test_records.json deleted file mode 100644 index 2da99f616ac..00000000000 --- a/erpnext/stock/doctype/quality_inspection_template/test_records.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "doctype": "Quality Inspection Parameter", - "parameter" : "_Test Param" - }, - { - "quality_inspection_template_name" : "_Test Quality Inspection Template", - "doctype": "Quality Inspection Template", - "item_quality_inspection_parameter" : [ - { - "specification": "_Test Param", - "doctype": "Item Quality Inspection Parameter", - "parentfield": "item_quality_inspection_parameter" - } - ] - } -] diff --git a/erpnext/stock/doctype/serial_no/test_records.json b/erpnext/stock/doctype/serial_no/test_records.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/erpnext/stock/doctype/serial_no/test_records.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/test_records.json b/erpnext/stock/doctype/stock_entry/test_records.json deleted file mode 100644 index dc212874139..00000000000 --- a/erpnext/stock/doctype/stock_entry/test_records.json +++ /dev/null @@ -1,105 +0,0 @@ -[ - { - "company": "_Test Company", - "doctype": "Stock Entry", - "stock_entry_type": "Material Receipt", - "purpose": "Material Receipt", - "items": [ - { - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Stock Entry Detail", - "expense_account": "Stock Adjustment - _TC", - "basic_rate": 100, - "item_code": "_Test Item", - "parentfield": "items", - "qty": 50.0, - "stock_uom": "_Test UOM", - "t_warehouse": "_Test Warehouse - _TC", - "transfer_qty": 50.0, - "uom": "_Test UOM" - } - ] - }, - { - "company": "_Test Company", - "doctype": "Stock Entry", - "purpose": "Material Issue", - "stock_entry_type": "Material Issue", - "items": [ - { - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Stock Entry Detail", - "expense_account": "Stock Adjustment - _TC", - "basic_rate": 100, - "item_code": "_Test Item", - "parentfield": "items", - "qty": 40.0, - "s_warehouse": "_Test Warehouse - _TC", - "stock_uom": "_Test UOM", - "transfer_qty": 40.0, - "uom": "_Test UOM" - } - ] - }, - { - "company": "_Test Company", - "doctype": "Stock Entry", - "purpose": "Material Transfer", - "stock_entry_type": "Material Transfer", - "items": [ - { - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Stock Entry Detail", - "expense_account": "Stock Adjustment - _TC", - "basic_rate": 100, - "item_code": "_Test Item", - "parentfield": "items", - "qty": 45.0, - "s_warehouse": "_Test Warehouse - _TC", - "stock_uom": "_Test UOM", - "t_warehouse": "_Test Warehouse 1 - _TC", - "transfer_qty": 45.0, - "uom": "_Test UOM" - } - ] - }, - { - "company": "_Test Company", - "doctype": "Stock Entry", - "purpose": "Repack", - "stock_entry_type": "Repack", - "items": [ - { - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Stock Entry Detail", - "expense_account": "Stock Adjustment - _TC", - "basic_rate": 100, - "item_code": "_Test Item", - "parentfield": "items", - "qty": 50.0, - "s_warehouse": "_Test Warehouse - _TC", - "stock_uom": "_Test UOM", - "transfer_qty": 50.0, - "uom": "_Test UOM" - }, - { - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Stock Entry Detail", - "expense_account": "Stock Adjustment - _TC", - "basic_rate": 5000, - "item_code": "_Test Item Home Desktop 100", - "parentfield": "items", - "qty": 1, - "stock_uom": "_Test UOM", - "t_warehouse": "_Test Warehouse - _TC", - "transfer_qty": 1, - "uom": "_Test UOM" - } - ] - } -] diff --git a/erpnext/stock/doctype/warehouse/test_records.json b/erpnext/stock/doctype/warehouse/test_records.json deleted file mode 100644 index e128558ed3b..00000000000 --- a/erpnext/stock/doctype/warehouse/test_records.json +++ /dev/null @@ -1,64 +0,0 @@ -[ - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Warehouse", - "is_group": 0 - }, - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Scrap Warehouse", - "is_group": 0 - }, - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Warehouse 1", - "is_group": 0 - }, - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Warehouse 2", - "is_group": 0 - }, - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Rejected Warehouse", - "is_group": 0 - }, - { - "company": "_Test Company 1", - "doctype": "Warehouse", - "warehouse_name": "_Test Warehouse 2", - "is_group": 0 - }, - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Warehouse No Account", - "is_group": 0 - }, - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Warehouse Group", - "is_group": 1 - }, - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Warehouse Group-C1", - "is_group": 0, - "parent_warehouse": "_Test Warehouse Group - _TC" - }, - { - "company": "_Test Company", - "doctype": "Warehouse", - "warehouse_name": "_Test Warehouse Group-C2", - "is_group": 0, - "parent_warehouse": "_Test Warehouse Group - _TC" - } -] From de34cf227a6087e1f0b4b138e5b45599a42a00f3 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 May 2025 09:25:32 +0530 Subject: [PATCH 016/217] chore: remove EXTRA_TEST_RECORD_DEPENDENCIES --- erpnext/accounts/doctype/account/test_account.py | 2 -- .../accounting_dimension/test_accounting_dimension.py | 2 -- .../test_accounting_dimension_filter.py | 2 -- .../doctype/accounting_period/test_accounting_period.py | 2 -- .../test_advance_payment_ledger_entry.py | 2 +- .../doctype/bank_transaction/test_bank_transaction.py | 2 -- erpnext/accounts/doctype/coupon_code/test_coupon_code.py | 2 -- erpnext/accounts/doctype/dunning/test_dunning.py | 2 -- .../test_opening_invoice_creation_tool.py | 2 -- .../accounts/doctype/payment_entry/test_payment_entry.py | 2 -- .../payment_reconciliation/test_payment_reconciliation.py | 2 -- .../doctype/payment_request/test_payment_request.py | 2 -- .../period_closing_voucher/test_period_closing_voucher.py | 3 --- erpnext/accounts/doctype/pos_profile/test_pos_profile.py | 2 -- .../accounts/doctype/pricing_rule/test_pricing_rule.py | 3 --- .../doctype/purchase_invoice/test_purchase_invoice.py | 1 - .../accounts/doctype/sales_invoice/test_sales_invoice.py | 3 --- .../doctype/share_transfer/test_share_transfer.py | 2 -- .../accounts/doctype/subscription/test_subscription.py | 2 -- .../test_tax_withholding_category.py | 2 -- .../accounts/report/balance_sheet/test_balance_sheet.py | 2 -- .../sales_payment_summary/test_sales_payment_summary.py | 2 -- .../buying/doctype/purchase_order/test_purchase_order.py | 3 --- erpnext/buying/doctype/supplier/test_supplier.py | 5 +---- erpnext/controllers/tests/test_mapper.py | 2 -- erpnext/controllers/tests/test_queries.py | 3 --- erpnext/manufacturing/doctype/bom/test_bom.py | 2 -- .../doctype/bom_update_log/test_bom_update_log.py | 1 - .../doctype/bom_update_tool/test_bom_update_tool.py | 1 - erpnext/manufacturing/doctype/job_card/test_job_card.py | 2 -- erpnext/manufacturing/doctype/routing/test_routing.py | 2 -- .../manufacturing/doctype/work_order/test_work_order.py | 2 -- .../manufacturing/doctype/workstation/test_workstation.py | 2 -- erpnext/manufacturing/report/test_reports.py | 2 -- erpnext/regional/report/uae_vat_201/test_uae_vat_201.py | 2 -- erpnext/selling/doctype/customer/test_customer.py | 1 - .../party_specific_item/test_party_specific_item.py | 2 -- erpnext/selling/doctype/quotation/test_quotation.py | 2 -- erpnext/selling/doctype/sales_order/test_sales_order.py | 3 --- .../test_payment_terms_status_for_sales_order.py | 8 -------- .../sales_order_analysis/test_sales_order_analysis.py | 2 -- erpnext/setup/doctype/company/test_company.py | 1 - erpnext/stock/doctype/delivery_note/test_delivery_note.py | 3 --- erpnext/stock/doctype/item/test_item.py | 1 - .../landed_cost_voucher/test_landed_cost_voucher.py | 1 - .../doctype/material_request/test_material_request.py | 3 --- erpnext/stock/doctype/pick_list/test_pick_list.py | 2 -- .../doctype/purchase_receipt/test_purchase_receipt.py | 3 --- erpnext/stock/doctype/serial_no/test_serial_no.py | 2 -- .../stock_closing_balance/test_stock_closing_balance.py | 2 +- .../stock_closing_entry/test_stock_closing_entry.py | 2 +- .../stock_reconciliation/test_stock_reconciliation.py | 3 --- erpnext/stock/tests/test_get_item_details.py | 2 -- erpnext/tests/test_init.py | 2 -- 54 files changed, 4 insertions(+), 116 deletions(-) diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index 6deff1ac3e6..5bd600d99be 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -13,8 +13,6 @@ from erpnext.accounts.doctype.account.account import ( ) from erpnext.stock import get_company_default_inventory_account, get_warehouse_account -EXTRA_TEST_RECORD_DEPENDENCIES = ["Company"] - class TestAccount(IntegrationTestCase): def test_rename_account(self): diff --git a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py index 769522e2642..a9eaf0b1402 100644 --- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py @@ -8,8 +8,6 @@ from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice -EXTRA_TEST_RECORD_DEPENDENCIES = ["Cost Center", "Location", "Warehouse", "Department"] - class TestAccountingDimension(IntegrationTestCase): def setUp(self): diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py index bff288cf4d8..cdc0d7452ad 100644 --- a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py +++ b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py @@ -12,8 +12,6 @@ from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension imp from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError -EXTRA_TEST_RECORD_DEPENDENCIES = ["Location", "Cost Center", "Department"] - class TestAccountingDimensionFilter(unittest.TestCase): def setUp(self): diff --git a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py index 1dde96c223d..cdd8251281e 100644 --- a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py +++ b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py @@ -12,8 +12,6 @@ from erpnext.accounts.doctype.accounting_period.accounting_period import ( ) from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item"] - class TestAccountingPeriod(IntegrationTestCase): def test_overlap(self): diff --git a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py index f824e6893e4..779378ac47c 100644 --- a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py +++ b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py @@ -13,7 +13,7 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde # On IntegrationTestCase, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] + IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] diff --git a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py index e04c67e54d4..31a0a896af4 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py @@ -21,8 +21,6 @@ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.tests.utils import if_lending_app_installed -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item", "Cost Center"] - class TestBankTransaction(IntegrationTestCase): def setUp(self): diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py index ce57a27a536..146cb6984f7 100644 --- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py +++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py @@ -7,8 +7,6 @@ from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item"] - def test_create_test_data(): frappe.set_user("Administrator") diff --git a/erpnext/accounts/doctype/dunning/test_dunning.py b/erpnext/accounts/doctype/dunning/test_dunning.py index 4ba44a2a3c9..feb92c70e76 100644 --- a/erpnext/accounts/doctype/dunning/test_dunning.py +++ b/erpnext/accounts/doctype/dunning/test_dunning.py @@ -19,8 +19,6 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( create_sales_invoice_against_cost_center, ) -EXTRA_TEST_RECORD_DEPENDENCIES = ["Company", "Cost Center"] - class TestDunning(IntegrationTestCase): @classmethod diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py index 730d5db8ae6..b4f29710f4b 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py @@ -12,8 +12,6 @@ from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_crea get_temporary_opening_account, ) -EXTRA_TEST_RECORD_DEPENDENCIES = ["Customer", "Supplier", "Accounting Dimension"] - class TestOpeningInvoiceCreationTool(IntegrationTestCase): @classmethod diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index f6c240c0714..73798aed252 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -25,8 +25,6 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.setup.doctype.employee.test_employee import make_employee -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item", "Currency Exchange"] - class TestPaymentEntry(IntegrationTestCase): def tearDown(self): diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py index 3682e7c63a9..031bd801cb2 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py @@ -18,8 +18,6 @@ from erpnext.accounts.utils import get_fiscal_year from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.stock.doctype.item.test_item import create_item -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item"] - class TestPaymentReconciliation(IntegrationTestCase): def setUp(self): diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py index 41375d9d9af..7ae04c27433 100644 --- a/erpnext/accounts/doctype/payment_request/test_payment_request.py +++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py @@ -19,8 +19,6 @@ from erpnext.buying.doctype.purchase_order.test_purchase_order import create_pur from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.setup.utils import get_exchange_rate -EXTRA_TEST_RECORD_DEPENDENCIES = ["Currency Exchange", "Journal Entry", "Contact", "Address"] - PAYMENT_URL = "https://example.com/payment" payment_gateways = [ diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py index e9bc137fcd4..67191f99993 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py @@ -391,6 +391,3 @@ def create_cost_center(cc_name): ) costcenter.insert(ignore_if_duplicate=True) return costcenter.name - - -EXTRA_TEST_RECORD_DEPENDENCIES = ["Customer", "Cost Center"] diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py index 1f02ba7e0a7..a52933487f4 100644 --- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -11,8 +11,6 @@ from erpnext.accounts.doctype.pos_profile.pos_profile import ( ) from erpnext.stock.get_item_details import get_pos_profile -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item"] - class TestPOSProfile(IntegrationTestCase): def test_pos_profile(self): diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index aa4cd12afc2..f4c9709e3f3 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -1522,9 +1522,6 @@ class TestPricingRule(IntegrationTestCase): pi.cancel() -EXTRA_TEST_RECORD_DEPENDENCIES = ["UTM Campaign"] - - def make_pricing_rule(**args): args = frappe._dict(args) diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index cb771bdc35a..a7001109d1e 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -38,7 +38,6 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction from erpnext.stock.tests.test_utils import StockTestMixin -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item", "Cost Center", "Payment Term", "Payment Terms Template"] IGNORE_TEST_RECORD_DEPENDENCIES = ["Serial No"] diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 6a0eb0e5014..732ada84886 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -5016,9 +5016,6 @@ def create_sales_invoice_against_cost_center(**args): return si -EXTRA_TEST_RECORD_DEPENDENCIES = ["Journal Entry", "Contact", "Address"] - - def get_outstanding_amount(against_voucher_type, against_voucher, account, party, party_type): bal = flt( frappe.db.sql( diff --git a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py index 7cd76cc6b47..3b9e34cc03c 100644 --- a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py +++ b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py @@ -7,8 +7,6 @@ from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.share_transfer.share_transfer import ShareDontExists -EXTRA_TEST_RECORD_DEPENDENCIES = ["Share Type", "Shareholder"] - class TestShareTransfer(IntegrationTestCase): def setUp(self): diff --git a/erpnext/accounts/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py index 2f1c1742d0b..8dfdb116f36 100644 --- a/erpnext/accounts/doctype/subscription/test_subscription.py +++ b/erpnext/accounts/doctype/subscription/test_subscription.py @@ -20,8 +20,6 @@ from frappe.utils.data import ( from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.subscription.subscription import get_prorata_factor -EXTRA_TEST_RECORD_DEPENDENCIES = ("UOM", "Item Group", "Item") - class TestSubscription(IntegrationTestCase): def setUp(self): diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index a9773ceae60..bf1eef735b0 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -12,8 +12,6 @@ from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_ent from erpnext.accounts.utils import get_fiscal_year from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_invoice -EXTRA_TEST_RECORD_DEPENDENCIES = ["Supplier Group", "Customer Group"] - class TestTaxWithholdingCategory(IntegrationTestCase): @classmethod diff --git a/erpnext/accounts/report/balance_sheet/test_balance_sheet.py b/erpnext/accounts/report/balance_sheet/test_balance_sheet.py index cf225ba39da..56e3505fafd 100644 --- a/erpnext/accounts/report/balance_sheet/test_balance_sheet.py +++ b/erpnext/accounts/report/balance_sheet/test_balance_sheet.py @@ -10,8 +10,6 @@ from erpnext.accounts.report.balance_sheet.balance_sheet import execute COMPANY = "_Test Company 6" COMPANY_SHORT_NAME = "_TC6" -EXTRA_TEST_RECORD_DEPENDENCIES = ["Company"] - class TestBalanceSheet(IntegrationTestCase): def test_balance_sheet(self): diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py index 481e9381ff1..77fcc82c0de 100644 --- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py +++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py @@ -12,8 +12,6 @@ from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import get_mode_of_payments, ) -EXTRA_TEST_RECORD_DEPENDENCIES = ["Sales Invoice"] - class TestSalesPaymentSummary(IntegrationTestCase): @classmethod diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index f533af61b9e..b815ae34e1c 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -1560,6 +1560,3 @@ def get_ordered_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"): def get_requested_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"): return flt(frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, "indented_qty")) - - -EXTRA_TEST_RECORD_DEPENDENCIES = ["BOM", "Item Price", "Warehouse"] diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index f3f0ede3e17..f1e2d88473b 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -3,15 +3,12 @@ import frappe +from frappe.tests import IntegrationTestCase, UnitTestCase from erpnext.accounts.party import get_due_date from erpnext.controllers.website_list_for_contact import get_customers_suppliers from erpnext.exceptions import PartyDisabled -EXTRA_TEST_RECORD_DEPENDENCIES = ["Payment Term", "Payment Terms Template"] - - -from frappe.tests import IntegrationTestCase class TestSupplier(IntegrationTestCase): diff --git a/erpnext/controllers/tests/test_mapper.py b/erpnext/controllers/tests/test_mapper.py index 53eb75058ec..fa9515e5c23 100644 --- a/erpnext/controllers/tests/test_mapper.py +++ b/erpnext/controllers/tests/test_mapper.py @@ -7,8 +7,6 @@ from frappe.model import mapper from frappe.tests import IntegrationTestCase from frappe.utils import add_months, nowdate -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item"] - class TestMapper(IntegrationTestCase): def test_map_docs(self): diff --git a/erpnext/controllers/tests/test_queries.py b/erpnext/controllers/tests/test_queries.py index f7129a240b6..33de8114669 100644 --- a/erpnext/controllers/tests/test_queries.py +++ b/erpnext/controllers/tests/test_queries.py @@ -14,9 +14,6 @@ def add_default_params(func, doctype): return partial(func, doctype=doctype, txt="", searchfield="name", start=0, page_len=20, filters=None) -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item", "BOM", "Account"] - - class TestQueries(ERPNextTestSuite): # All tests are based on self.globalTestRecords[doctype] diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index 000b4723e59..a6963a66254 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -21,8 +21,6 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation, ) -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item", "Quality Inspection Template"] - class TestBOM(IntegrationTestCase): @timeout diff --git a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py index 815d5599ef0..7b8b89a4c14 100644 --- a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py +++ b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py @@ -13,7 +13,6 @@ from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import ( enqueue_update_cost, ) -EXTRA_TEST_RECORD_DEPENDENCIES = ["BOM"] class TestBOMUpdateLog(IntegrationTestCase): diff --git a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py index 05bf252bedf..0da15a0bc38 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py @@ -11,7 +11,6 @@ from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import enqueu from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.stock.doctype.item.test_item import create_item -EXTRA_TEST_RECORD_DEPENDENCIES = ["BOM"] class TestBOMUpdateTool(IntegrationTestCase): diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index bcda8913238..70ffc232e21 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -26,8 +26,6 @@ from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.tests.utils import ERPNextTestSuite -EXTRA_TEST_RECORD_DEPENDENCIES = ["UOM"] - class TestJobCard(ERPNextTestSuite): @classmethod diff --git a/erpnext/manufacturing/doctype/routing/test_routing.py b/erpnext/manufacturing/doctype/routing/test_routing.py index 4c6e8df5752..114297cc9c8 100644 --- a/erpnext/manufacturing/doctype/routing/test_routing.py +++ b/erpnext/manufacturing/doctype/routing/test_routing.py @@ -7,8 +7,6 @@ from erpnext.manufacturing.doctype.job_card.job_card import OperationSequenceErr from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record from erpnext.stock.doctype.item.test_item import make_item -EXTRA_TEST_RECORD_DEPENDENCIES = ["UOM"] - class TestRouting(IntegrationTestCase): @classmethod diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 08f5e2eaf56..2a2beaa87bb 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -34,8 +34,6 @@ from erpnext.stock.doctype.stock_entry import test_stock_entry from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse from erpnext.stock.utils import get_bin -EXTRA_TEST_RECORD_DEPENDENCIES = ["BOM"] - class TestWorkOrder(IntegrationTestCase): def setUp(self): diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py index 6a407c22b8c..9222b478d33 100644 --- a/erpnext/manufacturing/doctype/workstation/test_workstation.py +++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py @@ -12,8 +12,6 @@ from erpnext.manufacturing.doctype.workstation.workstation import ( check_if_within_operating_hours, ) -EXTRA_TEST_RECORD_DEPENDENCIES = ["Warehouse"] - class TestWorkstation(IntegrationTestCase): def test_validate_timings(self): diff --git a/erpnext/manufacturing/report/test_reports.py b/erpnext/manufacturing/report/test_reports.py index 6fcef563a8b..8e53d9064de 100644 --- a/erpnext/manufacturing/report/test_reports.py +++ b/erpnext/manufacturing/report/test_reports.py @@ -5,8 +5,6 @@ from frappe.tests import IntegrationTestCase from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report -EXTRA_TEST_RECORD_DEPENDENCIES = ["BOM", "Item Price", "Warehouse"] - class TestManufacturingReports(IntegrationTestCase): def setUp(self): diff --git a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py index 40687aeb9f8..7e719bb8aec 100644 --- a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py +++ b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py @@ -16,8 +16,6 @@ from erpnext.regional.report.uae_vat_201.uae_vat_201 import ( ) from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse_account -EXTRA_TEST_RECORD_DEPENDENCIES = ["Territory", "Customer Group", "Supplier Group", "Item"] - class TestUaeVat201(TestCase): def setUp(self): diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 2e7b7233fb1..5e4a8558b76 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -18,7 +18,6 @@ from erpnext.selling.doctype.customer.customer import ( from erpnext.tests.utils import create_test_contact_and_address IGNORE_TEST_RECORD_DEPENDENCIES = ["Price List"] -EXTRA_TEST_RECORD_DEPENDENCIES = ["Payment Term", "Payment Terms Template"] class TestCustomer(IntegrationTestCase): diff --git a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py index 218a3e7c696..0259c5fcaee 100644 --- a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py +++ b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py @@ -6,8 +6,6 @@ from frappe.tests import IntegrationTestCase from erpnext.controllers.queries import item_query -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item", "Customer", "Supplier"] - def create_party_specific_item(**args): psi = frappe.new_doc("Party Specific Item") diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index 367b7bae0f9..ab1528812eb 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -11,8 +11,6 @@ from erpnext.controllers.accounts_controller import InvalidQtyError, update_chil from erpnext.selling.doctype.quotation.quotation import make_sales_order from erpnext.setup.utils import get_exchange_rate -EXTRA_TEST_RECORD_DEPENDENCIES = ["Product Bundle"] - class TestQuotation(IntegrationTestCase): def test_update_child_quotation_add_item(self): diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index e4a372454be..7d1c3749205 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -2834,9 +2834,6 @@ def get_reserved_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"): return flt(frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, "reserved_qty")) -EXTRA_TEST_RECORD_DEPENDENCIES = ["Currency Exchange"] - - def make_sales_order_workflow(): if frappe.db.exists("Workflow", "SO Test Workflow"): doc = frappe.get_doc("Workflow", "SO Test Workflow") diff --git a/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py b/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py index 6575cf9ff69..d8eba371534 100644 --- a/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py +++ b/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py @@ -11,14 +11,6 @@ from erpnext.selling.report.payment_terms_status_for_sales_order.payment_terms_s ) from erpnext.stock.doctype.item.test_item import create_item -EXTRA_TEST_RECORD_DEPENDENCIES = [ - "Sales Order", - "Item", - "Sales Invoice", - "Payment Terms Template", - "Customer", -] - class TestPaymentTermsStatusForSalesOrder(IntegrationTestCase): def tearDown(self): diff --git a/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py b/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py index f07caf0443e..76dc0dfff85 100644 --- a/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py +++ b/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py @@ -7,8 +7,6 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde from erpnext.selling.report.sales_order_analysis.sales_order_analysis import execute from erpnext.stock.doctype.item.test_item import create_item -EXTRA_TEST_RECORD_DEPENDENCIES = ["Sales Order", "Item", "Sales Invoice", "Delivery Note"] - class TestSalesOrderAnalysis(IntegrationTestCase): def create_sales_order(self, transaction_date, do_not_save=False, do_not_submit=False): diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index 3c2500c0826..78b169fcf9b 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -19,7 +19,6 @@ IGNORE_TEST_RECORD_DEPENDENCIES = [ "Salary Component", "Warehouse", ] -EXTRA_TEST_RECORD_DEPENDENCIES = ["Fiscal Year"] class TestCompany(IntegrationTestCase): diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 71ed8b753cb..8ce354d1058 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -2956,6 +2956,3 @@ def create_delivery_note(**args): dn.load_from_db() return dn - - -EXTRA_TEST_RECORD_DEPENDENCIES = ["Product Bundle"] diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 7814efb1c0b..514b713ad51 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -29,7 +29,6 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.get_item_details import ItemDetailsCtx, get_item_details IGNORE_TEST_RECORD_DEPENDENCIES = ["BOM"] -EXTRA_TEST_RECORD_DEPENDENCIES = ["Warehouse", "Item Group", "Item Tax Template", "Brand", "Item Attribute"] def make_item(item_code=None, properties=None, uoms=None, barcode=None): diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py index f68351a5611..57de08306da 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py @@ -22,7 +22,6 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle ) from erpnext.stock.serial_batch_bundle import SerialNoValuation -EXTRA_TEST_RECORD_DEPENDENCIES = ["Currency Exchange"] class TestLandedCostVoucher(IntegrationTestCase): diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index da5bfd270df..b04cbbee1f1 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -1191,6 +1191,3 @@ def make_material_request(**args): if not args.do_not_submit: mr.submit() return mr - - -EXTRA_TEST_RECORD_DEPENDENCIES = ["Currency Exchange", "BOM"] diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py index 12c92310147..0bd66b69afe 100644 --- a/erpnext/stock/doctype/pick_list/test_pick_list.py +++ b/erpnext/stock/doctype/pick_list/test_pick_list.py @@ -22,8 +22,6 @@ from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import ( EmptyStockReconciliationItemsError, ) -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item", "Sales Invoice", "Stock Entry", "Batch"] - class TestPickList(IntegrationTestCase): def test_pick_list_picks_warehouse_for_each_item(self): diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 7fb31928ac5..a3ead18cb6c 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -5578,6 +5578,3 @@ def make_purchase_receipt(**args): pr.load_from_db() return pr - - -EXTRA_TEST_RECORD_DEPENDENCIES = ["BOM", "Item Price", "Location"] diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py index c1300ee531b..dfc2a1edd6d 100644 --- a/erpnext/stock/doctype/serial_no/test_serial_no.py +++ b/erpnext/stock/doctype/serial_no/test_serial_no.py @@ -21,8 +21,6 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item"] - class TestSerialNo(IntegrationTestCase): def tearDown(self): diff --git a/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py b/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py index 8e09d518f3f..f61aff6e8c4 100644 --- a/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py +++ b/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py @@ -7,7 +7,7 @@ from frappe.tests import IntegrationTestCase # On IntegrationTestCase, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] + IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] diff --git a/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py b/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py index 2a2f0eb86b7..7175c586c0e 100644 --- a/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py +++ b/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py @@ -7,7 +7,7 @@ from frappe.tests import IntegrationTestCase # On IntegrationTestCase, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] + IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 4b3d9099afc..7cc6d4b484b 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -1976,6 +1976,3 @@ def set_valuation_method(item_code, valuation_method): update_entries_after( {"item_code": item_code, "warehouse": warehouse.name}, allow_negative_stock=1 ) - - -EXTRA_TEST_RECORD_DEPENDENCIES = ["Item", "Warehouse"] diff --git a/erpnext/stock/tests/test_get_item_details.py b/erpnext/stock/tests/test_get_item_details.py index e0f32402d85..a10714a1f25 100644 --- a/erpnext/stock/tests/test_get_item_details.py +++ b/erpnext/stock/tests/test_get_item_details.py @@ -3,8 +3,6 @@ from frappe.tests import IntegrationTestCase from erpnext.stock.get_item_details import get_item_details -EXTRA_TEST_RECORD_DEPENDENCIES = ["Customer", "Supplier", "Item", "Price List", "Item Price"] - class TestGetItemDetail(IntegrationTestCase): def test_get_item_detail_purchase_order(self): diff --git a/erpnext/tests/test_init.py b/erpnext/tests/test_init.py index 7675a031a70..70944f4114c 100644 --- a/erpnext/tests/test_init.py +++ b/erpnext/tests/test_init.py @@ -5,8 +5,6 @@ from frappe.tests import IntegrationTestCase from erpnext import encode_company_abbr -EXTRA_TEST_RECORD_DEPENDENCIES = ["Company"] - class TestInit(IntegrationTestCase): def test_encode_company_abbr(self): From c2504760dd5720528ab7a632773b273e6b62ec25 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 May 2025 09:27:37 +0530 Subject: [PATCH 017/217] chore: remove IGNORE_TEST_RECORD_DEPENDENCIES --- .../test_advance_payment_ledger_entry.py | 2 -- erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py | 2 -- .../test_payment_gateway_account.py | 2 -- .../doctype/purchase_invoice/test_purchase_invoice.py | 2 -- erpnext/projects/doctype/project/test_project.py | 2 -- erpnext/selling/doctype/customer/test_customer.py | 2 -- erpnext/setup/doctype/company/test_company.py | 8 -------- erpnext/setup/doctype/department/test_department.py | 2 -- erpnext/stock/doctype/item/test_item.py | 2 -- .../stock_closing_balance/test_stock_closing_balance.py | 2 -- .../stock_closing_entry/test_stock_closing_entry.py | 2 -- 11 files changed, 28 deletions(-) diff --git a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py index 779378ac47c..e8562922ada 100644 --- a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py +++ b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py @@ -14,8 +14,6 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - class TestAdvancePaymentLedgerEntry(AccountsTestMixin, IntegrationTestCase): """ diff --git a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py index 22624e270aa..1ceffa90940 100644 --- a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py +++ b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py @@ -6,8 +6,6 @@ import frappe from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime -IGNORE_TEST_RECORD_DEPENDENCIES = ["Company"] - class TestFiscalYear(IntegrationTestCase): def test_extra_year(self): diff --git a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py index 030844e7148..4d30780da8c 100644 --- a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py +++ b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py @@ -4,8 +4,6 @@ import unittest from frappe.tests import IntegrationTestCase -IGNORE_TEST_RECORD_DEPENDENCIES = ["Payment Gateway"] - class TestPaymentGatewayAccount(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index a7001109d1e..b28b1a2c4a8 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -38,8 +38,6 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction from erpnext.stock.tests.test_utils import StockTestMixin -IGNORE_TEST_RECORD_DEPENDENCIES = ["Serial No"] - class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): @classmethod diff --git a/erpnext/projects/doctype/project/test_project.py b/erpnext/projects/doctype/project/test_project.py index 2f1974ee4cb..85fd91bc6b1 100644 --- a/erpnext/projects/doctype/project/test_project.py +++ b/erpnext/projects/doctype/project/test_project.py @@ -11,8 +11,6 @@ from erpnext.selling.doctype.sales_order.sales_order import make_project as make from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.tests.utils import ERPNextTestSuite -IGNORE_TEST_RECORD_DEPENDENCIES = ["Sales Order"] - class TestProject(ERPNextTestSuite): @classmethod diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 5e4a8558b76..dee74837923 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -17,8 +17,6 @@ from erpnext.selling.doctype.customer.customer import ( ) from erpnext.tests.utils import create_test_contact_and_address -IGNORE_TEST_RECORD_DEPENDENCIES = ["Price List"] - class TestCustomer(IntegrationTestCase): def tearDown(self): diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index 78b169fcf9b..5b65be71f14 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -12,14 +12,6 @@ from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import ) from erpnext.setup.doctype.company.company import get_default_company_address -IGNORE_TEST_RECORD_DEPENDENCIES = [ - "Account", - "Cost Center", - "Payment Terms Template", - "Salary Component", - "Warehouse", -] - class TestCompany(IntegrationTestCase): def test_coa_based_on_existing_company(self): diff --git a/erpnext/setup/doctype/department/test_department.py b/erpnext/setup/doctype/department/test_department.py index b35985ca685..274361749fd 100644 --- a/erpnext/setup/doctype/department/test_department.py +++ b/erpnext/setup/doctype/department/test_department.py @@ -5,8 +5,6 @@ import unittest import frappe from frappe.tests import IntegrationTestCase -IGNORE_TEST_RECORD_DEPENDENCIES = ["Leave Block List"] - class TestDepartment(IntegrationTestCase): def test_remove_department_data(self): diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 514b713ad51..c2de1e54fdb 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -28,8 +28,6 @@ from erpnext.stock.doctype.item.item import ( from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.get_item_details import ItemDetailsCtx, get_item_details -IGNORE_TEST_RECORD_DEPENDENCIES = ["BOM"] - def make_item(item_code=None, properties=None, uoms=None, barcode=None): if not item_code: diff --git a/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py b/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py index f61aff6e8c4..2d0769cf496 100644 --- a/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py +++ b/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py @@ -8,8 +8,6 @@ from frappe.tests import IntegrationTestCase # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - class IntegrationTestStockClosingBalance(IntegrationTestCase): """ diff --git a/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py b/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py index 7175c586c0e..db4577503e6 100644 --- a/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py +++ b/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py @@ -8,8 +8,6 @@ from frappe.tests import IntegrationTestCase # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - class IntegrationTestStockClosingEntry(IntegrationTestCase): """ From fbf3373a87817869321b23468989dee619f28e4f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 May 2025 09:28:14 +0530 Subject: [PATCH 018/217] chore: remove global dependencies --- erpnext/tests/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/tests/__init__.py b/erpnext/tests/__init__.py index dc37472c4c6..e69de29bb2d 100644 --- a/erpnext/tests/__init__.py +++ b/erpnext/tests/__init__.py @@ -1 +0,0 @@ -global_test_dependencies = ["User", "Company", "Item"] From 018257096b1104af99945feacd199aefbed562c8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sun, 18 May 2025 15:32:04 +0530 Subject: [PATCH 019/217] chore: drop dead hook --- erpnext/hooks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 962fe3e98aa..0277783cc74 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -63,7 +63,6 @@ welcome_email = "erpnext.setup.utils.welcome_email" setup_wizard_requires = "assets/erpnext/js/setup_wizard.js" setup_wizard_stages = "erpnext.setup.setup_wizard.setup_wizard.get_setup_stages" setup_wizard_complete = "erpnext.setup.setup_wizard.setup_wizard.setup_demo" -setup_wizard_test = "erpnext.setup.setup_wizard.test_setup_wizard.run_setup_wizard_test" after_install = "erpnext.setup.install.after_install" From b86954119fa4a88e9b6846d81660fd7f5651d6d9 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 16 May 2025 14:16:29 +0530 Subject: [PATCH 020/217] refactor(test): IntegraionTestCase -> python's built-in TestCase --- erpnext/tests/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 7dedd637d3c..5e42fb810e7 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -1,6 +1,7 @@ # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt +import unittest from typing import Any, NewType import frappe @@ -117,7 +118,7 @@ def if_lending_app_not_installed(function): return wrapper -class ERPNextTestSuite(IntegrationTestCase): +class ERPNextTestSuite(unittest.TestCase): @classmethod def setUpClass(cls): super().setUpClass() From 88c6f61632e08c2980242ae901fe5206c3fee609 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 May 2025 11:22:21 +0530 Subject: [PATCH 021/217] refactor(test): make persistent company records 'test_coa_based_on_country_template' made deterministic --- erpnext/setup/doctype/company/test_company.py | 7 +- erpnext/tests/utils.py | 148 ++++++++++++++++++ 2 files changed, 153 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index 5b65be71f14..40a40445ede 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -4,16 +4,16 @@ import json import frappe from frappe import _ -from frappe.tests import IntegrationTestCase from frappe.utils import random_string from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import ( get_charts_for_country, ) from erpnext.setup.doctype.company.company import get_default_company_address +from erpnext.tests.utils import ERPNextTestSuite -class TestCompany(IntegrationTestCase): +class TestCompany(ERPNextTestSuite): def test_coa_based_on_existing_company(self): company = frappe.new_doc("Company") company.company_name = "COA from Existing Company" @@ -56,6 +56,9 @@ class TestCompany(IntegrationTestCase): self.assertTrue(templates) + for company in frappe.db.get_all("Company", {"company_name": ["in", templates]}): + frappe.delete_doc("Company", company.name) + for template in templates: try: company = frappe.new_doc("Company") diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 5e42fb810e7..2660982f54e 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -122,6 +122,12 @@ class ERPNextTestSuite(unittest.TestCase): @classmethod def setUpClass(cls): super().setUpClass() + cls.make_persistant_master_data() + + @classmethod + def make_persistant_master_data(cls): + cls.make_company() + frappe.db.commit() @classmethod def make_monthly_distribution(cls): @@ -301,3 +307,145 @@ class ERPNextTestSuite(unittest.TestCase): cls.leads.append(frappe.get_doc(x).insert()) else: cls.leads.append(frappe.get_doc("Lead", {"email_id": x.get("email_id")})) + + @classmethod + def make_holiday_list(cls): + records = [ + { + "doctype": "Holiday List", + "from_date": "2013-01-01", + "to_date": "2013-12-31", + "holidays": [ + {"description": "New Year", "holiday_date": "2013-01-01"}, + {"description": "Republic Day", "holiday_date": "2013-01-26"}, + {"description": "Test Holiday", "holiday_date": "2013-02-01"}, + ], + "holiday_list_name": "_Test Holiday List", + } + ] + cls.holiday_list = [] + for x in records: + if not frappe.db.exists("Holiday List", {"holiday_list_name": x.get("holiday_list_name")}): + cls.holiday_list.append(frappe.get_doc(x).insert()) + else: + cls.holiday_list.append( + frappe.get_doc("Holiday List", {"holiday_list_name": x.get("holiday_list_name")}) + ) + + @classmethod + def make_company(cls): + records = [ + { + "abbr": "_TC", + "company_name": "_Test Company", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + # "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + "allow_account_creation_against_child_company": 1, + }, + { + "abbr": "_TC1", + "company_name": "_Test Company 1", + "country": "United States", + "default_currency": "USD", + "doctype": "Company", + "domain": "Retail", + "chart_of_accounts": "Standard", + # "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + }, + { + "abbr": "_TC2", + "company_name": "_Test Company 2", + "default_currency": "EUR", + "country": "Germany", + "doctype": "Company", + "domain": "Retail", + "chart_of_accounts": "Standard", + # "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + }, + { + "abbr": "_TC3", + "company_name": "_Test Company 3", + "is_group": 1, + "country": "Pakistan", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + # "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + }, + { + "abbr": "_TC4", + "company_name": "_Test Company 4", + "parent_company": "_Test Company 3", + "is_group": 1, + "country": "Pakistan", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + # "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + }, + { + "abbr": "_TC5", + "company_name": "_Test Company 5", + "parent_company": "_Test Company 4", + "country": "Pakistan", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + # "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + }, + { + "abbr": "TCP1", + "company_name": "_Test Company with perpetual inventory", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "enable_perpetual_inventory": 1, + # "default_holiday_list": cls.holiday_list[0].name, + }, + { + "abbr": "_TC6", + "company_name": "_Test Company 6", + "is_group": 1, + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + # "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + }, + { + "abbr": "_TC7", + "company_name": "_Test Company 7", + "parent_company": "_Test Company 6", + "is_group": 1, + "country": "United States", + "default_currency": "USD", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + # "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + }, + ] + cls.companies = [] + for x in records: + if not frappe.db.exists("Company", {"company_name": x.get("company_name")}): + cls.companies.append(frappe.get_doc(x).insert()) + else: + cls.companies.append(frappe.get_doc("Company", {"company_name": x.get("company_name")})) From 0fdc961a4b3fc25ade007df5e8af5bf6ad96a9e5 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 16 May 2025 15:19:31 +0530 Subject: [PATCH 022/217] refactor(test): bare bones presets for company --- erpnext/setup/demo.py | 16 +- erpnext/setup/doctype/company/test_company.py | 6 +- erpnext/tests/utils.py | 173 ++++++++++++++++++ 3 files changed, 191 insertions(+), 4 deletions(-) diff --git a/erpnext/setup/demo.py b/erpnext/setup/demo.py index 7835aeb9a9e..ec48a3e1447 100644 --- a/erpnext/setup/demo.py +++ b/erpnext/setup/demo.py @@ -57,8 +57,20 @@ def clear_demo_data(): def create_demo_company(): - company = frappe.db.get_all("Company")[0].name - company_doc = frappe.get_doc("Company", company) + if frappe.flags.in_test: + hash = frappe.generate_hash(length=3) + company_doc = frappe._dict( + { + "company_name": "Test Company" + " " + hash, + "abbr": "TC" + hash, + "default_currency": "INR", + "country": "India", + "chart_of_accounts": "Standard", + } + ) + else: + company = frappe.db.get_all("Company")[0].name + company_doc = frappe.get_doc("Company", company).as_dict() # Make a dummy company new_company = frappe.new_doc("Company") diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index 40a40445ede..0e04e24b0f9 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -21,6 +21,7 @@ class TestCompany(ERPNextTestSuite): company.default_currency = "INR" company.create_chart_of_accounts_based_on = "Existing Company" company.existing_company = "_Test Company" + company.country = "India" company.save() expected_results = { @@ -67,6 +68,7 @@ class TestCompany(ERPNextTestSuite): company.default_currency = "USD" company.create_chart_of_accounts_based_on = "Standard Template" company.chart_of_accounts = template + company.country = country company.save() account_types = [ @@ -108,11 +110,11 @@ class TestCompany(ERPNextTestSuite): max_rgt = frappe.db.sql("select max(rgt) from `tabCompany`")[0][0] if not records: - records = self.globalTestRecords["Company"][2:] + records = self.companies[2:] for company in records: lft, rgt, parent_company = frappe.db.get_value( - "Company", company["company_name"], ["lft", "rgt", "parent_company"] + "Company", company.get("company_name"), ["lft", "rgt", "parent_company"] ) if parent_company: diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 2660982f54e..a2a9ba57377 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -5,8 +5,10 @@ import unittest from typing import Any, NewType import frappe +from frappe import _ from frappe.core.doctype.report.report import get_report_module_dotted_path from frappe.tests import IntegrationTestCase +from frappe.utils import now_datetime ReportFilters = dict[str, Any] ReportName = NewType("ReportName", str) @@ -126,9 +128,125 @@ class ERPNextTestSuite(unittest.TestCase): @classmethod def make_persistant_master_data(cls): + # presets and default are mandatory for company + cls.make_warehouse_type() + cls.make_uom() + cls.make_address_template() + cls.make_fiscal_year() cls.make_company() + cls.update_stock_settings() + frappe.db.commit() + @classmethod + def update_stock_settings(cls): + stock_settings = frappe.get_doc("Stock Settings") + stock_settings.item_naming_by = "Item Code" + stock_settings.valuation_method = "FIFO" + stock_settings.default_warehouse = frappe.db.get_value("Warehouse", {"warehouse_name": _("Stores")}) + stock_settings.stock_uom = "Nos" + stock_settings.auto_indent = 1 + stock_settings.auto_insert_price_list_rate_if_missing = 1 + stock_settings.update_price_list_based_on = "Rate" + stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1 + stock_settings.enable_serial_and_batch_no_for_item = 1 + stock_settings.save() + + @classmethod + def make_price_list(cls): + records = [ + { + "doctype": "Price List", + "price_list_name": _("Standard Buying"), + "enabled": 1, + "buying": 1, + "selling": 0, + "currency": "INR", + }, + { + "doctype": "Price List", + "price_list_name": _("Standard Selling"), + "enabled": 1, + "buying": 0, + "selling": 1, + "currency": "INR", + }, + ] + cls.price_list = [] + for x in records: + if not frappe.db.exists( + "Price List", + { + "price_list_name": x.get("price_list_name"), + "enabled": x.get("enabled"), + "selling": x.get("selling"), + "buying": x.get("buying"), + "currency": x.get("currency"), + }, + ): + cls.price_list.append(frappe.get_doc(x).insert()) + else: + cls.price_list.append( + frappe.get_doc( + "Price List", + { + "price_list_name": x.get("price_list_name"), + "enabled": x.get("enabled"), + "selling": x.get("selling"), + "buying": x.get("buying"), + "currency": x.get("currency"), + }, + ) + ) + + @classmethod + def make_address_template(cls): + records = [ + { + "doctype": "Address Template", + "country": "India", + "is_default": True, + "template": """ + {{ address_line1 }}
+ {% if address_line2 %}{{ address_line2 }}
{% endif -%} + {{ city }}
+ {% if state %}{{ state }}
{% endif -%} + {% if pincode %}{{ pincode }}
{% endif -%} + {{ country }}
+
+ {% if phone %}{{ _("Phone") }}: {{ phone }}
{% endif -%} + {% if fax %}{{ _("Fax") }}: {{ fax }}
{% endif -%} + {% if email_id %}{{ _("Email") }}: {{ email_id }}
{% endif -%} + """, + } + ] + cls.address_template = [] + for x in records: + if not frappe.db.exists("Address Template", {"country": x.get("country")}): + cls.address_template.append(frappe.get_doc(x).insert()) + else: + cls.address_template.append(frappe.get_doc("Address Template", {"country": x.get("country")})) + + @classmethod + def make_uom(cls): + records = [{"doctype": "UOM", "uom_name": "Nos", "must_be_whole_number": 1, "common_code": "C62"}] + cls.uom = [] + for x in records: + if not frappe.db.exists("UOM", {"uom_name": x.get("uom_name")}): + cls.warehouse_type.append(frappe.get_doc(x).insert()) + else: + cls.warehouse_type.append(frappe.get_doc("UOM", {"uom_name": x.get("uom_name")})) + + @classmethod + def make_warehouse_type(cls): + records = [{"doctype": "Warehouse Type", "name": "Transit"}] + cls.warehouse_type = [] + for x in records: + if not frappe.db.exists("Warehouse Type", {"name": x.get("name")}): + cls.warehouse_type.append(frappe.get_doc(x).insert()) + else: + cls.warehouse_type.append(frappe.get_doc("Warehouse Type", {"name": x.get("name")})) + @classmethod def make_monthly_distribution(cls): records = [ @@ -449,3 +567,58 @@ class ERPNextTestSuite(unittest.TestCase): cls.companies.append(frappe.get_doc(x).insert()) else: cls.companies.append(frappe.get_doc("Company", {"company_name": x.get("company_name")})) + + @classmethod + def make_fiscal_year(cls): + records = [ + { + "doctype": "Fiscal Year", + "year": "_Test Short Fiscal Year 2011", + "is_short_year": 1, + "year_start_date": "2011-04-01", + "year_end_date": "2011-12-31", + } + ] + + start = 2012 + this_year = now_datetime().year + end = now_datetime().year + 25 + # The current year fails to load with the following error: + # Year start date or end date is overlapping with 2024. To avoid please set company + # This is a quick-fix: if current FY is needed, please refactor test data properly + for year in range(start, this_year): + records.append( + { + "doctype": "Fiscal Year", + "year": f"_Test Fiscal Year {year}", + "year_start_date": f"{year}-01-01", + "year_end_date": f"{year}-12-31", + } + ) + for year in range(this_year + 1, end): + records.append( + { + "doctype": "Fiscal Year", + "year": f"_Test Fiscal Year {year}", + "year_start_date": f"{year}-01-01", + "year_end_date": f"{year}-12-31", + } + ) + + cls.fiscal_year = [] + for x in records: + if not frappe.db.exists( + "Fiscal Year", + {"year_start_date": x.get("year_start_date"), "year_end_date": x.get("year_end_date")}, + ): + cls.fiscal_year.append(frappe.get_doc(x).insert()) + else: + cls.fiscal_year.append( + frappe.get_doc( + "Fiscal Year", + { + "year_start_date": x.get("year_start_date"), + "year_end_date": x.get("year_end_date"), + }, + ) + ) From 7edcef124876938894f8abf63e100fffe7413638 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 11:52:24 +0530 Subject: [PATCH 023/217] fix: consider returned qty in subcontracting report (backport #53616) (#53621) Co-authored-by: Mihir Kandoi fix: consider returned qty in subcontracting report (#53616) --- .../subcontracted_raw_materials_to_be_transferred.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py index ef28eda62a5..4526bbf1703 100644 --- a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py +++ b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py @@ -41,6 +41,7 @@ def get_columns(filters): "fieldname": "transferred_qty", "width": 200, }, + {"label": _("Returned Quantity"), "fieldtype": "Float", "fieldname": "returned_qty", "width": 150}, {"label": _("Pending Quantity"), "fieldtype": "Float", "fieldname": "p_qty", "width": 150}, ] @@ -50,7 +51,7 @@ def get_data(filters): data = [] for row in order_rm_item_details: - transferred_qty = row.get("transferred_qty") or 0 + transferred_qty = (row.get("transferred_qty") or 0) - (row.get("returned_qty") or 0) if transferred_qty < row.get("reqd_qty", 0): pending_qty = frappe.utils.flt(row.get("reqd_qty", 0) - transferred_qty) row.p_qty = pending_qty if pending_qty > 0 else 0 @@ -86,6 +87,7 @@ def get_order_items_to_supply(filters): f"`tab{supplied_items_table}`.rm_item_code as rm_item_code", f"`tab{supplied_items_table}`.required_qty as reqd_qty", f"`tab{supplied_items_table}`.supplied_qty as transferred_qty", + f"`tab{supplied_items_table}`.returned_qty as returned_qty", ], filters=record_filters, ) From 077bf2d0ceccf390e04dbd3504af37502532a101 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 06:55:47 +0000 Subject: [PATCH 024/217] refactor: remove test file import in stock ageing report (backport #53619) (#53626) Co-authored-by: Mihir Kandoi --- erpnext/stock/report/stock_ageing/stock_ageing.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.py b/erpnext/stock/report/stock_ageing/stock_ageing.py index 4e9be3df364..c6990c9492d 100644 --- a/erpnext/stock/report/stock_ageing/stock_ageing.py +++ b/erpnext/stock/report/stock_ageing/stock_ageing.py @@ -245,10 +245,7 @@ class FIFOSlots: consumed/updated and maintained via FIFO. ** } """ - - from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle import ( - get_serial_nos_from_bundle, - ) + from erpnext.stock.serial_batch_bundle import get_serial_nos_from_bundle stock_ledger_entries = self.sle @@ -273,7 +270,7 @@ class FIFOSlots: if bundle_wise_serial_nos: serial_nos = bundle_wise_serial_nos.get(d.serial_and_batch_bundle) or [] else: - serial_nos = get_serial_nos_from_bundle(d.serial_and_batch_bundle) or [] + serial_nos = sorted(get_serial_nos_from_bundle(d.serial_and_batch_bundle)) or [] serial_nos = self.uppercase_serial_nos(serial_nos) if d.actual_qty > 0: From 2d1dd034838d2223ac6f09d44fd6cf5b8586a54f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 07:03:03 +0000 Subject: [PATCH 025/217] fix(stock): handle NoneType error (backport #53593) (#53627) Co-authored-by: Pandiyan P fix(stock): handle NoneType error (#53593) --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 8cbe865f072..45353633a15 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -404,7 +404,7 @@ class PurchaseReceipt(BuyingController): self.update_received_qty_if_from_pp() def update_received_qty_if_from_pp(self): - from frappe.query_builder.functions import Sum + from frappe.query_builder.functions import Coalesce, Sum items_from_po = [item.purchase_order_item for item in self.items if item.purchase_order_item] if items_from_po: @@ -413,7 +413,10 @@ class PurchaseReceipt(BuyingController): frappe.qb.from_(table) .select(table.production_plan_sub_assembly_item) .distinct() - .where(table.name.isin(items_from_po) & table.production_plan_sub_assembly_item.isnotnull()) + .where( + table.name.isin(items_from_po) + & Coalesce(table.production_plan_sub_assembly_item, "").ne("") + ) ) result = subquery.run(as_dict=True) if result: From 5b4e3e92df097da7567a201f97cf766035a67036 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 07:11:25 +0000 Subject: [PATCH 026/217] fix: set customer details on customer creation at login (backport #53509) (#53629) Co-authored-by: Sakthivel Murugan S <129778327+ssakthivelmurugan@users.noreply.github.com> fix: set customer details on customer creation at login (#53509) --- erpnext/portal/utils.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/erpnext/portal/utils.py b/erpnext/portal/utils.py index 86426b2ffe8..cfdf8e18191 100644 --- a/erpnext/portal/utils.py +++ b/erpnext/portal/utils.py @@ -47,21 +47,8 @@ def create_customer_or_supplier(): if party_exists(doctype, user): return - party = frappe.new_doc(doctype) fullname = frappe.utils.get_fullname(user) - - if doctype != "Customer": - party.update( - { - "supplier_name": fullname, - "supplier_group": "All Supplier Groups", - "supplier_type": "Individual", - } - ) - - party.flags.ignore_mandatory = True - party.insert(ignore_permissions=True) - + party = create_party(doctype, fullname) alternate_doctype = "Customer" if doctype == "Supplier" else "Supplier" if party_exists(alternate_doctype, user): @@ -69,6 +56,22 @@ def create_customer_or_supplier(): fullname += "-" + doctype create_party_contact(doctype, fullname, user, party.name) + return party + + +def create_party(doctype, fullname): + party = frappe.new_doc(doctype) + # Can't set parent party as group + + party.update( + { + f"{doctype.lower()}_name": fullname, + f"{doctype.lower()}_type": "Individual", + } + ) + + party.flags.ignore_mandatory = True + party.insert(ignore_permissions=True) return party From f1dfac417d4ca032d8eb4103b16fbf3ecd222bda Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 20 Jan 2026 10:12:06 +0530 Subject: [PATCH 027/217] refactor: replace IntegrationTestCase with ERPNextTestCase repo-wide - import ERPNextTestSuite - use it on test class --- .../accounts/doctype/account/test_account.py | 4 +- .../test_account_closing_balance.py | 5 ++- .../test_accounting_dimension.py | 4 +- .../test_accounting_dimension_filter.py | 3 +- .../test_accounting_period.py | 4 +- .../test_accounts_settings.py | 5 ++- .../test_advance_payment_ledger_entry.py | 6 +-- erpnext/accounts/doctype/bank/test_bank.py | 4 +- .../doctype/bank_account/test_bank_account.py | 6 +-- .../test_bank_account_subtype.py | 4 +- .../test_bank_account_type.py | 4 +- .../bank_clearance/test_bank_clearance.py | 5 +-- .../bank_guarantee/test_bank_guarantee.py | 4 +- .../test_bank_reconciliation_tool.py | 4 +- .../test_bank_statement_import.py | 5 +-- .../bank_transaction/test_auto_match_party.py | 4 +- .../bank_transaction/test_bank_transaction.py | 5 +-- .../test_bisect_accounting_statements.py | 6 ++- .../doctype/bisect_nodes/test_bisect_nodes.py | 6 ++- .../cashier_closing/test_cashier_closing.py | 4 +- .../test_chart_of_accounts_importer.py | 4 +- .../test_cheque_print_template.py | 4 +- .../doctype/cost_center/test_cost_center.py | 5 ++- .../test_cost_center_allocation.py | 6 +-- .../doctype/coupon_code/test_coupon_code.py | 4 +- .../test_currency_exchange_settings.py | 4 +- .../accounts/doctype/dunning/test_dunning.py | 4 +- .../doctype/dunning_type/test_dunning_type.py | 4 +- .../test_exchange_rate_revaluation.py | 12 +++--- .../doctype/finance_book/test_finance_book.py | 4 +- .../doctype/fiscal_year/test_fiscal_year.py | 5 ++- .../doctype/gl_entry/test_gl_entry.py | 4 +- .../test_invoice_discounting.py | 4 +- .../test_item_tax_template.py | 4 +- .../journal_entry/test_journal_entry.py | 8 ++-- .../test_journal_entry_template.py | 4 +- .../ledger_health/test_ledger_health.py | 4 +- .../test_ledger_health_monitor.py | 6 ++- .../doctype/ledger_merge/test_ledger_merge.py | 4 +- .../test_loyalty_point_entry.py | 4 +- .../loyalty_program/test_loyalty_program.py | 4 +- .../mode_of_payment/test_mode_of_payment.py | 5 ++- .../test_monthly_distribution.py | 5 +-- .../test_opening_invoice_creation_tool.py | 4 +- .../doctype/party_link/test_party_link.py | 4 +- .../payment_entry/test_payment_entry.py | 12 +++--- .../test_payment_gateway_account.py | 4 +- .../test_payment_ledger_entry.py | 10 ++--- .../payment_order/test_payment_order.py | 4 +- .../test_payment_reconciliation.py | 6 +-- .../payment_request/test_payment_request.py | 8 ++-- .../doctype/payment_term/test_payment_term.py | 4 +- .../test_payment_terms_template.py | 5 ++- .../test_period_closing_voucher.py | 4 +- .../test_pos_closing_entry.py | 6 +-- .../doctype/pos_invoice/test_pos_invoice.py | 4 +- .../test_pos_invoice_merge_log.py | 6 +-- .../test_pos_opening_entry.py | 6 ++- .../doctype/pos_profile/test_pos_profile.py | 4 +- .../pos_profile_user/test_pos_profile_user.py | 4 +- .../doctype/pos_settings/test_pos_settings.py | 4 +- .../doctype/pricing_rule/test_pricing_rule.py | 4 +- .../test_process_deferred_accounting.py | 4 +- .../test_process_payment_reconciliation.py | 6 ++- ...test_process_payment_reconciliation_log.py | 6 ++- .../test_process_statement_of_accounts.py | 4 +- .../test_process_subscription.py | 6 ++- .../test_promotional_scheme.py | 4 +- .../purchase_invoice/test_purchase_invoice.py | 26 +++++------- ...est_purchase_taxes_and_charges_template.py | 4 +- .../test_repost_accounting_ledger.py | 6 +-- .../test_repost_accounting_ledger_settings.py | 6 ++- .../test_repost_payment_ledger.py | 6 ++- .../sales_invoice/test_sales_invoice.py | 40 ++++++++----------- .../test_sales_taxes_and_charges_template.py | 5 +-- .../share_transfer/test_share_transfer.py | 4 +- .../doctype/share_type/test_share_type.py | 4 +- .../doctype/shareholder/test_shareholder.py | 4 +- .../shipping_rule/test_shipping_rule.py | 4 +- .../doctype/subscription/test_subscription.py | 6 +-- .../test_subscription_invoice.py | 4 +- .../test_subscription_plan.py | 4 +- .../test_subscription_settings.py | 4 +- .../doctype/tax_category/test_tax_category.py | 4 +- .../doctype/tax_rule/test_tax_rule.py | 4 +- .../test_tax_withholding_category.py | 8 ++-- .../test_unreconcile_payment.py | 4 +- .../account_balance/test_account_balance.py | 4 +- .../accounts_payable/test_accounts_payable.py | 4 +- .../test_accounts_receivable.py | 8 ++-- .../test_accounts_receivable_summary.py | 6 +-- .../balance_sheet/test_balance_sheet.py | 4 +- .../test_bank_reconciliation_statement.py | 5 +-- .../test_customer_ledger_summary.py | 6 +-- .../test_deferred_revenue_and_expense.py | 12 +++--- ...t_general_and_payment_ledger_comparison.py | 4 +- .../general_ledger/test_general_ledger.py | 4 +- .../report/gross_profit/test_gross_profit.py | 4 +- .../test_item_wise_purchase_register.py | 4 +- .../test_item_wise_sales_register.py | 4 +- .../payment_ledger/test_payment_ledger.py | 4 +- .../test_profit_and_loss_statement.py | 4 +- .../test_purchase_register.py | 4 +- .../test_sales_payment_summary.py | 4 +- .../sales_register/test_sales_register.py | 4 +- .../test_supplier_ledger_summary.py | 4 +- .../test_tax_withholding_details.py | 4 +- .../trial_balance/test_trial_balance.py | 4 +- erpnext/accounts/test/test_reports.py | 8 +--- erpnext/accounts/test/test_utils.py | 4 +- erpnext/accounts/test_party.py | 4 +- erpnext/assets/doctype/asset/test_asset.py | 4 +- .../asset_activity/test_asset_activity.py | 6 ++- .../test_asset_capitalization.py | 6 +-- .../asset_category/test_asset_category.py | 6 ++- .../test_asset_depreciation_schedule.py | 6 +-- .../test_asset_maintenance.py | 4 +- .../test_asset_maintenance_log.py | 4 +- .../test_asset_maintenance_team.py | 4 +- .../asset_movement/test_asset_movement.py | 4 +- .../doctype/asset_repair/test_asset_repair.py | 3 +- .../test_asset_shift_allocation.py | 4 +- .../test_asset_shift_factor.py | 6 ++- .../test_asset_value_adjustment.py | 4 +- .../assets/doctype/location/test_location.py | 5 ++- .../test_maintenance_team_member.py | 4 +- .../test_bulk_transaction_log.py | 6 ++- .../test_bulk_transaction_log_detail.py | 6 ++- .../buying_settings/test_buying_settings.py | 4 +- .../purchase_order/test_purchase_order.py | 23 ++++++----- .../test_request_for_quotation.py | 9 +++-- .../buying/doctype/supplier/test_supplier.py | 11 +++-- .../test_supplier_quotation.py | 7 ++-- .../test_supplier_scorecard.py | 5 ++- .../test_supplier_scorecard_criteria.py | 5 ++- .../test_supplier_scorecard_period.py | 4 +- .../test_supplier_scorecard_standing.py | 4 +- .../test_supplier_scorecard_variable.py | 4 +- .../test_procurement_tracker.py | 4 +- ...st_requested_items_to_order_and_receive.py | 4 +- .../test_subcontracted_item_to_be_received.py | 4 +- ...tracted_raw_materials_to_be_transferred.py | 4 +- .../tests/test_accounts_controller.py | 19 ++++----- .../tests/test_distributed_discount.py | 5 +-- .../controllers/tests/test_item_variant.py | 4 +- erpnext/controllers/tests/test_mapper.py | 5 ++- .../controllers/tests/test_qty_based_taxes.py | 5 ++- erpnext/controllers/tests/test_queries.py | 2 +- erpnext/controllers/tests/test_reactivity.py | 6 +-- .../tests/test_subcontracting_controller.py | 6 +-- .../tests/test_transaction_base.py | 5 ++- .../doctype/appointment/test_appointment.py | 5 ++- .../test_appointment_booking_settings.py | 4 +- erpnext/crm/doctype/campaign/test_campaign.py | 4 +- .../crm/doctype/competitor/test_competitor.py | 4 +- erpnext/crm/doctype/contract/test_contract.py | 5 ++- .../test_contract_fulfilment_checklist.py | 4 +- .../test_contract_template.py | 4 +- .../doctype/crm_settings/test_crm_settings.py | 4 +- .../email_campaign/test_email_campaign.py | 4 +- .../market_segment/test_market_segment.py | 4 +- .../opportunity_type/test_opportunity_type.py | 4 +- erpnext/crm/doctype/prospect/test_prospect.py | 4 +- .../doctype/sales_stage/test_sales_stage.py | 4 +- ...test_opportunity_summary_by_sales_stage.py | 8 +--- .../test_sales_pipeline_analytics.py | 4 +- .../plaid_settings/test_plaid_settings.py | 4 +- .../test_maintenance_schedule.py | 4 +- .../test_maintenance_visit.py | 5 ++- .../blanket_order/test_blanket_order.py | 4 +- erpnext/manufacturing/doctype/bom/test_bom.py | 5 ++- .../doctype/bom_creator/test_bom_creator.py | 4 +- .../bom_update_log/test_bom_update_log.py | 5 +-- .../bom_update_tool/test_bom_update_tool.py | 6 +-- .../downtime_entry/test_downtime_entry.py | 4 +- .../doctype/job_card/test_job_card.py | 13 +++--- .../test_manufacturing_settings.py | 4 +- .../test_material_request_plan_item.py | 4 +- .../doctype/operation/test_operation.py | 5 ++- .../doctype/plant_floor/test_plant_floor.py | 6 ++- .../production_plan/test_production_plan.py | 4 +- ...duction_plan_material_request_warehouse.py | 4 +- .../doctype/routing/test_routing.py | 4 +- .../sub_operation/test_sub_operation.py | 4 +- .../doctype/work_order/test_work_order.py | 23 +++++------ .../doctype/workstation/test_workstation.py | 4 +- .../workstation_type/test_workstation_type.py | 5 ++- .../test_bom_stock_calculated.py | 5 +-- .../bom_stock_report/test_bom_stock_report.py | 4 +- erpnext/manufacturing/report/test_reports.py | 5 +-- .../project_template/test_project_template.py | 4 +- .../doctype/project_type/test_project_type.py | 4 +- .../project_update/test_project_update.py | 5 +-- .../test_projects_settings.py | 4 +- .../doctype/task_type/test_task_type.py | 4 +- .../doctype/timesheet/test_timesheet.py | 3 +- .../test_delayed_tasks_summary.py | 4 +- .../non_conformance/test_non_conformance.py | 4 +- .../quality_action/test_quality_action.py | 4 +- .../quality_feedback/test_quality_feedback.py | 5 ++- .../test_quality_feedback_template.py | 4 +- .../doctype/quality_goal/test_quality_goal.py | 5 ++- .../quality_meeting/test_quality_meeting.py | 4 +- .../test_quality_meeting_agenda.py | 4 +- .../test_quality_procedure.py | 5 ++- .../quality_review/test_quality_review.py | 5 ++- .../test_import_supplier_invoice.py | 4 +- .../test_lower_deduction_certificate.py | 4 +- .../test_south_africa_vat_settings.py | 4 +- .../uae_vat_settings/test_uae_vat_settings.py | 4 +- .../united_states/test_united_states.py | 4 +- .../selling/doctype/customer/test_customer.py | 5 +-- .../test_installation_note.py | 4 +- .../test_party_specific_item.py | 4 +- .../doctype/quotation/test_quotation.py | 16 ++++---- .../doctype/sales_order/test_sales_order.py | 29 +++++++------- .../test_sales_partner_type.py | 4 +- .../selling_settings/test_selling_settings.py | 5 ++- ...st_payment_terms_status_for_sales_order.py | 6 +-- ...t_pending_so_items_for_purchase_request.py | 4 +- .../report/sales_analytics/test_analytics.py | 4 +- .../test_sales_order_analysis.py | 4 +- ...ner_target_variance_based_on_item_group.py | 4 +- ...son_target_variance_based_on_item_group.py | 4 +- .../test_authorization_rule.py | 4 +- .../test_currency_exchange.py | 4 +- .../doctype/department/test_department.py | 5 ++- erpnext/setup/doctype/driver/test_driver.py | 4 +- .../doctype/email_digest/test_email_digest.py | 4 +- .../setup/doctype/employee/test_employee.py | 4 +- .../employee_group/test_employee_group.py | 4 +- .../global_defaults/test_global_defaults.py | 4 +- .../doctype/holiday_list/test_holiday_list.py | 4 +- .../setup/doctype/incoterm/test_incoterm.py | 6 ++- .../doctype/item_group/test_item_group.py | 5 ++- .../doctype/party_type/test_party_type.py | 4 +- .../test_transaction_deletion_record.py | 5 ++- .../test_uom_conversion_factor.py | 4 +- erpnext/setup/doctype/vehicle/test_vehicle.py | 5 ++- erpnext/stock/doctype/batch/test_batch.py | 4 +- erpnext/stock/doctype/bin/test_bin.py | 4 +- .../test_customs_tariff_number.py | 4 +- .../delivery_note/test_delivery_note.py | 10 ++--- .../test_delivery_settings.py | 4 +- .../delivery_trip/test_delivery_trip.py | 5 +-- .../test_inventory_dimension.py | 6 +-- erpnext/stock/doctype/item/test_item.py | 12 +++--- .../item_alternative/test_item_alternative.py | 4 +- .../item_attribute/test_item_attribute.py | 4 +- .../test_item_manufacturer.py | 4 +- .../doctype/item_price/test_item_price.py | 4 +- .../test_item_variant_settings.py | 4 +- .../test_landed_cost_voucher.py | 5 +-- .../doctype/manufacturer/test_manufacturer.py | 4 +- .../material_request/test_material_request.py | 4 +- .../doctype/packed_item/test_packed_item.py | 6 +-- .../doctype/packing_slip/test_packing_slip.py | 4 +- .../stock/doctype/pick_list/test_pick_list.py | 4 +- .../purchase_receipt/test_purchase_receipt.py | 14 +++---- .../doctype/putaway_rule/test_putaway_rule.py | 4 +- .../test_quality_inspection.py | 6 +-- .../test_quality_inspection_parameter.py | 4 +- ...test_quality_inspection_parameter_group.py | 4 +- .../test_quality_inspection_template.py | 4 +- .../test_repost_item_valuation.py | 8 ++-- .../test_serial_and_batch_bundle.py | 6 +-- .../stock/doctype/serial_no/test_serial_no.py | 4 +- .../stock/doctype/shipment/test_shipment.py | 4 +- .../test_shipment_parcel_template.py | 4 +- .../test_stock_closing_balance.py | 6 +-- .../test_stock_closing_entry.py | 7 ++-- .../doctype/stock_entry/test_stock_entry.py | 16 ++++---- .../stock_entry_type/test_stock_entry_type.py | 5 ++- .../test_stock_ledger_entry.py | 12 +++--- .../test_stock_reconciliation.py | 12 +++--- .../test_stock_reposting_settings.py | 4 +- .../test_stock_reservation_entry.py | 22 +++++----- .../stock_settings/test_stock_settings.py | 5 ++- .../doctype/uom_category/test_uom_category.py | 4 +- .../variant_field/test_variant_field.py | 4 +- .../stock/doctype/warehouse/test_warehouse.py | 4 +- .../warehouse_type/test_warehouse_type.py | 4 +- .../test_available_serial_no.py | 4 +- .../test_item_shortage_report.py | 4 +- .../reserved_stock/test_reserved_stock.py | 6 +-- .../report/stock_ageing/test_stock_ageing.py | 4 +- .../stock_analytics/test_stock_analytics.py | 4 +- .../stock_balance/test_stock_balance.py | 4 +- .../stock_ledger/test_stock_ledger_report.py | 4 +- erpnext/stock/report/test_reports.py | 8 +--- erpnext/stock/tests/test_get_item_details.py | 4 +- erpnext/stock/tests/test_utils.py | 4 +- erpnext/stock/tests/test_valuation.py | 8 ++-- .../test_subcontracting_bom.py | 5 ++- .../test_subcontracting_inward_order.py | 18 +++------ .../test_subcontracting_order.py | 4 +- .../test_subcontracting_receipt.py | 14 +++---- erpnext/support/doctype/issue/test_issue.py | 4 +- .../issue_priority/test_issue_priority.py | 5 ++- .../doctype/issue_type/test_issue_type.py | 4 +- .../test_service_level_agreement.py | 4 +- .../support_settings/test_support_settings.py | 4 +- .../warranty_claim/test_warranty_claim.py | 5 +-- .../issue_analytics/test_issue_analytics.py | 4 +- .../doctype/call_log/test_call_log.py | 4 +- .../test_incoming_call_settings.py | 4 +- .../test_telephony_call_type.py | 4 +- .../test_voice_call_settings.py | 4 +- erpnext/tests/test_activation.py | 5 +-- erpnext/tests/test_init.py | 8 +--- erpnext/tests/test_notifications.py | 5 ++- erpnext/tests/test_perf.py | 5 ++- erpnext/tests/test_point_of_sale.py | 6 +-- erpnext/tests/test_regional.py | 4 +- erpnext/tests/test_webform.py | 4 +- erpnext/tests/test_zform_loads.py | 7 ++-- erpnext/tests/utils.py | 1 - erpnext/utilities/doctype/video/test_video.py | 4 +- .../video_settings/test_video_settings.py | 4 +- 319 files changed, 870 insertions(+), 867 deletions(-) diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index 5bd600d99be..95f17967fa7 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.doctype.account.account import ( @@ -12,9 +11,10 @@ from erpnext.accounts.doctype.account.account import ( update_account_number, ) from erpnext.stock import get_company_default_inventory_account, get_warehouse_account +from erpnext.tests.utils import ERPNextTestSuite -class TestAccount(IntegrationTestCase): +class TestAccount(ERPNextTestSuite): def test_rename_account(self): if not frappe.db.exists("Account", "1210 - Debtors - _TC"): acc = frappe.new_doc("Account") diff --git a/erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py b/erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py index 53f4e5d15af..a39bd00579e 100644 --- a/erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py +++ b/erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py @@ -2,8 +2,9 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountClosingBalance(IntegrationTestCase): +class TestAccountClosingBalance(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py index a9eaf0b1402..c16c8c28c32 100644 --- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py @@ -3,13 +3,13 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountingDimension(IntegrationTestCase): +class TestAccountingDimension(ERPNextTestSuite): def setUp(self): create_dimension() diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py index cdc0d7452ad..6ea3ebc7b2d 100644 --- a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py +++ b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py @@ -11,9 +11,10 @@ from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension imp ) from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountingDimensionFilter(unittest.TestCase): +class TestAccountingDimensionFilter(ERPNextTestSuite): def setUp(self): create_dimension() create_accounting_dimension_filter() diff --git a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py index cdd8251281e..448b6cf7e2f 100644 --- a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py +++ b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, nowdate from erpnext.accounts.doctype.accounting_period.accounting_period import ( @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.accounting_period.accounting_period import ( OverlapError, ) from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountingPeriod(IntegrationTestCase): +class TestAccountingPeriod(ERPNextTestSuite): def test_overlap(self): ap1 = create_accounting_period( start_date="2018-04-01", end_date="2018-06-30", company="Wind Power LLC" diff --git a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py index e555f0ded15..57b020a24dc 100644 --- a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py @@ -1,10 +1,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountsSettings(IntegrationTestCase): +class TestAccountsSettings(ERPNextTestSuite): def tearDown(self): # Just in case `save` method succeeds, we need to take things back to default so that other tests # don't break diff --git a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py index e8562922ada..08cd7c9504c 100644 --- a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py +++ b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate, today from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry @@ -10,12 +9,13 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order -# On IntegrationTestCase, the doctype test records and all +# On ERPNextTestSuite, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list +from erpnext.tests.utils import ERPNextTestSuite -class TestAdvancePaymentLedgerEntry(AccountsTestMixin, IntegrationTestCase): +class TestAdvancePaymentLedgerEntry(AccountsTestMixin, ERPNextTestSuite): """ Integration tests for AdvancePaymentLedgerEntry. Use this class for testing interactions between multiple components. diff --git a/erpnext/accounts/doctype/bank/test_bank.py b/erpnext/accounts/doctype/bank/test_bank.py index 98e83fd5837..1249b6cc34a 100644 --- a/erpnext/accounts/doctype/bank/test_bank.py +++ b/erpnext/accounts/doctype/bank/test_bank.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBank(IntegrationTestCase): +class TestBank(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py index 146f426e6c7..0645a110140 100644 --- a/erpnext/accounts/doctype/bank_account/test_bank_account.py +++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py @@ -2,10 +2,8 @@ # See license.txt import unittest -import frappe -from frappe import ValidationError -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBankAccount(IntegrationTestCase): +class TestBankAccount(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py b/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py index d4a6c689bc3..0e6a2c52138 100644 --- a/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py +++ b/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBankAccountSubtype(IntegrationTestCase): +class TestBankAccountSubtype(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py b/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py index 0d41686da59..0b602b3b9d6 100644 --- a/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py +++ b/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBankAccountType(IntegrationTestCase): +class TestBankAccountType(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py index dda65594554..2774cc55685 100644 --- a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py +++ b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, getdate from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center @@ -15,10 +14,10 @@ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse -from erpnext.tests.utils import if_lending_app_installed, if_lending_app_not_installed +from erpnext.tests.utils import ERPNextTestSuite, if_lending_app_installed, if_lending_app_not_installed -class TestBankClearance(IntegrationTestCase): +class TestBankClearance(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py index eaf55ce7708..72dad011e56 100644 --- a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py +++ b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBankGuarantee(IntegrationTestCase): +class TestBankGuarantee(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py index 53586b333b4..9c5bcef0933 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py @@ -4,7 +4,6 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import ( @@ -13,9 +12,10 @@ from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool ) from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestBankReconciliationTool(AccountsTestMixin, IntegrationTestCase): +class TestBankReconciliationTool(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py index 3e1cee9115e..2ae00059c83 100644 --- a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py +++ b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py @@ -1,15 +1,14 @@ # Copyright (c) 2020, Frappe Technologies and Contributors # See license.txt -import unittest - from erpnext.accounts.doctype.bank_statement_import.bank_statement_import import ( is_mt940_format, preprocess_mt940_content, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestBankStatementImport(unittest.TestCase): +class TestBankStatementImport(ERPNextTestSuite): """Unit tests for Bank Statement Import functions""" def test_preprocess_mt940_content_with_long_statement_number(self): diff --git a/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py b/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py index da2c28a148c..81407aaf06b 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py +++ b/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py @@ -2,16 +2,16 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import create_bank_account +from erpnext.tests.utils import ERPNextTestSuite IBAN_1 = "DE02000000003716541159" IBAN_2 = "DE02500105170137075030" -class TestAutoMatchParty(IntegrationTestCase): +class TestAutoMatchParty(ERPNextTestSuite): @classmethod def setUpClass(cls): create_bank_account() diff --git a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py index 31a0a896af4..c69d255c51a 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py @@ -6,7 +6,6 @@ import json import frappe from frappe import utils from frappe.model.docstatus import DocStatus -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import ( get_linked_payments, @@ -19,10 +18,10 @@ from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_paymen from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice -from erpnext.tests.utils import if_lending_app_installed +from erpnext.tests.utils import ERPNextTestSuite, if_lending_app_installed -class TestBankTransaction(IntegrationTestCase): +class TestBankTransaction(ERPNextTestSuite): def setUp(self): make_pos_profile() diff --git a/erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py b/erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py index fd1793b2560..55e4811a87f 100644 --- a/erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py +++ b/erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestBisectAccountingStatements(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBisectAccountingStatements(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py b/erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py index 1f37009d8e2..082b2a28f1f 100644 --- a/erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py +++ b/erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestBisectNodes(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBisectNodes(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py b/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py index 56cf2b53919..1c826e31add 100644 --- a/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py +++ b/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCashierClosing(IntegrationTestCase): +class TestCashierClosing(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py index 214de348169..f96d46e90a9 100644 --- a/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py +++ b/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestChartofAccountsImporter(IntegrationTestCase): +class TestChartofAccountsImporter(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py index b7ee19d4422..54c62141e1c 100644 --- a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py +++ b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestChequePrintTemplate(IntegrationTestCase): +class TestChequePrintTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/cost_center/test_cost_center.py b/erpnext/accounts/doctype/cost_center/test_cost_center.py index 375541a3960..cfde7238eab 100644 --- a/erpnext/accounts/doctype/cost_center/test_cost_center.py +++ b/erpnext/accounts/doctype/cost_center/test_cost_center.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestCostCenter(IntegrationTestCase): +class TestCostCenter(ERPNextTestSuite): def test_cost_center_creation_against_child_node(self): cost_center = frappe.get_doc( { diff --git a/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py b/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py index 680e2113ec1..4047e6c7169 100644 --- a/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py +++ b/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py @@ -4,7 +4,6 @@ import unittest import frappe from frappe.query_builder.functions import Sum -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center @@ -16,9 +15,10 @@ from erpnext.accounts.doctype.cost_center_allocation.cost_center_allocation impo WrongPercentageAllocation, ) from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestCostCenterAllocation(IntegrationTestCase): +class TestCostCenterAllocation(ERPNextTestSuite): def setUp(self): cost_centers = [ "Main Cost Center 1", @@ -191,7 +191,7 @@ class TestCostCenterAllocation(IntegrationTestCase): coa2.cancel() jv.cancel() - @IntegrationTestCase.change_settings("System Settings", {"rounding_method": "Commercial Rounding"}) + @ERPNextTestSuite.change_settings("System Settings", {"rounding_method": "Commercial Rounding"}) def test_debit_credit_on_cost_center_allocation_for_commercial_rounding(self): from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py index 146cb6984f7..936eac018e3 100644 --- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py +++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py @@ -3,9 +3,9 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite def test_create_test_data(): @@ -108,7 +108,7 @@ def test_create_test_data(): coupon_code.insert() -class TestCouponCode(IntegrationTestCase): +class TestCouponCode(ERPNextTestSuite): def setUp(self): test_create_test_data() diff --git a/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py b/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py index 3097f72d628..0c1c163a398 100644 --- a/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py +++ b/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCurrencyExchangeSettings(IntegrationTestCase): +class TestCurrencyExchangeSettings(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/dunning/test_dunning.py b/erpnext/accounts/doctype/dunning/test_dunning.py index feb92c70e76..f6bfa1453da 100644 --- a/erpnext/accounts/doctype/dunning/test_dunning.py +++ b/erpnext/accounts/doctype/dunning/test_dunning.py @@ -4,7 +4,6 @@ import json import frappe from frappe.model import mapper -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate, today from erpnext import get_default_cost_center @@ -18,9 +17,10 @@ from erpnext.accounts.doctype.sales_invoice.sales_invoice import ( from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( create_sales_invoice_against_cost_center, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestDunning(IntegrationTestCase): +class TestDunning(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/dunning_type/test_dunning_type.py b/erpnext/accounts/doctype/dunning_type/test_dunning_type.py index 5a95aa68ea9..4cf60c86600 100644 --- a/erpnext/accounts/doctype/dunning_type/test_dunning_type.py +++ b/erpnext/accounts/doctype/dunning_type/test_dunning_type.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestDunningType(IntegrationTestCase): +class TestDunningType(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py index 96079284dd9..24aa5a628fd 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py @@ -5,15 +5,15 @@ import frappe from frappe.query_builder import functions from frappe.query_builder.utils import DocType -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): +class TestExchangeRateRevaluation(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_usd_receivable_account() @@ -37,7 +37,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): company_doc.unrealized_exchange_gain_loss_account = company_doc.exchange_gain_loss_account company_doc.save() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) @@ -91,7 +91,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): )[0] self.assertEqual(acc_balance.balance, 8500.0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) @@ -164,7 +164,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): self.assertEqual(acc_balance.balance, 0.0) self.assertEqual(acc_balance.balance_in_account_currency, 0.0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) @@ -259,7 +259,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): self.assertEqual(flt(acc_balance.balance, precision), 0.0) self.assertEqual(flt(acc_balance.balance_in_account_currency, precision), 0.0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) diff --git a/erpnext/accounts/doctype/finance_book/test_finance_book.py b/erpnext/accounts/doctype/finance_book/test_finance_book.py index e2c156a1df5..e803eabf93a 100644 --- a/erpnext/accounts/doctype/finance_book/test_finance_book.py +++ b/erpnext/accounts/doctype/finance_book/test_finance_book.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestFinanceBook(IntegrationTestCase): +class TestFinanceBook(ERPNextTestSuite): def test_finance_book(self): finance_book = create_finance_book() diff --git a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py index 1ceffa90940..b6ce0696bdb 100644 --- a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py +++ b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py @@ -3,11 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime +from erpnext.tests.utils import ERPNextTestSuite -class TestFiscalYear(IntegrationTestCase): + +class TestFiscalYear(ERPNextTestSuite): def test_extra_year(self): if frappe.db.exists("Fiscal Year", "_Test Fiscal Year 2000"): frappe.delete_doc("Fiscal Year", "_Test Fiscal Year 2000") diff --git a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py index 11269f005db..bd391b4b8f4 100644 --- a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py @@ -4,13 +4,13 @@ import unittest import frappe from frappe.model.naming import parse_naming_series -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.gl_entry.gl_entry import rename_gle_sle_docs from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestGLEntry(IntegrationTestCase): +class TestGLEntry(ERPNextTestSuite): def test_round_off_entry(self): frappe.db.set_value("Company", "_Test Company", "round_off_account", "_Test Write Off - _TC") frappe.db.set_value("Company", "_Test Company", "round_off_cost_center", "_Test Cost Center - _TC") diff --git a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py index f34e2fd2434..00946e5fec1 100644 --- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py @@ -3,16 +3,16 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, nowdate from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.journal_entry.journal_entry import get_payment_entry_against_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries +from erpnext.tests.utils import ERPNextTestSuite -class TestInvoiceDiscounting(IntegrationTestCase): +class TestInvoiceDiscounting(ERPNextTestSuite): def setUp(self): self.ar_credit = create_account( account_name="_Test Accounts Receivable Credit", diff --git a/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py b/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py index d5d8701fdc2..07032b79db2 100644 --- a/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py +++ b/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestItemTaxTemplate(IntegrationTestCase): +class TestItemTaxTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index 1a048a237bf..36e6a9182ad 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -2,19 +2,17 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowdate from erpnext.accounts.doctype.account.test_account import get_inventory_account from erpnext.accounts.doctype.journal_entry.journal_entry import StockAccountInvalidTransaction from erpnext.exceptions import InvalidAccountCurrency from erpnext.selling.doctype.customer.test_customer import make_customer, set_credit_limit +from erpnext.tests.utils import ERPNextTestSuite -class TestJournalEntry(IntegrationTestCase): - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) +class TestJournalEntry(ERPNextTestSuite): + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_journal_entry_with_against_jv(self): jv_invoice = frappe.copy_doc(self.globalTestRecords["Journal Entry"][2]) base_jv = frappe.copy_doc(self.globalTestRecords["Journal Entry"][0]) diff --git a/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py b/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py index 95a287435ff..946f4a64a43 100644 --- a/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py +++ b/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestJournalEntryTemplate(IntegrationTestCase): +class TestJournalEntryTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/ledger_health/test_ledger_health.py b/erpnext/accounts/doctype/ledger_health/test_ledger_health.py index 0eec86ccc0f..d94ccb53afe 100644 --- a/erpnext/accounts/doctype/ledger_health/test_ledger_health.py +++ b/erpnext/accounts/doctype/ledger_health/test_ledger_health.py @@ -3,14 +3,14 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import run_ledger_health_checks +from erpnext.tests.utils import ERPNextTestSuite -class TestLedgerHealth(AccountsTestMixin, IntegrationTestCase): +class TestLedgerHealth(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py b/erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py index bc2193f10ce..191a06510b9 100644 --- a/erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py +++ b/erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestLedgerHealthMonitor(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestLedgerHealthMonitor(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py b/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py index fd5001f97bc..df45ab646d6 100644 --- a/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py +++ b/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.ledger_merge.ledger_merge import start_merge +from erpnext.tests.utils import ERPNextTestSuite -class TestLedgerMerge(IntegrationTestCase): +class TestLedgerMerge(ERPNextTestSuite): def test_merge_success(self): if not frappe.db.exists("Account", "Indirect Expenses - _TC"): acc = frappe.new_doc("Account") diff --git a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py index c085e6caf5e..d6abfa08b4f 100644 --- a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py +++ b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py @@ -3,14 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestLoyaltyPointEntry(IntegrationTestCase): +class TestLoyaltyPointEntry(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py index 604e95df6b8..970b3180efc 100644 --- a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py +++ b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt, getdate, today from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( get_loyalty_program_details_with_points, ) from erpnext.accounts.party import get_dashboard_info +from erpnext.tests.utils import ERPNextTestSuite -class TestLoyaltyProgram(IntegrationTestCase): +class TestLoyaltyProgram(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py index ee2a594f8f0..2f485f10f81 100644 --- a/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py +++ b/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestModeofPayment(IntegrationTestCase): +class TestModeofPayment(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py b/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py index 06c153940a8..30d35527136 100644 --- a/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py +++ b/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py @@ -2,9 +2,8 @@ # See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestMonthlyDistribution(IntegrationTestCase): +class TestMonthlyDistribution(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py index b4f29710f4b..70f91cdab55 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( create_dimension, @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension imp from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import ( get_temporary_opening_account, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestOpeningInvoiceCreationTool(IntegrationTestCase): +class TestOpeningInvoiceCreationTool(ERPNextTestSuite): @classmethod def setUpClass(cls): if not frappe.db.exists("Company", "_Test Opening Invoice Company"): diff --git a/erpnext/accounts/doctype/party_link/test_party_link.py b/erpnext/accounts/doctype/party_link/test_party_link.py index 1c93c65e3c3..c1f59a2209a 100644 --- a/erpnext/accounts/doctype/party_link/test_party_link.py +++ b/erpnext/accounts/doctype/party_link/test_party_link.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPartyLink(IntegrationTestCase): +class TestPartyLink(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index 73798aed252..8aaf36192b7 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -4,7 +4,6 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, nowdate from erpnext.accounts.doctype.account.test_account import create_account @@ -24,9 +23,10 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( ) from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.setup.doctype.employee.test_employee import make_employee +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentEntry(IntegrationTestCase): +class TestPaymentEntry(ERPNextTestSuite): def tearDown(self): frappe.db.rollback() @@ -425,7 +425,7 @@ class TestPaymentEntry(IntegrationTestCase): self.assertEqual(si.payment_schedule[0].outstanding, 0) self.assertEqual(si.payment_schedule[0].discounted_amount, 50) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "allow_multi_currency_invoices_against_single_party_account": 1, @@ -1156,7 +1156,7 @@ class TestPaymentEntry(IntegrationTestCase): } self.assertDictEqual(ref_details, expected_response) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "unlink_payment_on_cancellation_of_invoice": 1, @@ -1251,7 +1251,7 @@ class TestPaymentEntry(IntegrationTestCase): si3.cancel() si3.delete() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "unlink_payment_on_cancellation_of_invoice": 1, @@ -1947,7 +1947,7 @@ class TestPaymentEntry(IntegrationTestCase): # 'Is Opening' should always be 'No' for normal advance payments self.assertEqual(gl_with_opening_set, []) - @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) def test_delete_linked_exchange_gain_loss_journal(self): from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import ( diff --git a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py index 4d30780da8c..ad4373edd75 100644 --- a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py +++ b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentGatewayAccount(IntegrationTestCase): +class TestPaymentGatewayAccount(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py b/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py index 1de103764a4..12e6e9cd0c8 100644 --- a/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py +++ b/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py @@ -3,7 +3,6 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_pay from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentLedgerEntry(IntegrationTestCase): +class TestPaymentLedgerEntry(ERPNextTestSuite): def setUp(self): self.ple = qb.DocType("Payment Ledger Entry") self.create_company() @@ -445,7 +445,7 @@ class TestPaymentLedgerEntry(IntegrationTestCase): self.assertEqual(pl_entries_for_crnote[0], expected_values[0]) self.assertEqual(pl_entries_for_crnote[1], expected_values[1]) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1}, ) @@ -474,7 +474,7 @@ class TestPaymentLedgerEntry(IntegrationTestCase): si.delete() self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1}, ) @@ -507,7 +507,7 @@ class TestPaymentLedgerEntry(IntegrationTestCase): si.delete() self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "unlink_payment_on_cancellation_of_invoice": 1, diff --git a/erpnext/accounts/doctype/payment_order/test_payment_order.py b/erpnext/accounts/doctype/payment_order/test_payment_order.py index f12491fdf15..71ad044ed57 100644 --- a/erpnext/accounts/doctype/payment_order/test_payment_order.py +++ b/erpnext/accounts/doctype/payment_order/test_payment_order.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import ( @@ -15,9 +14,10 @@ from erpnext.accounts.doctype.payment_entry.payment_entry import ( make_payment_order, ) from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentOrder(IntegrationTestCase): +class TestPaymentOrder(ERPNextTestSuite): def setUp(self): # generate and use a uniq hash identifier for 'Bank Account' and it's linked GL 'Account' to avoid validation error uniq_identifier = frappe.generate_hash(length=10) diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py index 031bd801cb2..1cd39c36fbe 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py @@ -4,7 +4,6 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_years, flt, getdate, nowdate, today from frappe.utils.data import getdate as convert_to_date @@ -17,9 +16,10 @@ from erpnext.accounts.party import get_party_account from erpnext.accounts.utils import get_fiscal_year from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentReconciliation(IntegrationTestCase): +class TestPaymentReconciliation(ERPNextTestSuite): def setUp(self): self.create_company() self.create_item() @@ -1233,7 +1233,7 @@ class TestPaymentReconciliation(IntegrationTestCase): payment_vouchers = [x.get("reference_name") for x in pr.get("payments")] self.assertCountEqual(payment_vouchers, [je2.name, pe2.name]) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "allow_multi_currency_invoices_against_single_party_account": 1, diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py index 7ae04c27433..5035d2a2042 100644 --- a/erpnext/accounts/doctype/payment_request/test_payment_request.py +++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py @@ -7,7 +7,6 @@ import unittest from unittest.mock import patch import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -18,6 +17,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.setup.utils import get_exchange_rate +from erpnext.tests.utils import ERPNextTestSuite PAYMENT_URL = "https://example.com/payment" @@ -62,7 +62,7 @@ payment_method = [ ] -class TestPaymentRequest(IntegrationTestCase): +class TestPaymentRequest(ERPNextTestSuite): def setUp(self): for payment_gateway in payment_gateways: if not frappe.db.get_value("Payment Gateway", payment_gateway["gateway"], "name"): @@ -502,7 +502,7 @@ class TestPaymentRequest(IntegrationTestCase): return_doc=1, ) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1} ) def test_multiple_payment_if_partially_paid_for_multi_currency(self): @@ -620,7 +620,7 @@ class TestPaymentRequest(IntegrationTestCase): self.assertEqual(pr.outstanding_amount, 0) self.assertEqual(pr.grand_total, 20000) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1} ) def test_single_payment_with_payment_term_for_multi_currency(self): diff --git a/erpnext/accounts/doctype/payment_term/test_payment_term.py b/erpnext/accounts/doctype/payment_term/test_payment_term.py index 08f51cfb4e9..62129971c16 100644 --- a/erpnext/accounts/doctype/payment_term/test_payment_term.py +++ b/erpnext/accounts/doctype/payment_term/test_payment_term.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentTerm(IntegrationTestCase): +class TestPaymentTerm(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py index fb0020f78ac..de8452d93e1 100644 --- a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py +++ b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentTermsTemplate(IntegrationTestCase): +class TestPaymentTermsTemplate(ERPNextTestSuite): def tearDown(self): frappe.delete_doc("Payment Terms Template", "_Test Payment Terms Template For Test", force=1) diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py index 67191f99993..1fcff98a467 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py @@ -3,16 +3,16 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.finance_book.test_finance_book import create_finance_book from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.utils import get_fiscal_year +from erpnext.tests.utils import ERPNextTestSuite -class TestPeriodClosingVoucher(IntegrationTestCase): +class TestPeriodClosingVoucher(ERPNextTestSuite): def setUp(self): super().setUp() frappe.db.set_single_value("Accounts Settings", "use_legacy_controller_for_pcv", 1) diff --git a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py index 148a5a83030..6041d4fcac1 100644 --- a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py +++ b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( create_dimension, @@ -22,9 +21,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle get_batch_from_bundle, ) from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSClosingEntry(IntegrationTestCase): +class TestPOSClosingEntry(ERPNextTestSuite): @classmethod def setUpClass(cls): frappe.db.sql("delete from `tabPOS Opening Entry`") @@ -302,7 +302,7 @@ class TestPOSClosingEntry(IntegrationTestCase): batch_qty_with_pos = get_batch_qty(batch_no, "_Test Warehouse - _TC", item_code) self.assertEqual(batch_qty_with_pos, 10.0) - @IntegrationTestCase.change_settings("POS Settings", {"invoice_type": "Sales Invoice"}) + @ERPNextTestSuite.change_settings("POS Settings", {"invoice_type": "Sales Invoice"}) def test_closing_entries_with_sales_invoice(self): test_user, pos_profile = init_user_and_profile() opening_entry = create_opening_entry(pos_profile, test_user.name) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 1a94e1c9990..d321ac3ae42 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -5,7 +5,6 @@ import unittest import frappe from frappe import _ -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.mode_of_payment.test_mode_of_payment import ( set_default_account_for_mode_of_payment, @@ -22,9 +21,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle make_serial_batch_bundle, ) from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSInvoice(IntegrationTestCase): +class TestPOSInvoice(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py index 5403b10476c..c3381eec4e5 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py @@ -3,7 +3,6 @@ import json import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.mode_of_payment.test_mode_of_payment import ( set_default_account_for_mode_of_payment, @@ -19,9 +18,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle get_serial_nos_from_bundle, ) from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSInvoiceMergeLog(IntegrationTestCase): +class TestPOSInvoiceMergeLog(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -315,7 +315,7 @@ class TestPOSInvoiceMergeLog(IntegrationTestCase): self.assertNotEqual(consolidated_invoice.outstanding_amount, 800) self.assertEqual(consolidated_invoice.status, "Paid") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "System Settings", {"number_format": "#,###.###", "currency_precision": 3, "float_precision": 3} ) def test_consolidation_round_off_error_3(self): diff --git a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py index 2b23f94932f..5cca1ad72b8 100644 --- a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py +++ b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py @@ -4,21 +4,23 @@ import unittest import frappe from frappe.core.doctype.user_permission.test_user_permission import create_user -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_invoice from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSOpeningEntry(IntegrationTestCase): +class TestPOSOpeningEntry(ERPNextTestSuite): @classmethod def setUpClass(cls): + super().setUpClass() frappe.db.sql("delete from `tabPOS Opening Entry`") cls.enterClassContext(cls.change_settings("POS Settings", {"invoice_type": "POS Invoice"})) @classmethod def tearDownClass(cls): + super().tearDownClass() frappe.db.sql("delete from `tabPOS Opening Entry`") def setUp(self): diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py index a52933487f4..1e874579a98 100644 --- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -3,16 +3,16 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import cint from erpnext.accounts.doctype.pos_profile.pos_profile import ( get_child_nodes, ) from erpnext.stock.get_item_details import get_pos_profile +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSProfile(IntegrationTestCase): +class TestPOSProfile(ERPNextTestSuite): def test_pos_profile(self): make_pos_profile() diff --git a/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py b/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py index b9747ff5799..2e3b68eeac5 100644 --- a/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py +++ b/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSProfileUser(IntegrationTestCase): +class TestPOSProfileUser(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py index 1ae75140714..9335efbed07 100644 --- a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py +++ b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSSettings(IntegrationTestCase): +class TestPOSSettings(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index f4c9709e3f3..6312a2e4fb6 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -5,7 +5,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -13,9 +12,10 @@ from erpnext.controllers.sales_and_purchase_return import make_return_doc from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.get_item_details import get_item_details +from erpnext.tests.utils import ERPNextTestSuite -class TestPricingRule(IntegrationTestCase): +class TestPricingRule(ERPNextTestSuite): def setUp(self): delete_existing_pricing_rules() setup_pricing_rule_data() diff --git a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py index 8d35b7fcf85..eb69562e0d4 100644 --- a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py +++ b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( create_sales_invoice, ) from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestProcessDeferredAccounting(IntegrationTestCase): +class TestProcessDeferredAccounting(ERPNextTestSuite): def test_creation_of_ledger_entry_on_submit(self): """test creation of gl entries on submission of document""" change_acc_settings(acc_frozen_till_date="2023-05-31", book_deferred_entries_based_on="Months") diff --git a/erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py b/erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py index d54ff6f902e..eff49ecadc5 100644 --- a/erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py +++ b/erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestProcessPaymentReconciliation(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestProcessPaymentReconciliation(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py b/erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py index 66a4dca21e1..26c4b5a4a1c 100644 --- a/erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py +++ b/erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestProcessPaymentReconciliationLog(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestProcessPaymentReconciliationLog(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py index 2d599fee1af..44f5bf9c3ff 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py +++ b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, today from erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of_accounts import ( @@ -12,9 +11,10 @@ from erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of ) from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestProcessStatementOfAccounts(AccountsTestMixin, IntegrationTestCase): +class TestProcessStatementOfAccounts(AccountsTestMixin, ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/process_subscription/test_process_subscription.py b/erpnext/accounts/doctype/process_subscription/test_process_subscription.py index 5ec80641192..8c7604b8f5c 100644 --- a/erpnext/accounts/doctype/process_subscription/test_process_subscription.py +++ b/erpnext/accounts/doctype/process_subscription/test_process_subscription.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestProcessSubscription(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestProcessSubscription(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py index 413ce1af792..cebdaa4fca8 100644 --- a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py +++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py @@ -3,13 +3,13 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.promotional_scheme.promotional_scheme import TransactionExists from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite -class TestPromotionalScheme(IntegrationTestCase): +class TestPromotionalScheme(ERPNextTestSuite): def setUp(self): if frappe.db.exists("Promotional Scheme", "_Test Scheme"): frappe.delete_doc("Promotional Scheme", "_Test Scheme") diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index b28b1a2c4a8..4260bfbb5d8 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cint, flt, getdate, nowdate, today import erpnext @@ -37,9 +36,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle ) from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction from erpnext.stock.tests.test_utils import StockTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): +class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): @classmethod def setUpClass(cls): super().setUpClass() @@ -506,9 +506,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): self.assertEqual(tax.tax_amount, expected_values[i][1]) self.assertEqual(tax.total, expected_values[i][2]) - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_purchase_invoice_with_advance(self): jv = frappe.copy_doc(self.globalTestRecords["Journal Entry"][1]) jv.insert() @@ -559,9 +557,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): ) ) - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_invoice_with_advance_and_multi_payment_terms(self): jv = frappe.copy_doc(self.globalTestRecords["Journal Entry"][1]) jv.insert() @@ -1286,9 +1282,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): acc_settings.submit_journal_entriessubmit_journal_entries = 0 acc_settings.save() - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_gain_loss_with_advance_entry(self): unlink_enabled = frappe.db.get_single_value( "Accounts Settings", "unlink_payment_on_cancellation_of_invoice" @@ -1489,9 +1483,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): ) frappe.db.set_value("Company", "_Test Company", "exchange_gain_loss_account", original_account) - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_purchase_invoice_advance_taxes(self): from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -2157,7 +2149,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): rate = flt(sle.stock_value_difference) / flt(sle.actual_qty) self.assertAlmostEqual(rate, 500) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_allocation_for_payment_terms(self): from erpnext.buying.doctype.purchase_order.test_purchase_order import ( create_pr_against_po, @@ -2292,7 +2284,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): pi.delete() - @IntegrationTestCase.change_settings("Buying Settings", {"supplier_group": None}) + @ERPNextTestSuite.change_settings("Buying Settings", {"supplier_group": None}) def test_purchase_invoice_without_supplier_group(self): # Create a Supplier test_supplier_name = "_Test Supplier Without Supplier Group" @@ -2639,7 +2631,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): frappe.db.set_single_value("Buying Settings", "maintain_same_rate", 1) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Buying Settings", {"maintain_same_rate": 0, "set_landed_cost_based_on_purchase_invoice_rate": 1} ) def test_pr_status_rate_adjusted_from_pi(self): diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py index 80ce28c4ffd..5dbd05a17f6 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseTaxesandChargesTemplate(IntegrationTestCase): +class TestPurchaseTaxesandChargesTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py index cde007d14f6..6e0712972da 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py @@ -4,7 +4,6 @@ import frappe from frappe import qb from frappe.query_builder.functions import Sum -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate, today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -14,9 +13,10 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import get_fiscal_year from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries, make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestRepostAccountingLedger(AccountsTestMixin, IntegrationTestCase): +class TestRepostAccountingLedger(AccountsTestMixin, ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -121,7 +121,7 @@ class TestRepostAccountingLedger(AccountsTestMixin, IntegrationTestCase): ral.append("vouchers", {"voucher_type": si.doctype, "voucher_no": si.name}) self.assertRaises(frappe.ValidationError, ral.save) - @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) def test_04_pcv_validation(self): # Clear old GL entries so PCV can be submitted. gl = frappe.qb.DocType("GL Entry") diff --git a/erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py b/erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py index 2dd4c50ba7e..6a8698e96af 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestRepostAccountingLedgerSettings(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestRepostAccountingLedgerSettings(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py b/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py index a09ba71e27c..8c2b8946121 100644 --- a/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py +++ b/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestRepostPaymentLedger(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestRepostPaymentLedger(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 732ada84886..4c9c5f72e2e 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -7,7 +7,6 @@ import json import frappe from frappe import qb from frappe.model.dynamic_links import get_dynamic_link_map -from frappe.tests import IntegrationTestCase, change_settings from frappe.utils import add_days, cint, flt, format_date, getdate, nowdate, today import erpnext @@ -66,7 +65,7 @@ class TestSalesInvoice(ERPNextTestSuite): for company in frappe.get_all("Company", pluck="name"): frappe.db.set_value("Company", company, "accounts_frozen_till_date", None) - @change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"maintain_same_internal_transaction_rate": 1, "maintain_same_rate_action": "Stop"}, ) @@ -229,9 +228,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertRaises(frappe.LinkExistsError, si.cancel) unlink_payment_on_cancel_of_invoice() - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_payment_entry_unlink_against_standalone_credit_note(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry @@ -844,7 +841,7 @@ class TestSalesInvoice(ERPNextTestSuite): w = self.make() self.assertEqual(w.outstanding_amount, w.base_rounded_total) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"add_taxes_from_item_tax_template": 0, "add_taxes_from_taxes_and_charges_template": 0}, ) @@ -1401,9 +1398,7 @@ class TestSalesInvoice(ERPNextTestSuite): dn.submit() return dn - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_sales_invoice_with_advance(self): jv = frappe.copy_doc(self.globalTestRecords["Journal Entry"][0]) jv.insert() @@ -2484,7 +2479,7 @@ class TestSalesInvoice(ERPNextTestSuite): for gle in gl_entries: self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"book_deferred_entries_based_on": "Days", "book_deferred_entries_via_journal_entry": 0}, ) @@ -2540,7 +2535,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertRaises(frappe.ValidationError, si.save) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"book_deferred_entries_based_on": "Months", "book_deferred_entries_via_journal_entry": 0}, ) @@ -3005,7 +3000,7 @@ class TestSalesInvoice(ERPNextTestSuite): si.submit() - @IntegrationTestCase.change_settings("Selling Settings", {"enable_discount_accounting": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"enable_discount_accounting": 1}) def test_sales_invoice_with_discount_accounting_enabled(self): discount_account = create_account( account_name="Discount Account", @@ -3022,7 +3017,7 @@ class TestSalesInvoice(ERPNextTestSuite): check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1)) - @IntegrationTestCase.change_settings("Selling Settings", {"enable_discount_accounting": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"enable_discount_accounting": 1}) def test_additional_discount_for_sales_invoice_with_discount_accounting_enabled(self): from erpnext.accounts.doctype.repost_accounting_ledger.test_repost_accounting_ledger import ( update_repost_settings, @@ -3449,6 +3444,7 @@ class TestSalesInvoice(ERPNextTestSuite): si.commission_rate = commission_rate self.assertRaises(frappe.ValidationError, si.save) + @ERPNextTestSuite.change_settings("Accounts Settings", {"acc_frozen_upto": add_days(getdate(), 1)}) def test_sales_invoice_submission_post_account_freezing_date(self): frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", add_days(getdate(), 1)) si = create_sales_invoice(do_not_save=True) @@ -3460,7 +3456,7 @@ class TestSalesInvoice(ERPNextTestSuite): si.submit() frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", None) - @IntegrationTestCase.change_settings("Accounts Settings", {"over_billing_allowance": 0}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"over_billing_allowance": 0}) def test_over_billing_case_against_delivery_note(self): """ Test a case where duplicating the item with qty = 1 in the invoice @@ -3486,7 +3482,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertTrue("cannot overbill" in str(err.exception).lower()) dn.cancel() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "book_deferred_entries_via_journal_entry": 1, @@ -3604,9 +3600,7 @@ class TestSalesInvoice(ERPNextTestSuite): account.disabled = 0 account.save() - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_gain_loss_with_advance_entry(self): from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry @@ -3769,7 +3763,7 @@ class TestSalesInvoice(ERPNextTestSuite): set_advance_flag(company="_Test Company", flag=0, default_account="") - @IntegrationTestCase.change_settings("Selling Settings", {"customer_group": None, "territory": None}) + @ERPNextTestSuite.change_settings("Selling Settings", {"customer_group": None, "territory": None}) def test_sales_invoice_without_customer_group_and_territory(self): # create a customer if not frappe.db.exists("Customer", "_Test Simple Customer"): @@ -3787,7 +3781,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(si.customer_group, None) self.assertEqual(si.territory, None) - @IntegrationTestCase.change_settings("Selling Settings", {"allow_negative_rates_for_items": 0}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_negative_rates_for_items": 0}) def test_sales_return_negative_rate(self): si = create_sales_invoice(is_return=1, qty=-2, rate=-10, do_not_save=True) self.assertRaises(frappe.ValidationError, si.save) @@ -4201,7 +4195,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(len(actual), 4) self.assertEqual(expected, actual) - @IntegrationTestCase.change_settings("Accounts Settings", {"enable_common_party_accounting": True}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"enable_common_party_accounting": True}) def test_common_party_with_foreign_currency_jv(self): from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import ( @@ -4283,7 +4277,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertTrue(jv) self.assertEqual(jv[0], si.grand_total) - @IntegrationTestCase.change_settings("Accounts Settings", {"enable_common_party_accounting": True}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"enable_common_party_accounting": True}) def test_common_party_with_different_currency_in_debtor_and_creditor(self): from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import ( @@ -4745,7 +4739,7 @@ class TestSalesInvoice(ERPNextTestSuite): doc.db_set("do_not_use_batchwise_valuation", original_value) - @change_settings("Selling Settings", {"set_zero_rate_for_expired_batch": True}) + @ERPNextTestSuite.change_settings("Selling Settings", {"set_zero_rate_for_expired_batch": True}) def test_zero_valuation_for_standalone_credit_note_with_expired_batch(self): item_code = "_Test Item for Expiry Batch Zero Valuation" make_item_for_si( diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py index 1684ca82cbd..6c9c1d8c206 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py @@ -2,9 +2,8 @@ # See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesTaxesandChargesTemplate(IntegrationTestCase): +class TestSalesTaxesandChargesTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py index 3b9e34cc03c..a227a9f3059 100644 --- a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py +++ b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.share_transfer.share_transfer import ShareDontExists +from erpnext.tests.utils import ERPNextTestSuite -class TestShareTransfer(IntegrationTestCase): +class TestShareTransfer(ERPNextTestSuite): def setUp(self): frappe.db.sql("delete from `tabShare Transfer`") frappe.db.sql("delete from `tabShare Balance`") diff --git a/erpnext/accounts/doctype/share_type/test_share_type.py b/erpnext/accounts/doctype/share_type/test_share_type.py index e6f1f71f4bb..3aa79f53018 100644 --- a/erpnext/accounts/doctype/share_type/test_share_type.py +++ b/erpnext/accounts/doctype/share_type/test_share_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestShareType(IntegrationTestCase): +class TestShareType(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/shareholder/test_shareholder.py b/erpnext/accounts/doctype/shareholder/test_shareholder.py index 3c0f34858f9..4c4cc0b789e 100644 --- a/erpnext/accounts/doctype/shareholder/test_shareholder.py +++ b/erpnext/accounts/doctype/shareholder/test_shareholder.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestShareholder(IntegrationTestCase): +class TestShareholder(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py index be05f5662db..7a36be65817 100644 --- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py @@ -3,16 +3,16 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.shipping_rule.shipping_rule import ( FromGreaterThanToError, ManyBlankToValuesError, OverlappingConditionError, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestShippingRule(IntegrationTestCase): +class TestShippingRule(ERPNextTestSuite): def test_from_greater_than_to(self): shipping_rule = frappe.copy_doc(self.globalTestRecords["Shipping Rule"][0]) shipping_rule.name = self.globalTestRecords["Shipping Rule"][0].get("name") diff --git a/erpnext/accounts/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py index 8dfdb116f36..6e8d72ee9f0 100644 --- a/erpnext/accounts/doctype/subscription/test_subscription.py +++ b/erpnext/accounts/doctype/subscription/test_subscription.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.data import ( add_days, add_months, @@ -19,9 +18,10 @@ from frappe.utils.data import ( from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.subscription.subscription import get_prorata_factor +from erpnext.tests.utils import ERPNextTestSuite -class TestSubscription(IntegrationTestCase): +class TestSubscription(ERPNextTestSuite): def setUp(self): make_plans() create_parties() @@ -470,7 +470,7 @@ class TestSubscription(IntegrationTestCase): currency = frappe.db.get_value("Sales Invoice", subscription.invoices[0].name, "currency") self.assertEqual(currency, "USD") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1}, ) diff --git a/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py b/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py index a176a99a9b8..983526fc297 100644 --- a/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py +++ b/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSubscriptionInvoice(IntegrationTestCase): +class TestSubscriptionInvoice(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py index 19b9285b1d8..f2ae2ce85b8 100644 --- a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py +++ b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSubscriptionPlan(IntegrationTestCase): +class TestSubscriptionPlan(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py b/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py index 5d6607cb0cd..ce9193e1130 100644 --- a/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py +++ b/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSubscriptionSettings(IntegrationTestCase): +class TestSubscriptionSettings(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/tax_category/test_tax_category.py b/erpnext/accounts/doctype/tax_category/test_tax_category.py index fbe654999f1..3eba2808ddb 100644 --- a/erpnext/accounts/doctype/tax_category/test_tax_category.py +++ b/erpnext/accounts/doctype/tax_category/test_tax_category.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxCategory(IntegrationTestCase): +class TestTaxCategory(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py index 2602ea14861..f0bc9696b66 100644 --- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py @@ -3,14 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule, get_tax_template from erpnext.crm.doctype.opportunity.opportunity import make_quotation from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxRule(IntegrationTestCase): +class TestTaxRule(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index bf1eef735b0..922203637e9 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -5,15 +5,15 @@ import datetime import frappe from frappe.custom.doctype.custom_field.custom_field import create_custom_fields -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_months, today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.utils import get_fiscal_year from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxWithholdingCategory(IntegrationTestCase): +class TestTaxWithholdingCategory(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -2047,7 +2047,7 @@ class TestTaxWithholdingCategory(IntegrationTestCase): self.assertEqual(pi2.taxes, []) self.assertEqual(payment.taxes[0].tax_amount, 6000) - @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) def test_tds_payment_entry_cancellation(self): """ Test payment entry cancellation clears withholding references from matched entries @@ -2225,7 +2225,7 @@ class TestTaxWithholdingCategory(IntegrationTestCase): self.validate_tax_withholding_entries("Purchase Invoice", pi1.name, expected_entries) self.cleanup_invoices(invoices) - @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) def test_tds_purchase_invoice_cancellation(self): """ Test that after cancellation, new documents get automatically adjusted against remaining entries diff --git a/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py b/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py index acd30cc47b7..3b24b4f6242 100644 --- a/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py +++ b/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry @@ -12,9 +11,10 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite -class TestUnreconcilePayment(AccountsTestMixin, IntegrationTestCase): +class TestUnreconcilePayment(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/account_balance/test_account_balance.py b/erpnext/accounts/report/account_balance/test_account_balance.py index 37d6f292fb6..f166421b0de 100644 --- a/erpnext/accounts/report/account_balance/test_account_balance.py +++ b/erpnext/accounts/report/account_balance/test_account_balance.py @@ -1,14 +1,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.account_balance.account_balance import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountBalance(IntegrationTestCase): +class TestAccountBalance(ERPNextTestSuite): def test_account_balance(self): frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company 2'") frappe.db.sql("delete from `tabGL Entry` where company='_Test Company 2'") diff --git a/erpnext/accounts/report/accounts_payable/test_accounts_payable.py b/erpnext/accounts/report/accounts_payable/test_accounts_payable.py index 8da40ea3aa4..6c306f36966 100644 --- a/erpnext/accounts/report/accounts_payable/test_accounts_payable.py +++ b/erpnext/accounts/report/accounts_payable/test_accounts_payable.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.report.accounts_payable.accounts_payable import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountsPayable(AccountsTestMixin, IntegrationTestCase): +class TestAccountsPayable(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py index 907840e8ff4..d8836c96479 100644 --- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py @@ -1,6 +1,5 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, getdate, today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -8,9 +7,10 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal from erpnext.accounts.report.accounts_receivable.accounts_receivable import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): +class TestAccountsReceivable(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() @@ -199,7 +199,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): row = report[1] self.assertTrue(len(row) == 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1}, ) @@ -448,7 +448,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): ], ) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) diff --git a/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py index d357c0d6273..9955d1f7af9 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py @@ -1,14 +1,14 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): +class TestAccountsReceivable(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.maxDiff = None self.create_company() @@ -112,7 +112,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): self.assertEqual(len(rpt_output), 1) self.assertDictEqual(rpt_output[0], expected_data) - @IntegrationTestCase.change_settings("Selling Settings", {"cust_master_name": "Naming Series"}) + @ERPNextTestSuite.change_settings("Selling Settings", {"cust_master_name": "Naming Series"}) def test_02_various_filters_and_output(self): filters = { "company": self.company, diff --git a/erpnext/accounts/report/balance_sheet/test_balance_sheet.py b/erpnext/accounts/report/balance_sheet/test_balance_sheet.py index 56e3505fafd..dce9d8ab0fa 100644 --- a/erpnext/accounts/report/balance_sheet/test_balance_sheet.py +++ b/erpnext/accounts/report/balance_sheet/test_balance_sheet.py @@ -2,16 +2,16 @@ # MIT License. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.data import today from erpnext.accounts.report.balance_sheet.balance_sheet import execute +from erpnext.tests.utils import ERPNextTestSuite COMPANY = "_Test Company 6" COMPANY_SHORT_NAME = "_TC6" -class TestBalanceSheet(IntegrationTestCase): +class TestBalanceSheet(ERPNextTestSuite): def test_balance_sheet(self): frappe.db.sql(f"delete from `tabJournal Entry` where company='{COMPANY}'") frappe.db.sql(f"delete from `tabGL Entry` where company='{COMPANY}'") diff --git a/erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py index 1fed7a43f7d..2e73a001107 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py +++ b/erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py @@ -2,15 +2,14 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement import ( execute, ) -from erpnext.tests.utils import if_lending_app_installed +from erpnext.tests.utils import ERPNextTestSuite, if_lending_app_installed -class TestBankReconciliationStatement(IntegrationTestCase): +class TestBankReconciliationStatement(ERPNextTestSuite): @if_lending_app_installed def test_loan_entries_in_bank_reco_statement(self): from lending.loan_management.doctype.loan.test_loan import create_loan_accounts diff --git a/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py b/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py index 14e88afca39..ddd88eb0018 100644 --- a/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py +++ b/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py @@ -1,16 +1,16 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase -from frappe.utils import add_days, flt, getdate, today +from frappe.utils import today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.customer_ledger_summary.customer_ledger_summary import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.controllers.sales_and_purchase_return import make_return_doc +from erpnext.tests.utils import ERPNextTestSuite -class TestCustomerLedgerSummary(AccountsTestMixin, IntegrationTestCase): +class TestCustomerLedgerSummary(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py index fcd9075a30f..eb26fce4038 100644 --- a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py +++ b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py @@ -1,6 +1,5 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.doctype.account.test_account import create_account @@ -11,9 +10,10 @@ from erpnext.accounts.report.deferred_revenue_and_expense.deferred_revenue_and_e ) from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import get_fiscal_year +from erpnext.tests.utils import ERPNextTestSuite -class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): +class TestDeferredRevenueAndExpense(ERPNextTestSuite, AccountsTestMixin): maxDiff = None def clear_old_entries(self): @@ -70,7 +70,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): def tearDown(self): frappe.db.rollback() - @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) def test_deferred_revenue(self): self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company) item = frappe.get_doc("Item", self.item) @@ -137,7 +137,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): ] self.assertEqual(report.period_total, expected) - @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) def test_deferred_expense(self): self.create_item("_Test Office Desk", 0, self.warehouse, self.company) item = frappe.get_doc("Item", self.item) @@ -207,7 +207,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): ] self.assertEqual(report.period_total, expected) - @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) def test_zero_months(self): self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company) item = frappe.get_doc("Item", self.item) @@ -272,7 +272,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): ] self.assertEqual(report.period_total, expected) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"book_deferred_entries_based_on": "Months", "book_deferred_entries_via_journal_entry": 0}, ) diff --git a/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py b/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py index 8c33bc90965..c39aa824629 100644 --- a/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py +++ b/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py @@ -1,6 +1,5 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -8,9 +7,10 @@ from erpnext.accounts.report.general_and_payment_ledger_comparison.general_and_p execute, ) from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestGeneralAndPaymentLedger(IntegrationTestCase, AccountsTestMixin): +class TestGeneralAndPaymentLedger(ERPNextTestSuite, AccountsTestMixin): def setUp(self): self.create_company() self.cleanup() diff --git a/erpnext/accounts/report/general_ledger/test_general_ledger.py b/erpnext/accounts/report/general_ledger/test_general_ledger.py index 24280d4d620..8f558467192 100644 --- a/erpnext/accounts/report/general_ledger/test_general_ledger.py +++ b/erpnext/accounts/report/general_ledger/test_general_ledger.py @@ -3,15 +3,15 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import flt, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.general_ledger.general_ledger import execute from erpnext.controllers.sales_and_purchase_return import make_return_doc +from erpnext.tests.utils import ERPNextTestSuite -class TestGeneralLedger(IntegrationTestCase): +class TestGeneralLedger(ERPNextTestSuite): def setUp(self): self.company = "_Test Company" self.clear_old_entries() diff --git a/erpnext/accounts/report/gross_profit/test_gross_profit.py b/erpnext/accounts/report/gross_profit/test_gross_profit.py index bf52e127544..03473426210 100644 --- a/erpnext/accounts/report/gross_profit/test_gross_profit.py +++ b/erpnext/accounts/report/gross_profit/test_gross_profit.py @@ -1,6 +1,5 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, get_first_day, get_last_day, nowdate from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_delivery_note, make_sales_return @@ -10,9 +9,10 @@ from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestGrossProfit(IntegrationTestCase): +class TestGrossProfit(ERPNextTestSuite): def setUp(self): self.create_company() self.create_item() diff --git a/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py index 5a2fe7e23ce..dc0feff3554 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate, today from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.report.item_wise_purchase_register.item_wise_purchase_register import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestItemWisePurchaseRegister(AccountsTestMixin, IntegrationTestCase): +class TestItemWisePurchaseRegister(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_supplier() diff --git a/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py index 09a2b4a46d6..bb051c5c6e6 100644 --- a/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestItemWiseSalesRegister(AccountsTestMixin, IntegrationTestCase): +class TestItemWiseSalesRegister(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/payment_ledger/test_payment_ledger.py b/erpnext/accounts/report/payment_ledger/test_payment_ledger.py index 1225fb70101..00206059672 100644 --- a/erpnext/accounts/report/payment_ledger/test_payment_ledger.py +++ b/erpnext/accounts/report/payment_ledger/test_payment_ledger.py @@ -1,13 +1,13 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.payment_ledger.payment_ledger import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentLedger(IntegrationTestCase): +class TestPaymentLedger(ERPNextTestSuite): def setUp(self): self.create_company() self.cleanup() diff --git a/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py index 4f1a08370a4..172e131efe5 100644 --- a/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py +++ b/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py @@ -3,16 +3,16 @@ import frappe from frappe.desk.query_report import export_query -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.financial_statements import get_period_list from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestProfitAndLossStatement(AccountsTestMixin, IntegrationTestCase): +class TestProfitAndLossStatement(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/purchase_register/test_purchase_register.py b/erpnext/accounts/report/purchase_register/test_purchase_register.py index 6f61c44db02..400ee899fa1 100644 --- a/erpnext/accounts/report/purchase_register/test_purchase_register.py +++ b/erpnext/accounts/report/purchase_register/test_purchase_register.py @@ -2,13 +2,13 @@ # MIT License. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, today from erpnext.accounts.report.purchase_register.purchase_register import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseRegister(IntegrationTestCase): +class TestPurchaseRegister(ERPNextTestSuite): def test_purchase_register(self): frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company 6'") frappe.db.sql("delete from `tabGL Entry` where company='_Test Company 6'") diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py index 77fcc82c0de..52c240cc60f 100644 --- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py +++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -11,9 +10,10 @@ from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import get_mode_of_payment_details, get_mode_of_payments, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPaymentSummary(IntegrationTestCase): +class TestSalesPaymentSummary(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/report/sales_register/test_sales_register.py b/erpnext/accounts/report/sales_register/test_sales_register.py index 50f12e52e33..f4292e76471 100644 --- a/erpnext/accounts/report/sales_register/test_sales_register.py +++ b/erpnext/accounts/report/sales_register/test_sales_register.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.sales_register.sales_register import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestItemWiseSalesRegister(AccountsTestMixin, IntegrationTestCase): +class TestItemWiseSalesRegister(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py b/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py index 376495b5cc9..6029612666c 100644 --- a/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py +++ b/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.report.supplier_ledger_summary.supplier_ledger_summary import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierLedgerSummary(AccountsTestMixin, IntegrationTestCase): +class TestSupplierLedgerSummary(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_supplier() diff --git a/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py index 30a5df3fcb2..76ed8c79210 100644 --- a/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py +++ b/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py @@ -2,7 +2,6 @@ # MIT License. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, today from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry @@ -14,9 +13,10 @@ from erpnext.accounts.doctype.tax_withholding_category.test_tax_withholding_cate from erpnext.accounts.report.tax_withholding_details.tax_withholding_details import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import get_fiscal_year +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxWithholdingDetails(AccountsTestMixin, IntegrationTestCase): +class TestTaxWithholdingDetails(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.clear_old_entries() diff --git a/erpnext/accounts/report/trial_balance/test_trial_balance.py b/erpnext/accounts/report/trial_balance/test_trial_balance.py index a7922b716e7..4c0c762284e 100644 --- a/erpnext/accounts/report/trial_balance/test_trial_balance.py +++ b/erpnext/accounts/report/trial_balance/test_trial_balance.py @@ -2,13 +2,13 @@ # MIT License. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.report.trial_balance.trial_balance import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestTrialBalance(IntegrationTestCase): +class TestTrialBalance(ERPNextTestSuite): def setUp(self): from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center diff --git a/erpnext/accounts/test/test_reports.py b/erpnext/accounts/test/test_reports.py index c58269dde23..8c27452264c 100644 --- a/erpnext/accounts/test/test_reports.py +++ b/erpnext/accounts/test/test_reports.py @@ -1,8 +1,4 @@ -import unittest - -from frappe.tests import IntegrationTestCase - -from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report +from erpnext.tests.utils import ERPNextTestSuite, ReportFilters, ReportName, execute_script_report DEFAULT_FILTERS = { "company": "_Test Company", @@ -36,7 +32,7 @@ REPORT_FILTER_TEST_CASES: list[tuple[ReportName, ReportFilters]] = [ OPTIONAL_FILTERS = {} -class TestReports(IntegrationTestCase): +class TestReports(ERPNextTestSuite): def test_execute_all_accounts_reports(self): """Test that all script report in stock modules are executable with supported filters""" for report, filter in REPORT_FILTER_TEST_CASES: diff --git a/erpnext/accounts/test/test_utils.py b/erpnext/accounts/test/test_utils.py index fd2dc61096e..5eb652e2112 100644 --- a/erpnext/accounts/test/test_utils.py +++ b/erpnext/accounts/test/test_utils.py @@ -2,7 +2,6 @@ import unittest import frappe from frappe.test_runner import make_test_objects -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice @@ -16,9 +15,10 @@ from erpnext.accounts.utils import ( from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestUtils(IntegrationTestCase): +class TestUtils(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/test_party.py b/erpnext/accounts/test_party.py index 986a5b5d680..0f477103da4 100644 --- a/erpnext/accounts/test_party.py +++ b/erpnext/accounts/test_party.py @@ -1,10 +1,10 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.party import get_default_price_list +from erpnext.tests.utils import ERPNextTestSuite -class PartyTestCase(IntegrationTestCase): +class PartyTestCase(ERPNextTestSuite): def test_get_default_price_list_should_return_none_for_invalid_group(self): customer = frappe.get_doc( { diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 62e532f322f..87af87a30a4 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import ( add_days, add_months, @@ -37,9 +36,10 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( make_purchase_invoice as make_invoice, ) from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class AssetSetup(IntegrationTestCase): +class AssetSetup(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/assets/doctype/asset_activity/test_asset_activity.py b/erpnext/assets/doctype/asset_activity/test_asset_activity.py index 1c7d472c88b..0344c7d984b 100644 --- a/erpnext/assets/doctype/asset_activity/test_asset_activity.py +++ b/erpnext/assets/doctype/asset_activity/test_asset_activity.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestAssetActivity(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestAssetActivity(ERPNextTestSuite): pass diff --git a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py index 914b87b728f..2e05f24e06e 100644 --- a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py @@ -3,8 +3,7 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import cint, flt, getdate, now_datetime +from frappe.utils import cint, flt, now_datetime from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries from erpnext.assets.doctype.asset.test_asset import ( @@ -21,9 +20,10 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_pu from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle import ( make_serial_batch_bundle, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetCapitalization(IntegrationTestCase): +class TestAssetCapitalization(ERPNextTestSuite): def setUp(self): set_depreciation_settings_in_company() create_asset_data() diff --git a/erpnext/assets/doctype/asset_category/test_asset_category.py b/erpnext/assets/doctype/asset_category/test_asset_category.py index 0f903c7f03a..9f1e6821b43 100644 --- a/erpnext/assets/doctype/asset_category/test_asset_category.py +++ b/erpnext/assets/doctype/asset_category/test_asset_category.py @@ -3,10 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.assets.doctype.asset.test_asset import create_asset +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetCategory(IntegrationTestCase): +class TestAssetCategory(ERPNextTestSuite): def test_mandatory_fields(self): asset_category = frappe.new_doc("Asset Category") asset_category.asset_category_name = "Computers" diff --git a/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py b/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py index 824c7cbba1f..c3184f5b224 100644 --- a/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py +++ b/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py @@ -2,8 +2,7 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import cstr, date_diff, flt, getdate +from frappe.utils import cstr, flt, getdate from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.assets.doctype.asset.depreciation import ( @@ -18,9 +17,10 @@ from erpnext.assets.doctype.asset_repair.test_asset_repair import create_asset_r from erpnext.assets.doctype.asset_value_adjustment.test_asset_value_adjustment import ( make_asset_value_adjustment, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetDepreciationSchedule(IntegrationTestCase): +class TestAssetDepreciationSchedule(ERPNextTestSuite): def setUp(self): create_asset_data() diff --git a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py index 391872c8438..7077789e387 100644 --- a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py +++ b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py @@ -3,14 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, get_last_day, nowdate from erpnext.assets.doctype.asset_maintenance.asset_maintenance import calculate_next_due_date from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetMaintenance(IntegrationTestCase): +class TestAssetMaintenance(ERPNextTestSuite): def setUp(self): set_depreciation_settings_in_company() self.pr = make_purchase_receipt( diff --git a/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py b/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py index 6d19f5b17d9..e5f421c94ed 100644 --- a/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py +++ b/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetMaintenanceLog(IntegrationTestCase): +class TestAssetMaintenanceLog(ERPNextTestSuite): pass diff --git a/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py b/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py index 00441a8368a..6def5ed28b9 100644 --- a/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py +++ b/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetMaintenanceTeam(IntegrationTestCase): +class TestAssetMaintenanceTeam(ERPNextTestSuite): pass diff --git a/erpnext/assets/doctype/asset_movement/test_asset_movement.py b/erpnext/assets/doctype/asset_movement/test_asset_movement.py index 0cceb011a25..6e70c477d7c 100644 --- a/erpnext/assets/doctype/asset_movement/test_asset_movement.py +++ b/erpnext/assets/doctype/asset_movement/test_asset_movement.py @@ -3,15 +3,15 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, now from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data from erpnext.setup.doctype.employee.test_employee import make_employee from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetMovement(IntegrationTestCase): +class TestAssetMovement(ERPNextTestSuite): def setUp(self): frappe.db.set_value( "Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC" diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py index c56622d6665..9a837ca3853 100644 --- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py @@ -26,9 +26,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle get_serial_nos_from_bundle, make_serial_batch_bundle, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetRepair(IntegrationTestCase): +class TestAssetRepair(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py b/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py index 2764a2cc373..8c061615486 100644 --- a/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py +++ b/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py @@ -2,16 +2,16 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import cstr from erpnext.assets.doctype.asset.test_asset import create_asset from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_schedule import ( get_depr_schedule, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetShiftAllocation(IntegrationTestCase): +class TestAssetShiftAllocation(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py b/erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py index 12d68b02c5f..7470e55b6fb 100644 --- a/erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py +++ b/erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestAssetShiftFactor(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestAssetShiftFactor(ERPNextTestSuite): pass diff --git a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py index 1425bb9aa78..b732ddbf1a1 100644 --- a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py +++ b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cstr, get_last_day, getdate, nowdate from erpnext.assets.doctype.asset.asset import get_asset_value_after_depreciation @@ -14,9 +13,10 @@ from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_sched ) from erpnext.assets.doctype.asset_repair.test_asset_repair import create_asset_repair from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetValueAdjustment(IntegrationTestCase): +class TestAssetValueAdjustment(ERPNextTestSuite): def setUp(self): create_asset_data() frappe.db.set_value( diff --git a/erpnext/assets/doctype/location/test_location.py b/erpnext/assets/doctype/location/test_location.py index 8de97138f7b..771a99d2380 100644 --- a/erpnext/assets/doctype/location/test_location.py +++ b/erpnext/assets/doctype/location/test_location.py @@ -4,10 +4,11 @@ import json import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestLocation(IntegrationTestCase): +class TestLocation(ERPNextTestSuite): def runTest(self): locations = ["Basil Farm", "Division 1", "Field 1", "Block 1"] area = 0 diff --git a/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py b/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py index a4795c54a56..b53649b822d 100644 --- a/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py +++ b/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestMaintenanceTeamMember(IntegrationTestCase): +class TestMaintenanceTeamMember(ERPNextTestSuite): pass diff --git a/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py b/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py index 66e6456d103..e3909ea619a 100644 --- a/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py +++ b/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestBulkTransactionLog(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBulkTransactionLog(ERPNextTestSuite): pass diff --git a/erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py b/erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py index 6b9b4637ab4..ae35c697c31 100644 --- a/erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py +++ b/erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestBulkTransactionLogDetail(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBulkTransactionLogDetail(ERPNextTestSuite): pass diff --git a/erpnext/buying/doctype/buying_settings/test_buying_settings.py b/erpnext/buying/doctype/buying_settings/test_buying_settings.py index 04f95dbe745..c583ad6875e 100644 --- a/erpnext/buying/doctype/buying_settings/test_buying_settings.py +++ b/erpnext/buying/doctype/buying_settings/test_buying_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBuyingSettings(IntegrationTestCase): +class TestBuyingSettings(ERPNextTestSuite): pass diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index b815ae34e1c..f2803dd2b95 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -5,7 +5,7 @@ import json import frappe -from frappe.tests import IntegrationTestCase, change_settings +from frappe.tests import change_settings from frappe.utils import add_days, flt, getdate, nowdate from frappe.utils.data import today @@ -26,9 +26,10 @@ from erpnext.stock.doctype.material_request.test_material_request import make_ma from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( make_purchase_invoice as make_pi_from_pr, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseOrder(IntegrationTestCase): +class TestPurchaseOrder(ERPNextTestSuite): def test_purchase_order_qty(self): po = create_purchase_order(qty=1, do_not_save=True) @@ -540,7 +541,7 @@ class TestPurchaseOrder(IntegrationTestCase): self.assertRaises(frappe.ValidationError, pr.submit) self.assertRaises(frappe.ValidationError, pi.submit) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_make_purchase_invoice_with_terms(self): po = create_purchase_order(do_not_save=True) @@ -712,7 +713,7 @@ class TestPurchaseOrder(IntegrationTestCase): ) self.assertEqual(due_date, "2023-03-31") - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 0}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 0}) def test_terms_are_not_copied_if_automatically_fetch_payment_terms_is_unchecked(self): po = create_purchase_order(do_not_save=1) po.payment_terms_template = "_Test Payment Term Template" @@ -737,7 +738,7 @@ class TestPurchaseOrder(IntegrationTestCase): pi.insert() self.assertTrue(pi.get("payment_schedule")) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1} ) def test_advance_payment_entry_unlink_against_purchase_order(self): @@ -810,7 +811,7 @@ class TestPurchaseOrder(IntegrationTestCase): company_doc.book_advance_payments_in_separate_party_account = False company_doc.save() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1} ) def test_advance_paid_upon_payment_entry_cancellation(self): @@ -906,7 +907,7 @@ class TestPurchaseOrder(IntegrationTestCase): bo.load_from_db() self.assertEqual(bo.items[0].ordered_qty, 5) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_terms_are_fetched_when_creating_purchase_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template, @@ -1145,7 +1146,7 @@ class TestPurchaseOrder(IntegrationTestCase): # Test - 8: Since this PO is now fully subcontracted, creating a new SCO from it should throw error self.assertRaises(frappe.ValidationError, make_subcontracting_order, po.name) - @IntegrationTestCase.change_settings("Buying Settings", {"auto_create_subcontracting_order": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"auto_create_subcontracting_order": 1}) def test_auto_create_subcontracting_order(self): from erpnext.controllers.tests.test_subcontracting_controller import ( make_bom_for_subcontracted_items, @@ -1237,7 +1238,7 @@ class TestPurchaseOrder(IntegrationTestCase): po.reload() self.assertEqual(po.per_billed, 100) - @IntegrationTestCase.change_settings("Buying Settings", {"allow_zero_qty_in_purchase_order": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_zero_qty_in_purchase_order": 1}) def test_receive_zero_qty_purchase_order(self): """ Test the flow of a Unit Price PO and PR creation against it until completion. @@ -1286,7 +1287,7 @@ class TestPurchaseOrder(IntegrationTestCase): self.assertEqual(po.per_received, 100.0) self.assertEqual(po.status, "To Bill") - @IntegrationTestCase.change_settings("Buying Settings", {"allow_zero_qty_in_purchase_order": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_zero_qty_in_purchase_order": 1}) def test_bill_zero_qty_purchase_order(self): po = create_purchase_order(qty=0) @@ -1311,7 +1312,7 @@ class TestPurchaseOrder(IntegrationTestCase): self.assertFalse(po.per_billed) self.assertEqual(po.status, "To Receive and Bill") - @IntegrationTestCase.change_settings("Buying Settings", {"maintain_same_rate": 0}) + @ERPNextTestSuite.change_settings("Buying Settings", {"maintain_same_rate": 0}) def test_purchase_invoice_creation_with_partial_qty(self): po = create_purchase_order(qty=100, rate=10) diff --git a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py index 425d172629d..9201f6c4f2d 100644 --- a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py @@ -5,7 +5,7 @@ from urllib.parse import urlparse import frappe -from frappe.tests import IntegrationTestCase, change_settings +from frappe.tests import change_settings from frappe.utils import nowdate from erpnext.buying.doctype.request_for_quotation.request_for_quotation import ( @@ -19,9 +19,10 @@ from erpnext.crm.doctype.opportunity.opportunity import make_request_for_quotati from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity from erpnext.stock.doctype.item.test_item import make_item from erpnext.templates.pages.rfq import check_supplier_has_docname_access +from erpnext.tests.utils import ERPNextTestSuite -class TestRequestforQuotation(IntegrationTestCase): +class TestRequestforQuotation(ERPNextTestSuite): def test_rfq_qty(self): rfq = make_request_for_quotation(qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): @@ -222,7 +223,7 @@ class TestRequestforQuotation(IntegrationTestCase): supplier_doc.reload() self.assertTrue(supplier_doc.portal_users[0].user) - @IntegrationTestCase.change_settings("Buying Settings", {"allow_zero_qty_in_request_for_quotation": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_zero_qty_in_request_for_quotation": 1}) def test_supplier_quotation_from_zero_qty_rfq(self): rfq = make_request_for_quotation(qty=0) sq = make_supplier_quotation_from_rfq(rfq.name, for_supplier=rfq.get("suppliers")[0].supplier) @@ -231,7 +232,7 @@ class TestRequestforQuotation(IntegrationTestCase): self.assertEqual(sq.items[0].qty, 0) self.assertEqual(sq.items[0].item_code, rfq.items[0].item_code) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Buying Settings", { "allow_zero_qty_in_request_for_quotation": 1, diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index f1e2d88473b..663a7b48e46 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -3,15 +3,15 @@ import frappe -from frappe.tests import IntegrationTestCase, UnitTestCase +from frappe.tests import UnitTestCase from erpnext.accounts.party import get_due_date from erpnext.controllers.website_list_for_contact import get_customers_suppliers from erpnext.exceptions import PartyDisabled +from erpnext.tests.utils import ERPNextTestSuite - -class TestSupplier(IntegrationTestCase): +class TestSupplier(ERPNextTestSuite): def test_get_supplier_group_details(self): doc = frappe.new_doc("Supplier Group") doc.supplier_group_name = "_Testing Supplier Group" @@ -172,7 +172,10 @@ def create_supplier(**args): return doc -class TestSupplierPortal(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestSupplierPortal(ERPNextTestSuite): def test_portal_user_can_access_supplier_data(self): supplier = create_supplier() diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py index 7c2714ba671..6c644707fa1 100644 --- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py @@ -5,14 +5,15 @@ import json import frappe -from frappe.tests import IntegrationTestCase, change_settings +from frappe.tests import change_settings from frappe.utils import add_days, today from erpnext.buying.doctype.supplier_quotation.supplier_quotation import make_purchase_order from erpnext.controllers.accounts_controller import InvalidQtyError, update_child_qty_rate +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseOrder(IntegrationTestCase): +class TestPurchaseOrder(ERPNextTestSuite): def test_update_child_supplier_quotation_add_item(self): sq = frappe.copy_doc(self.globalTestRecords["Supplier Quotation"][0]) sq.submit() @@ -166,7 +167,7 @@ class TestPurchaseOrder(IntegrationTestCase): po.insert() - @IntegrationTestCase.change_settings("Buying Settings", {"allow_zero_qty_in_supplier_quotation": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_zero_qty_in_supplier_quotation": 1}) def test_map_purchase_order_from_zero_qty_supplier_quotation(self): sq = frappe.copy_doc(self.globalTestRecords["Supplier Quotation"][0]) sq.items[0].qty = 0 diff --git a/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py index c65ebe2086f..a1d1dfc4709 100644 --- a/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py +++ b/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py @@ -3,10 +3,11 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecard(IntegrationTestCase): +class TestSupplierScorecard(ERPNextTestSuite): def test_create_scorecard(self): doc = make_supplier_scorecard().insert() self.assertEqual(doc.name, valid_scorecard[0].get("supplier")) diff --git a/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py b/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py index 114ff2b56b3..951d33ed901 100644 --- a/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py +++ b/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py @@ -3,10 +3,11 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecardCriteria(IntegrationTestCase): +class TestSupplierScorecardCriteria(ERPNextTestSuite): def test_variables_exist(self): delete_test_scorecards() for d in test_good_criteria: diff --git a/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py b/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py index 2b124dede99..6fd2bc3b0cc 100644 --- a/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py +++ b/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecardPeriod(IntegrationTestCase): +class TestSupplierScorecardPeriod(ERPNextTestSuite): pass diff --git a/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py b/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py index 32581538b03..8cc89e941fb 100644 --- a/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py +++ b/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecardStanding(IntegrationTestCase): +class TestSupplierScorecardStanding(ERPNextTestSuite): pass diff --git a/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py b/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py index 8f4b2f4ecdf..f390eefcc65 100644 --- a/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py +++ b/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py @@ -3,14 +3,14 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable import ( VariablePathNotFound, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecardVariable(IntegrationTestCase): +class TestSupplierScorecardVariable(ERPNextTestSuite): def test_variable_exist(self): for d in test_existing_variables: my_doc = frappe.get_doc("Supplier Scorecard Variable", d.get("name")) diff --git a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py index f344730a7fa..1577bf2cbf6 100644 --- a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py +++ b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py @@ -2,8 +2,8 @@ # For license information, please see license.txt -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProcurementTracker(IntegrationTestCase): +class TestProcurementTracker(ERPNextTestSuite): pass diff --git a/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py b/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py index ca0b1abad0c..e3f666d8e08 100644 --- a/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py +++ b/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt @@ -11,9 +10,10 @@ from erpnext.buying.report.requested_items_to_order_and_receive.requested_items_ ) from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.material_request.material_request import make_purchase_order +from erpnext.tests.utils import ERPNextTestSuite -class TestRequestedItemsToOrderAndReceive(IntegrationTestCase): +class TestRequestedItemsToOrderAndReceive(ERPNextTestSuite): def setUp(self) -> None: create_item("Test MR Report Item") self.setup_material_request() # to order and receive diff --git a/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py b/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py index 5a4c8ec6ba0..1b6bf653a77 100644 --- a/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py +++ b/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py @@ -7,7 +7,6 @@ import copy import frappe -from frappe.tests import IntegrationTestCase from erpnext.buying.report.subcontracted_item_to_be_received.subcontracted_item_to_be_received import ( execute, @@ -22,9 +21,10 @@ from erpnext.controllers.tests.test_subcontracting_controller import ( from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import ( make_subcontracting_receipt, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSubcontractedItemToBeReceived(IntegrationTestCase): +class TestSubcontractedItemToBeReceived(ERPNextTestSuite): def test_pending_and_received_qty(self): make_service_item("Subcontracted Service Item 1") service_items = [ diff --git a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py index 3553906ae63..ee76c50261d 100644 --- a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py +++ b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py @@ -4,7 +4,6 @@ # Decompiled by https://python-decompiler.com import frappe -from frappe.tests import IntegrationTestCase from erpnext.buying.report.subcontracted_raw_materials_to_be_transferred.subcontracted_raw_materials_to_be_transferred import ( execute, @@ -15,9 +14,10 @@ from erpnext.controllers.tests.test_subcontracting_controller import ( make_service_item, ) from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestSubcontractedItemToBeTransferred(IntegrationTestCase): +class TestSubcontractedItemToBeTransferred(ERPNextTestSuite): def test_pending_and_transferred_qty(self): make_service_item("Subcontracted Service Item 1") service_items = [ diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index 553a7246fea..9b330aa7ee2 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -5,7 +5,6 @@ import frappe from frappe import qb from frappe.query_builder.functions import Sum -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, nowdate from frappe.utils.data import getdate as convert_to_date @@ -20,6 +19,7 @@ from erpnext.buying.doctype.purchase_order.test_purchase_order import ( ) from erpnext.projects.doctype.project.test_project import make_project from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite def make_customer(customer_name, currency=None): @@ -51,7 +51,7 @@ def make_supplier(supplier_name, currency=None): return supplier_name -class TestAccountsController(IntegrationTestCase): +class TestAccountsController(ERPNextTestSuite): """ Test Exchange Gain/Loss booking on various scenarios. Test Cases are numbered for better organization @@ -810,9 +810,7 @@ class TestAccountsController(IntegrationTestCase): self.assertEqual(exc_je_for_si, []) self.assertEqual(exc_je_for_pe, []) - @IntegrationTestCase.change_settings( - "Stock Settings", {"allow_internal_transfer_at_arms_length_price": 1} - ) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_internal_transfer_at_arms_length_price": 1}) def test_16_internal_transfer_at_arms_length_price(self): from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_inter_company_purchase_invoice from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse @@ -873,7 +871,7 @@ class TestAccountsController(IntegrationTestCase): self.assertEqual(pi.items[0].rate, arms_length_price) self.assertEqual(pi.items[0].valuation_rate, 100) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"exchange_gain_loss_posting_date": "Reconciliation Date"} ) def test_17_gain_loss_posting_date_for_normal_payment(self): @@ -936,10 +934,7 @@ class TestAccountsController(IntegrationTestCase): self.assertEqual(exc_je_for_si, []) self.assertEqual(exc_je_for_pe, []) - @IntegrationTestCase.change_settings( - "Accounts Settings", - {"add_taxes_from_item_tax_template": 0, "add_taxes_from_taxes_and_charges_template": 1}, - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"add_taxes_from_item_tax_template": 1}) def test_18_fetch_taxes_based_on_taxes_and_charges_template(self): # Create a Sales Taxes and Charges Template if not frappe.db.exists("Sales Taxes and Charges Template", "_Test Tax - _TC"): @@ -968,7 +963,7 @@ class TestAccountsController(IntegrationTestCase): self.assertEqual(sinv.total_taxes_and_charges, 4.5) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"add_taxes_from_item_tax_template": 1, "add_taxes_from_taxes_and_charges_template": 0}, ) @@ -2479,7 +2474,7 @@ class TestAccountsController(IntegrationTestCase): po.items[0].delivered_by_supplier = 1 po.save() - @IntegrationTestCase.change_settings("Global Defaults", {"use_posting_datetime_for_naming_documents": 1}) + @ERPNextTestSuite.change_settings("Global Defaults", {"use_posting_datetime_for_naming_documents": 1}) def test_document_naming_rule_based_on_posting_date(self): frappe.new_doc( "Document Naming Rule", document_type="Sales Invoice", prefix="SI-.MM.-.YYYY.-" diff --git a/erpnext/controllers/tests/test_distributed_discount.py b/erpnext/controllers/tests/test_distributed_discount.py index 05db1496da8..83a4dc6f3dd 100644 --- a/erpnext/controllers/tests/test_distributed_discount.py +++ b/erpnext/controllers/tests/test_distributed_discount.py @@ -1,11 +1,10 @@ -from frappe.tests import IntegrationTestCase - from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxesAndTotals(AccountsTestMixin, IntegrationTestCase): +class TestTaxesAndTotals(AccountsTestMixin, ERPNextTestSuite): def test_distributed_discount_amount(self): so = make_sales_order(do_not_save=1) so.apply_discount_on = "Net Total" diff --git a/erpnext/controllers/tests/test_item_variant.py b/erpnext/controllers/tests/test_item_variant.py index 585a63ca798..e5c9d05d4db 100644 --- a/erpnext/controllers/tests/test_item_variant.py +++ b/erpnext/controllers/tests/test_item_variant.py @@ -2,16 +2,16 @@ import json import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code from erpnext.stock.doctype.item.test_item import set_item_variant_settings from erpnext.stock.doctype.quality_inspection.test_quality_inspection import ( create_quality_inspection_parameter, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestItemVariant(IntegrationTestCase): +class TestItemVariant(ERPNextTestSuite): def test_tables_in_template_copied_to_variant(self): fields = [{"field_name": "quality_inspection_template"}] set_item_variant_settings(fields) diff --git a/erpnext/controllers/tests/test_mapper.py b/erpnext/controllers/tests/test_mapper.py index fa9515e5c23..d4e10447914 100644 --- a/erpnext/controllers/tests/test_mapper.py +++ b/erpnext/controllers/tests/test_mapper.py @@ -4,11 +4,12 @@ import unittest import frappe import frappe.utils from frappe.model import mapper -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, nowdate +from erpnext.tests.utils import ERPNextTestSuite -class TestMapper(IntegrationTestCase): + +class TestMapper(ERPNextTestSuite): def test_map_docs(self): """Test mapping of multiple source docs on a single target doc""" diff --git a/erpnext/controllers/tests/test_qty_based_taxes.py b/erpnext/controllers/tests/test_qty_based_taxes.py index d2fefa5b3b6..b2b3b8656a6 100644 --- a/erpnext/controllers/tests/test_qty_based_taxes.py +++ b/erpnext/controllers/tests/test_qty_based_taxes.py @@ -2,14 +2,15 @@ import unittest from uuid import uuid4 as _uuid4 import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite def uuid4(): return str(_uuid4()) -class TestTaxes(IntegrationTestCase): +class TestTaxes(ERPNextTestSuite): def setUp(self): self.company = frappe.get_doc( { diff --git a/erpnext/controllers/tests/test_queries.py b/erpnext/controllers/tests/test_queries.py index 33de8114669..664841e2da2 100644 --- a/erpnext/controllers/tests/test_queries.py +++ b/erpnext/controllers/tests/test_queries.py @@ -116,7 +116,7 @@ class TestQueries(ERPNextTestSuite): } ) - with self.set_user(user.name): + with ERPNextTestSuite.set_user(user.name): params = { "doctype": "Employee", "txt": "", diff --git a/erpnext/controllers/tests/test_reactivity.py b/erpnext/controllers/tests/test_reactivity.py index b6baad2fab2..398812fa6f8 100644 --- a/erpnext/controllers/tests/test_reactivity.py +++ b/erpnext/controllers/tests/test_reactivity.py @@ -1,13 +1,13 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase -from frappe.utils import getdate, today +from frappe.utils import today from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import disable_dimension from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestReactivity(AccountsTestMixin, IntegrationTestCase): +class TestReactivity(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py index b6c21fa0b45..922995c0767 100644 --- a/erpnext/controllers/tests/test_subcontracting_controller.py +++ b/erpnext/controllers/tests/test_subcontracting_controller.py @@ -5,8 +5,7 @@ import copy from collections import defaultdict import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import cint +from frappe.utils import cint, flt from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.controllers.subcontracting_controller import ( @@ -23,9 +22,10 @@ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import ( make_subcontracting_receipt, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSubcontractingController(IntegrationTestCase): +class TestSubcontractingController(ERPNextTestSuite): def setUp(self): make_subcontracted_items() make_raw_materials() diff --git a/erpnext/controllers/tests/test_transaction_base.py b/erpnext/controllers/tests/test_transaction_base.py index cfb2dffabb6..4d0542053f7 100644 --- a/erpnext/controllers/tests/test_transaction_base.py +++ b/erpnext/controllers/tests/test_transaction_base.py @@ -1,10 +1,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestUtils(IntegrationTestCase): +class TestUtils(ERPNextTestSuite): def test_reset_default_field_value(self): doc = frappe.get_doc( { diff --git a/erpnext/crm/doctype/appointment/test_appointment.py b/erpnext/crm/doctype/appointment/test_appointment.py index e88a3dc67e5..5ef79bfa4a7 100644 --- a/erpnext/crm/doctype/appointment/test_appointment.py +++ b/erpnext/crm/doctype/appointment/test_appointment.py @@ -4,7 +4,8 @@ import datetime import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite LEAD_EMAIL = "test_appointment_lead@example.com" @@ -26,7 +27,7 @@ def create_test_appointment(): return test_appointment -class TestAppointment(IntegrationTestCase): +class TestAppointment(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py b/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py index 0fca8a59da3..96d86a224ed 100644 --- a/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py +++ b/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestAppointmentBookingSettings(IntegrationTestCase): +class TestAppointmentBookingSettings(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/campaign/test_campaign.py b/erpnext/crm/doctype/campaign/test_campaign.py index 878c18664ad..b84fc2815ca 100644 --- a/erpnext/crm/doctype/campaign/test_campaign.py +++ b/erpnext/crm/doctype/campaign/test_campaign.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCampaign(IntegrationTestCase): +class TestCampaign(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/competitor/test_competitor.py b/erpnext/crm/doctype/competitor/test_competitor.py index 2fbe068e8a7..664af74f3f6 100644 --- a/erpnext/crm/doctype/competitor/test_competitor.py +++ b/erpnext/crm/doctype/competitor/test_competitor.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCompetitor(IntegrationTestCase): +class TestCompetitor(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/contract/test_contract.py b/erpnext/crm/doctype/contract/test_contract.py index 2ea083834ce..f6aa0ef0979 100644 --- a/erpnext/crm/doctype/contract/test_contract.py +++ b/erpnext/crm/doctype/contract/test_contract.py @@ -3,11 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate +from erpnext.tests.utils import ERPNextTestSuite -class TestContract(IntegrationTestCase): + +class TestContract(ERPNextTestSuite): def setUp(self): frappe.db.sql("delete from `tabContract`") self.contract_doc = get_contract() diff --git a/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py b/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py index becb1674190..33f74f3e543 100644 --- a/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py +++ b/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestContractFulfilmentChecklist(IntegrationTestCase): +class TestContractFulfilmentChecklist(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/contract_template/test_contract_template.py b/erpnext/crm/doctype/contract_template/test_contract_template.py index 4b2911945d0..aff3c8a9171 100644 --- a/erpnext/crm/doctype/contract_template/test_contract_template.py +++ b/erpnext/crm/doctype/contract_template/test_contract_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestContractTemplate(IntegrationTestCase): +class TestContractTemplate(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/crm_settings/test_crm_settings.py b/erpnext/crm/doctype/crm_settings/test_crm_settings.py index 22109d960dd..12fa43f8e1d 100644 --- a/erpnext/crm/doctype/crm_settings/test_crm_settings.py +++ b/erpnext/crm/doctype/crm_settings/test_crm_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCRMSettings(IntegrationTestCase): +class TestCRMSettings(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/email_campaign/test_email_campaign.py b/erpnext/crm/doctype/email_campaign/test_email_campaign.py index b94a41e7820..7d7d445b4be 100644 --- a/erpnext/crm/doctype/email_campaign/test_email_campaign.py +++ b/erpnext/crm/doctype/email_campaign/test_email_campaign.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestEmailCampaign(IntegrationTestCase): +class TestEmailCampaign(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/market_segment/test_market_segment.py b/erpnext/crm/doctype/market_segment/test_market_segment.py index 4f42f704309..5821bae063a 100644 --- a/erpnext/crm/doctype/market_segment/test_market_segment.py +++ b/erpnext/crm/doctype/market_segment/test_market_segment.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestMarketSegment(IntegrationTestCase): +class TestMarketSegment(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py b/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py index 91bbd0d7095..1015ac8effa 100644 --- a/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py +++ b/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestOpportunityType(IntegrationTestCase): +class TestOpportunityType(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/prospect/test_prospect.py b/erpnext/crm/doctype/prospect/test_prospect.py index d66f3d5a494..26948fe9390 100644 --- a/erpnext/crm/doctype/prospect/test_prospect.py +++ b/erpnext/crm/doctype/prospect/test_prospect.py @@ -3,14 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import random_string from erpnext.crm.doctype.lead.lead import add_lead_to_prospect from erpnext.crm.doctype.lead.test_lead import make_lead +from erpnext.tests.utils import ERPNextTestSuite -class TestProspect(IntegrationTestCase): +class TestProspect(ERPNextTestSuite): def test_add_lead_to_prospect_and_address_linking(self): lead_doc = make_lead() address_doc = make_address(address_title=lead_doc.name) diff --git a/erpnext/crm/doctype/sales_stage/test_sales_stage.py b/erpnext/crm/doctype/sales_stage/test_sales_stage.py index 24da6ce48f6..9633ca17c14 100644 --- a/erpnext/crm/doctype/sales_stage/test_sales_stage.py +++ b/erpnext/crm/doctype/sales_stage/test_sales_stage.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesStage(IntegrationTestCase): +class TestSalesStage(ERPNextTestSuite): pass diff --git a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py index 63d6cae3b00..29bc14e04e7 100644 --- a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py +++ b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py @@ -1,8 +1,3 @@ -import unittest - -import frappe -from frappe.tests import IntegrationTestCase - from erpnext.crm.report.opportunity_summary_by_sales_stage.opportunity_summary_by_sales_stage import ( execute, ) @@ -11,9 +6,10 @@ from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics i create_customer, create_opportunity, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestOpportunitySummaryBySalesStage(IntegrationTestCase): +class TestOpportunitySummaryBySalesStage(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py b/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py index b29668fa030..dea4b772b65 100644 --- a/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py +++ b/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py @@ -1,12 +1,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.crm.report.sales_pipeline_analytics.sales_pipeline_analytics import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPipelineAnalytics(IntegrationTestCase): +class TestSalesPipelineAnalytics(ERPNextTestSuite): def setUp(self): create_company() create_customer() diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py index 891a6bd10df..4e3f3056629 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py @@ -4,7 +4,6 @@ import json import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.response import json_handler from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings import ( @@ -14,9 +13,10 @@ from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings import ( get_plaid_configuration, new_bank_transaction, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestPlaidSettings(IntegrationTestCase): +class TestPlaidSettings(ERPNextTestSuite): def setUp(self): pass diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py index 206c9687c31..6ff2d7cb239 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import format_date from frappe.utils.data import add_days, formatdate, today @@ -13,9 +12,10 @@ from erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule impor ) from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item +from erpnext.tests.utils import ERPNextTestSuite -class TestMaintenanceSchedule(IntegrationTestCase): +class TestMaintenanceSchedule(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py b/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py index 51a27983269..ffc49296a4c 100644 --- a/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py +++ b/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py @@ -3,11 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.data import today +from erpnext.tests.utils import ERPNextTestSuite -class TestMaintenanceVisit(IntegrationTestCase): + +class TestMaintenanceVisit(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py index 169197e04ca..ac7c860dd1b 100644 --- a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py +++ b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py @@ -1,16 +1,16 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, today from erpnext import get_company_currency from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite from .blanket_order import make_order -class TestBlanketOrder(IntegrationTestCase): +class TestBlanketOrder(ERPNextTestSuite): def setUp(self): frappe.flags.args = frappe._dict() diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index a6963a66254..4c7ab8dc7ca 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -6,7 +6,7 @@ from collections import deque from functools import partial import frappe -from frappe.tests import IntegrationTestCase, timeout +from frappe.tests import timeout from frappe.utils import cstr, flt from erpnext.controllers.tests.test_subcontracting_controller import ( @@ -20,9 +20,10 @@ from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ( create_stock_reconciliation, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestBOM(IntegrationTestCase): +class TestBOM(ERPNextTestSuite): @timeout def test_get_items(self): from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict diff --git a/erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py b/erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py index b277ca3c483..f7e7623b471 100644 --- a/erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py +++ b/erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py @@ -4,16 +4,16 @@ import random import frappe -from frappe.tests import IntegrationTestCase from erpnext.manufacturing.doctype.bom_creator.bom_creator import ( add_item, add_sub_assembly, ) from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite -class TestBOMCreator(IntegrationTestCase): +class TestBOMCreator(ERPNextTestSuite): def setUp(self) -> None: create_items() diff --git a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py index 7b8b89a4c14..4d60506ca5e 100644 --- a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py +++ b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.manufacturing.doctype.bom_update_log.bom_update_log import ( BOMMissingError, @@ -12,10 +11,10 @@ from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import ( enqueue_replace_bom, enqueue_update_cost, ) +from erpnext.tests.utils import ERPNextTestSuite - -class TestBOMUpdateLog(IntegrationTestCase): +class TestBOMUpdateLog(ERPNextTestSuite): "Test BOM Update Tool Operations via BOM Update Log." def setUp(self): diff --git a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py index 0da15a0bc38..eec6db620da 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py @@ -2,7 +2,7 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase, timeout +from frappe.tests import timeout from erpnext.manufacturing.doctype.bom_update_log.test_bom_update_log import ( update_cost_in_all_boms_in_test, @@ -10,10 +10,10 @@ from erpnext.manufacturing.doctype.bom_update_log.test_bom_update_log import ( from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import enqueue_replace_bom from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite - -class TestBOMUpdateTool(IntegrationTestCase): +class TestBOMUpdateTool(ERPNextTestSuite): "Test major functions run via BOM Update Tool." def tearDown(self): diff --git a/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py b/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py index b59b336c657..88fcade6920 100644 --- a/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py +++ b/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestDowntimeEntry(IntegrationTestCase): +class TestDowntimeEntry(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 70ffc232e21..d44f6a0d9e5 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -5,8 +5,7 @@ from typing import Literal import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import random_string +from frappe.utils import flt, random_string from frappe.utils.data import add_to_date, now, today from erpnext.manufacturing.doctype.job_card.job_card import ( @@ -282,7 +281,7 @@ class TestJobCard(ERPNextTestSuite): # transfer was made for 2 fg qty in first transfer Stock Entry self.assertEqual(transfer_entry_2.fg_completed_qty, 0) - @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 1}) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 1}) def test_job_card_excess_material_transfer(self): "Test transferring more than required RM against Job Card." self.transfer_material_against = "Job Card" @@ -325,7 +324,7 @@ class TestJobCard(ERPNextTestSuite): # JC is Completed with excess transfer self.assertEqual(job_card.status, "Completed") - @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) def test_job_card_excess_material_transfer_block(self): self.transfer_material_against = "Job Card" self.source_warehouse = "Stores - _TC" @@ -348,7 +347,7 @@ class TestJobCard(ERPNextTestSuite): transfer_entry_2.insert() self.assertRaises(JobCardOverTransferError, transfer_entry_2.submit) - @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) def test_job_card_excess_material_transfer_with_no_reference(self): self.transfer_material_against = "Job Card" self.source_warehouse = "Stores - _TC" @@ -456,7 +455,7 @@ class TestJobCard(ERPNextTestSuite): self.assertEqual(transfer_entry.items[0].item_code, "_Test Item") self.assertEqual(transfer_entry.items[0].qty, 2) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"add_corrective_operation_cost_in_finished_good_valuation": 1} ) def test_corrective_costing(self): @@ -500,7 +499,7 @@ class TestJobCard(ERPNextTestSuite): cost_after_cancel = self.work_order.total_operating_cost self.assertEqual(cost_after_cancel, original_cost) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"add_corrective_operation_cost_in_finished_good_valuation": 1} ) def test_if_corrective_jc_ops_cost_is_added_to_manufacture_stock_entry(self): diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py index 050b5d7d0f2..a9661480b95 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py +++ b/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestManufacturingSettings(IntegrationTestCase): +class TestManufacturingSettings(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py b/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py index f903d2dce2d..ee7bb6ec0b2 100644 --- a/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py +++ b/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestMaterialRequestPlanItem(IntegrationTestCase): +class TestMaterialRequestPlanItem(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/operation/test_operation.py b/erpnext/manufacturing/doctype/operation/test_operation.py index d9867e74557..e00b85d7e94 100644 --- a/erpnext/manufacturing/doctype/operation/test_operation.py +++ b/erpnext/manufacturing/doctype/operation/test_operation.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestOperation(IntegrationTestCase): +class TestOperation(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py b/erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py index 78a8662e1fc..c2cbd97d0d1 100644 --- a/erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py +++ b/erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestPlantFloor(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestPlantFloor(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index 08249de49fb..ba51ba5c5d0 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -1,7 +1,6 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, flt, getdate, now_datetime, nowdate from erpnext.controllers.item_variant import create_variant @@ -25,9 +24,10 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation, ) from erpnext.stock.doctype.stock_reservation_entry.stock_reservation_entry import StockReservation +from erpnext.tests.utils import ERPNextTestSuite -class TestProductionPlan(IntegrationTestCase): +class TestProductionPlan(ERPNextTestSuite): def setUp(self): for item in [ "Test Production Item 1", diff --git a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py index bab30fa6a92..01a3465156c 100644 --- a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py +++ b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProductionPlanMaterialRequestWarehouse(IntegrationTestCase): +class TestProductionPlanMaterialRequestWarehouse(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/routing/test_routing.py b/erpnext/manufacturing/doctype/routing/test_routing.py index 114297cc9c8..0c53096f6a8 100644 --- a/erpnext/manufacturing/doctype/routing/test_routing.py +++ b/erpnext/manufacturing/doctype/routing/test_routing.py @@ -1,14 +1,14 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.manufacturing.doctype.job_card.job_card import OperationSequenceError from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite -class TestRouting(IntegrationTestCase): +class TestRouting(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py b/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py index 05486e98777..45a79e974ca 100644 --- a/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py +++ b/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSubOperation(IntegrationTestCase): +class TestSubOperation(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 2a2beaa87bb..01d2e954075 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -5,7 +5,7 @@ from collections import defaultdict import frappe -from frappe.tests import IntegrationTestCase, timeout +from frappe.tests import timeout from frappe.utils import add_days, add_months, add_to_date, cint, flt, now, today from erpnext.manufacturing.doctype.job_card.job_card import JobCardCancelError @@ -33,9 +33,10 @@ from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos from erpnext.stock.doctype.stock_entry import test_stock_entry from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse from erpnext.stock.utils import get_bin +from erpnext.tests.utils import ERPNextTestSuite -class TestWorkOrder(IntegrationTestCase): +class TestWorkOrder(ERPNextTestSuite): def setUp(self): self.warehouse = "_Test Warehouse 2 - _TC" self.item = "_Test Item" @@ -1233,9 +1234,7 @@ class TestWorkOrder(IntegrationTestCase): frappe.db.set_single_value("Manufacturing Settings", "backflush_raw_materials_based_on", "BOM") - @IntegrationTestCase.change_settings( - "Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1} - ) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) def test_auto_batch_creation(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom @@ -1256,9 +1255,7 @@ class TestWorkOrder(IntegrationTestCase): except frappe.MandatoryError: self.fail("Batch generation causing failing in Work Order") - @IntegrationTestCase.change_settings( - "Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1} - ) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) def test_auto_serial_no_creation(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom @@ -1291,9 +1288,7 @@ class TestWorkOrder(IntegrationTestCase): except frappe.MandatoryError: self.fail("Batch generation causing failing in Work Order") - @IntegrationTestCase.change_settings( - "Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1} - ) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) def test_auto_serial_no_batch_creation(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom @@ -1345,7 +1340,7 @@ class TestWorkOrder(IntegrationTestCase): return serial_nos - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"backflush_raw_materials_based_on": "Material Transferred for Manufacture"}, ) @@ -1375,7 +1370,7 @@ class TestWorkOrder(IntegrationTestCase): for index, row in enumerate(ste_manu.get("items"), start=1): self.assertEqual(index, row.idx) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"backflush_raw_materials_based_on": "Material Transferred for Manufacture"}, ) @@ -2159,7 +2154,7 @@ class TestWorkOrder(IntegrationTestCase): frappe.db.set_single_value("Manufacturing Settings", "set_op_cost_and_scrap_from_sub_assemblies", 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"material_consumption": 1, "get_rm_cost_from_consumption_entry": 1} ) def test_get_rm_cost_from_consumption_entry(self): diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py index 9222b478d33..424e467e39f 100644 --- a/erpnext/manufacturing/doctype/workstation/test_workstation.py +++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py @@ -2,7 +2,6 @@ # See license.txt import frappe from frappe import _ -from frappe.tests import IntegrationTestCase from erpnext.manufacturing.doctype.operation.test_operation import make_operation from erpnext.manufacturing.doctype.routing.test_routing import create_routing, setup_bom @@ -11,9 +10,10 @@ from erpnext.manufacturing.doctype.workstation.workstation import ( WorkstationHolidayError, check_if_within_operating_hours, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestWorkstation(IntegrationTestCase): +class TestWorkstation(ERPNextTestSuite): def test_validate_timings(self): check_if_within_operating_hours( "_Test Workstation 1", "Operation 1", "2013-02-02 11:00:00", "2013-02-02 19:00:00" diff --git a/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py index 7e62d4c4ffe..98461a72c98 100644 --- a/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py +++ b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py @@ -2,10 +2,11 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestWorkstationType(IntegrationTestCase): +class TestWorkstationType(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py b/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py index 6bbbacbeb77..37642da0680 100644 --- a/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py +++ b/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py @@ -1,16 +1,15 @@ # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt -from frappe.tests import IntegrationTestCase - from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.manufacturing.report.bom_stock_calculated.bom_stock_calculated import ( execute as bom_stock_calculated_report, ) from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite -class TestBOMStockCalculated(IntegrationTestCase): +class TestBOMStockCalculated(ERPNextTestSuite): def setUp(self): self.fg_item, self.rm_items = create_items() self.boms = create_boms(self.fg_item, self.rm_items) diff --git a/erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py b/erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py index 2bcb43b409f..43706fcb4de 100644 --- a/erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py +++ b/erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py @@ -4,7 +4,6 @@ import frappe from frappe.exceptions import ValidationError -from frappe.tests import IntegrationTestCase from frappe.utils import floor from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom @@ -13,9 +12,10 @@ from erpnext.manufacturing.report.bom_stock_report.bom_stock_report import ( ) from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestBomStockReport(IntegrationTestCase): +class TestBomStockReport(ERPNextTestSuite): def setUp(self): self.warehouse = "_Test Warehouse - _TC" self.fg_item, self.rm_items = create_items() diff --git a/erpnext/manufacturing/report/test_reports.py b/erpnext/manufacturing/report/test_reports.py index 8e53d9064de..163a91c7ef9 100644 --- a/erpnext/manufacturing/report/test_reports.py +++ b/erpnext/manufacturing/report/test_reports.py @@ -1,12 +1,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase -from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report +from erpnext.tests.utils import ERPNextTestSuite, ReportFilters, ReportName, execute_script_report -class TestManufacturingReports(IntegrationTestCase): +class TestManufacturingReports(ERPNextTestSuite): def setUp(self): self.setup_default_filters() diff --git a/erpnext/projects/doctype/project_template/test_project_template.py b/erpnext/projects/doctype/project_template/test_project_template.py index 2671d7a02ec..72ccbbfad70 100644 --- a/erpnext/projects/doctype/project_template/test_project_template.py +++ b/erpnext/projects/doctype/project_template/test_project_template.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.projects.doctype.task.test_task import create_task +from erpnext.tests.utils import ERPNextTestSuite -class TestProjectTemplate(IntegrationTestCase): +class TestProjectTemplate(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/project_type/test_project_type.py b/erpnext/projects/doctype/project_type/test_project_type.py index 31e0f840db3..51038e61c06 100644 --- a/erpnext/projects/doctype/project_type/test_project_type.py +++ b/erpnext/projects/doctype/project_type/test_project_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProjectType(IntegrationTestCase): +class TestProjectType(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/project_update/test_project_update.py b/erpnext/projects/doctype/project_update/test_project_update.py index 51f0ce14ac9..5a64a32706a 100644 --- a/erpnext/projects/doctype/project_update/test_project_update.py +++ b/erpnext/projects/doctype/project_update/test_project_update.py @@ -2,9 +2,8 @@ # See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProjectUpdate(IntegrationTestCase): +class TestProjectUpdate(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/projects_settings/test_projects_settings.py b/erpnext/projects/doctype/projects_settings/test_projects_settings.py index 06ecd2ad5dd..55878f54f73 100644 --- a/erpnext/projects/doctype/projects_settings/test_projects_settings.py +++ b/erpnext/projects/doctype/projects_settings/test_projects_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProjectsSettings(IntegrationTestCase): +class TestProjectsSettings(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/task_type/test_task_type.py b/erpnext/projects/doctype/task_type/test_task_type.py index 9f34e97592e..de544f1b007 100644 --- a/erpnext/projects/doctype/task_type/test_task_type.py +++ b/erpnext/projects/doctype/task_type/test_task_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestTaskType(IntegrationTestCase): +class TestTaskType(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py index c1f6e8d5dd9..0526f8733de 100644 --- a/erpnext/projects/doctype/timesheet/test_timesheet.py +++ b/erpnext/projects/doctype/timesheet/test_timesheet.py @@ -4,7 +4,6 @@ import datetime import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, now_datetime, nowdate from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_sales_return @@ -119,7 +118,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(item.qty, 2.00) self.assertEqual(item.rate, 50.00) - @IntegrationTestCase.change_settings("Projects Settings", {"fetch_timesheet_in_sales_invoice": 1}) + @ERPNextTestSuite.change_settings("Projects Settings", {"fetch_timesheet_in_sales_invoice": 1}) def test_timesheet_billing_based_on_project(self): emp = make_employee("test_employee_6@salary.com") project = frappe.get_value("Project", {"project_name": "_Test Project"}) diff --git a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py index 20c74ef5e80..4f247ee5df3 100644 --- a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py +++ b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py @@ -1,14 +1,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_months, nowdate from erpnext.projects.doctype.task.test_task import create_task from erpnext.projects.report.delayed_tasks_summary.delayed_tasks_summary import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestDelayedTasksSummary(IntegrationTestCase): +class TestDelayedTasksSummary(ERPNextTestSuite): @classmethod def setUp(self): task1 = create_task("_Test Task 98", add_days(nowdate(), -10), nowdate()) diff --git a/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py b/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py index 68b6536cc18..ea764a7b81d 100644 --- a/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py +++ b/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestNonConformance(IntegrationTestCase): +class TestNonConformance(ERPNextTestSuite): pass diff --git a/erpnext/quality_management/doctype/quality_action/test_quality_action.py b/erpnext/quality_management/doctype/quality_action/test_quality_action.py index 1e1dfc376bc..9cd28e7c2e6 100644 --- a/erpnext/quality_management/doctype/quality_action/test_quality_action.py +++ b/erpnext/quality_management/doctype/quality_action/test_quality_action.py @@ -2,9 +2,9 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityAction(IntegrationTestCase): +class TestQualityAction(ERPNextTestSuite): # quality action has no code pass diff --git a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py index 35a326ad943..310e4789a94 100644 --- a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py +++ b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityFeedback(IntegrationTestCase): +class TestQualityFeedback(ERPNextTestSuite): def test_quality_feedback(self): template = frappe.get_doc( doctype="Quality Feedback Template", diff --git a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py index 2064bbc5513..ec4c4c2b922 100644 --- a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py +++ b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityFeedbackTemplate(IntegrationTestCase): +class TestQualityFeedbackTemplate(ERPNextTestSuite): pass diff --git a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py index 57d0a94ed0a..7a4bfc7d864 100644 --- a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py +++ b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityGoal(IntegrationTestCase): +class TestQualityGoal(ERPNextTestSuite): def test_quality_goal(self): # no code, just a basic sanity check goal = get_quality_goal() diff --git a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py index e0ff7d77f24..7ac01008f66 100644 --- a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py +++ b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py @@ -2,9 +2,9 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityMeeting(IntegrationTestCase): +class TestQualityMeeting(ERPNextTestSuite): # nothing to test pass diff --git a/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py b/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py index e83a3e394e1..cca2b7d6267 100644 --- a/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py +++ b/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityMeetingAgenda(IntegrationTestCase): +class TestQualityMeetingAgenda(ERPNextTestSuite): pass diff --git a/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py index 64022ec4c37..e4d847159f6 100644 --- a/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py +++ b/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py @@ -2,12 +2,13 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite from .quality_procedure import add_node -class TestQualityProcedure(IntegrationTestCase): +class TestQualityProcedure(ERPNextTestSuite): def test_add_node(self): procedure = create_procedure( { diff --git a/erpnext/quality_management/doctype/quality_review/test_quality_review.py b/erpnext/quality_management/doctype/quality_review/test_quality_review.py index a3c78c5a416..fd550762ccf 100644 --- a/erpnext/quality_management/doctype/quality_review/test_quality_review.py +++ b/erpnext/quality_management/doctype/quality_review/test_quality_review.py @@ -3,13 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite from ..quality_goal.test_quality_goal import get_quality_goal from .quality_review import review -class TestQualityReview(IntegrationTestCase): +class TestQualityReview(ERPNextTestSuite): def test_review_creation(self): quality_goal = get_quality_goal() review() diff --git a/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py b/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py index 7d512dbfb55..07005ee1b60 100644 --- a/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py +++ b/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestImportSupplierInvoice(IntegrationTestCase): +class TestImportSupplierInvoice(ERPNextTestSuite): pass diff --git a/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py b/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py index f6ceb56557b..58b874c0880 100644 --- a/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py +++ b/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestLowerDeductionCertificate(IntegrationTestCase): +class TestLowerDeductionCertificate(ERPNextTestSuite): pass diff --git a/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py b/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py index 9ed34764f70..0bb509a430a 100644 --- a/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py +++ b/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSouthAfricaVATSettings(IntegrationTestCase): +class TestSouthAfricaVATSettings(ERPNextTestSuite): pass diff --git a/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py b/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py index 8d21d08b798..4251b4ffe54 100644 --- a/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py +++ b/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestUAEVATSettings(IntegrationTestCase): +class TestUAEVATSettings(ERPNextTestSuite): pass diff --git a/erpnext/regional/united_states/test_united_states.py b/erpnext/regional/united_states/test_united_states.py index d3e7dcda620..ba282d3657a 100644 --- a/erpnext/regional/united_states/test_united_states.py +++ b/erpnext/regional/united_states/test_united_states.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.regional.report.irs_1099.irs_1099 import execute as execute_1099_report +from erpnext.tests.utils import ERPNextTestSuite -class TestUnitedStates(IntegrationTestCase): +class TestUnitedStates(ERPNextTestSuite): def test_irs_1099_custom_field(self): if not frappe.db.exists("Supplier", "_US 1099 Test Supplier"): doc = frappe.new_doc("Supplier") diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index dee74837923..ce6b6e851c5 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -5,7 +5,6 @@ import json import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt from erpnext.accounts.party import get_due_date @@ -15,10 +14,10 @@ from erpnext.selling.doctype.customer.customer import ( get_customer_outstanding, parse_full_name, ) -from erpnext.tests.utils import create_test_contact_and_address +from erpnext.tests.utils import ERPNextTestSuite, create_test_contact_and_address -class TestCustomer(IntegrationTestCase): +class TestCustomer(ERPNextTestSuite): def tearDown(self): set_credit_limit("_Test Customer", "_Test Company", 0) diff --git a/erpnext/selling/doctype/installation_note/test_installation_note.py b/erpnext/selling/doctype/installation_note/test_installation_note.py index c6d1786cdee..62c5b761014 100644 --- a/erpnext/selling/doctype/installation_note/test_installation_note.py +++ b/erpnext/selling/doctype/installation_note/test_installation_note.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestInstallationNote(IntegrationTestCase): +class TestInstallationNote(ERPNextTestSuite): pass diff --git a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py index 0259c5fcaee..6aaf02572b8 100644 --- a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py +++ b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py @@ -2,9 +2,9 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.controllers.queries import item_query +from erpnext.tests.utils import ERPNextTestSuite def create_party_specific_item(**args): @@ -16,7 +16,7 @@ def create_party_specific_item(**args): psi.insert() -class TestPartySpecificItem(IntegrationTestCase): +class TestPartySpecificItem(ERPNextTestSuite): def setUp(self): self.customer = frappe.get_last_doc("Customer") self.supplier = frappe.get_last_doc("Supplier") diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index ab1528812eb..e1889d10fd1 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -4,15 +4,15 @@ import json import frappe -from frappe.tests import IntegrationTestCase, change_settings +from frappe.tests import change_settings from frappe.utils import add_days, add_months, flt, getdate, nowdate from erpnext.controllers.accounts_controller import InvalidQtyError, update_child_qty_rate from erpnext.selling.doctype.quotation.quotation import make_sales_order -from erpnext.setup.utils import get_exchange_rate +from erpnext.tests.utils import ERPNextTestSuite -class TestQuotation(IntegrationTestCase): +class TestQuotation(ERPNextTestSuite): def test_update_child_quotation_add_item(self): from erpnext.stock.doctype.item.test_item import make_item @@ -180,7 +180,7 @@ class TestQuotation(IntegrationTestCase): self.assertTrue(quotation.payment_schedule) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 1}, ) @@ -324,7 +324,7 @@ class TestQuotation(IntegrationTestCase): sales_order.delivery_date = nowdate() sales_order.insert() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "add_taxes_from_item_tax_template": 0, @@ -874,7 +874,7 @@ class TestQuotation(IntegrationTestCase): quotation.items[0].conversion_factor = 2.23 self.assertRaises(frappe.ValidationError, quotation.save) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"add_taxes_from_item_tax_template": 1, "add_taxes_from_taxes_and_charges_template": 0}, ) @@ -942,7 +942,7 @@ class TestQuotation(IntegrationTestCase): self.assertEqual(quotation.rounding_adjustment, 0) self.assertEqual(quotation.rounded_total, 0) - @IntegrationTestCase.change_settings("Selling Settings", {"allow_zero_qty_in_quotation": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_zero_qty_in_quotation": 1}) def test_so_from_zero_qty_quotation(self): from erpnext.selling.doctype.quotation.quotation import make_sales_order from erpnext.stock.doctype.item.test_item import make_item @@ -1074,7 +1074,7 @@ class TestQuotation(IntegrationTestCase): quotation.reload() self.assertEqual(quotation.status, "Open") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 1}, ) diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index 7d1c3749205..35322ff0d4e 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -7,8 +7,8 @@ from unittest.mock import patch import frappe import frappe.permissions from frappe.core.doctype.user_permission.test_user_permission import create_user -from frappe.tests import IntegrationTestCase, change_settings -from frappe.utils import add_days, flt, getdate, nowdate, today +from frappe.tests import change_settings +from frappe.utils import add_days, flt, nowdate, today from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.controllers.accounts_controller import InvalidQtyError, get_due_date, update_child_qty_rate @@ -32,9 +32,10 @@ from erpnext.selling.doctype.sales_order.sales_order import ( from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.get_item_details import get_bin_details +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): +class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -57,7 +58,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): frappe.db.rollback() frappe.set_user("Administrator") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "auto_insert_price_list_rate_if_missing": 1, @@ -144,7 +145,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): so.reload() self.assertEqual(so.status, "Completed") - @IntegrationTestCase.change_settings("Selling Settings", {"allow_negative_rates_for_items": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_negative_rates_for_items": 1}) def test_sales_order_with_negative_rate(self): """ Test if negative rate is allowed in Sales Order via doc submission and update items @@ -265,7 +266,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): so.load_from_db() self.assertEqual(so.per_billed, 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 1} ) # Enable auto fetch def test_make_sales_invoice_with_terms(self): @@ -296,7 +297,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): si1 = make_sales_invoice(so.name) self.assertEqual(len(si1.get("items")), 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 1} ) # Enable auto fetch def test_auto_fetch_terms_enable(self): @@ -312,7 +313,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): si.insert() si.submit() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 0} ) # Disable auto fetch def test_auto_fetch_terms_disable(self): @@ -1544,7 +1545,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): self.assertRaises(frappe.LinkExistsError, so_doc.cancel) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1} ) def test_advance_paid_upon_payment_cancellation(self): @@ -1801,7 +1802,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): so.load_from_db() self.assertRaises(frappe.LinkExistsError, so.cancel) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_terms_are_fetched_when_creating_sales_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template, @@ -2133,7 +2134,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): self.assertEqual(len(dn.packed_items), 1) self.assertEqual(dn.items[0].item_code, "_Test Product Bundle Item Partial 2") - @IntegrationTestCase.change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) def test_expired_rate_for_packed_item(self): bundle = "_Test Product Bundle 1" packed_item = "_Packed Item 1" @@ -2471,7 +2472,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): self.assertRaises(frappe.ValidationError, so1.update_status, "Draft") - @IntegrationTestCase.change_settings("Stock Settings", {"enable_stock_reservation": True}) + @ERPNextTestSuite.change_settings("Stock Settings", {"enable_stock_reservation": True}) def test_warehouse_mapping_based_on_stock_reservation(self): self.create_company(company_name="Glass Ceiling", abbr="GC") self.create_item("Lamy Safari 2", True, self.warehouse_stores, self.company, 2000) @@ -2585,7 +2586,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): sre_doc.reload() self.assertTrue(sre_doc.status == "Delivered") - @IntegrationTestCase.change_settings("Selling Settings", {"allow_zero_qty_in_sales_order": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_zero_qty_in_sales_order": 1}) def test_deliver_zero_qty_purchase_order(self): """ Test the flow of a Unit Price SO and DN creation against it until completion. @@ -2633,7 +2634,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): self.assertEqual(so.per_delivered, 100.0) self.assertEqual(so.status, "To Bill") - @IntegrationTestCase.change_settings("Selling Settings", {"allow_zero_qty_in_sales_order": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_zero_qty_in_sales_order": 1}) def test_bill_zero_qty_sales_order(self): so = make_sales_order(qty=0) diff --git a/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py b/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py index 8f35c48de0c..e2b29e70e30 100644 --- a/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py +++ b/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPartnerType(IntegrationTestCase): +class TestSalesPartnerType(ERPNextTestSuite): pass diff --git a/erpnext/selling/doctype/selling_settings/test_selling_settings.py b/erpnext/selling/doctype/selling_settings/test_selling_settings.py index 91a73d92ec3..c3ec1d3f3bd 100644 --- a/erpnext/selling/doctype/selling_settings/test_selling_settings.py +++ b/erpnext/selling/doctype/selling_settings/test_selling_settings.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestSellingSettings(IntegrationTestCase): +class TestSellingSettings(ERPNextTestSuite): def test_defaults_populated(self): # Setup default values are not populated on migrate, this test checks # if setup was completed correctly diff --git a/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py b/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py index d8eba371534..1f87f9993b7 100644 --- a/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py +++ b/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py @@ -1,7 +1,6 @@ import datetime import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_months, nowdate from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice @@ -10,9 +9,10 @@ from erpnext.selling.report.payment_terms_status_for_sales_order.payment_terms_s execute, ) from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentTermsStatusForSalesOrder(IntegrationTestCase): +class TestPaymentTermsStatusForSalesOrder(ERPNextTestSuite): def tearDown(self): frappe.db.rollback() @@ -137,7 +137,7 @@ class TestPaymentTermsStatusForSalesOrder(IntegrationTestCase): ) doc.insert() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", allow_multi_currency_invoices_against_single_party_account=1 ) def test_02_alternate_currency(self): diff --git a/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py b/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py index cfb960fd8ad..3f540a3b94a 100644 --- a/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py +++ b/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py @@ -2,7 +2,6 @@ # For license information, please see license.txt -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, nowdate from erpnext.selling.doctype.sales_order.sales_order import make_material_request @@ -10,9 +9,10 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde from erpnext.selling.report.pending_so_items_for_purchase_request.pending_so_items_for_purchase_request import ( execute, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestPendingSOItemsForPurchaseRequest(IntegrationTestCase): +class TestPendingSOItemsForPurchaseRequest(ERPNextTestSuite): def test_result_for_partial_material_request(self): so = make_sales_order() mr = make_material_request(so.name) diff --git a/erpnext/selling/report/sales_analytics/test_analytics.py b/erpnext/selling/report/sales_analytics/test_analytics.py index af7d93be9bb..cada5c07c81 100644 --- a/erpnext/selling/report/sales_analytics/test_analytics.py +++ b/erpnext/selling/report/sales_analytics/test_analytics.py @@ -3,13 +3,13 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.selling.report.sales_analytics.sales_analytics import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestAnalytics(IntegrationTestCase): +class TestAnalytics(ERPNextTestSuite): def test_sales_analytics(self): frappe.db.sql("delete from `tabSales Order` where company='_Test Company 2'") diff --git a/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py b/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py index 76dc0dfff85..79eae15bd01 100644 --- a/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py +++ b/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py @@ -1,14 +1,14 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note, make_sales_invoice from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.selling.report.sales_order_analysis.sales_order_analysis import execute from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesOrderAnalysis(IntegrationTestCase): +class TestSalesOrderAnalysis(ERPNextTestSuite): def create_sales_order(self, transaction_date, do_not_save=False, do_not_submit=False): item = create_item(item_code="_Test Excavator", is_stock_item=0) so = make_sales_order( diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py index 0f5ee17330a..cfcfc2f3ed4 100644 --- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py +++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py @@ -1,5 +1,4 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowdate from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -11,9 +10,10 @@ from erpnext.selling.report.sales_person_target_variance_based_on_item_group.tes create_sales_target_doc, create_target_distribution, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPartnerTargetVarianceBasedOnItemGroup(IntegrationTestCase): +class TestSalesPartnerTargetVarianceBasedOnItemGroup(ERPNextTestSuite): def setUp(self): self.fiscal_year = get_fiscal_year(nowdate())[0] diff --git a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py index 52bd213a85d..a5dff54a372 100644 --- a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py +++ b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py @@ -1,5 +1,4 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowdate from erpnext.accounts.utils import get_fiscal_year @@ -7,9 +6,10 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde from erpnext.selling.report.sales_person_target_variance_based_on_item_group.sales_person_target_variance_based_on_item_group import ( execute, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPersonTargetVarianceBasedOnItemGroup(IntegrationTestCase): +class TestSalesPersonTargetVarianceBasedOnItemGroup(ERPNextTestSuite): def setUp(self): self.fiscal_year = get_fiscal_year(nowdate())[0] diff --git a/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py b/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py index 63c34c271e0..e3fab7dbd5c 100644 --- a/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py +++ b/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestAuthorizationRule(IntegrationTestCase): +class TestAuthorizationRule(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py index c0fad18795e..c6f08c305ee 100644 --- a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py +++ b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py @@ -4,10 +4,10 @@ import unittest from unittest import mock import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt from erpnext.setup.utils import get_exchange_rate +from erpnext.tests.utils import ERPNextTestSuite def save_new_records(test_records): @@ -78,7 +78,7 @@ def patched_requests_get(*args, **kwargs): @mock.patch("requests.get", side_effect=patched_requests_get) -class TestCurrencyExchange(IntegrationTestCase): +class TestCurrencyExchange(ERPNextTestSuite): def clear_cache(self): cache = frappe.cache() for date in test_exchange_values.keys(): diff --git a/erpnext/setup/doctype/department/test_department.py b/erpnext/setup/doctype/department/test_department.py index 274361749fd..2a1c357f751 100644 --- a/erpnext/setup/doctype/department/test_department.py +++ b/erpnext/setup/doctype/department/test_department.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestDepartment(IntegrationTestCase): +class TestDepartment(ERPNextTestSuite): def test_remove_department_data(self): doc = create_department("Test Department") frappe.delete_doc("Department", doc.name) diff --git a/erpnext/setup/doctype/driver/test_driver.py b/erpnext/setup/doctype/driver/test_driver.py index d75d7ab8977..3230391707d 100644 --- a/erpnext/setup/doctype/driver/test_driver.py +++ b/erpnext/setup/doctype/driver/test_driver.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestDriver(IntegrationTestCase): +class TestDriver(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/email_digest/test_email_digest.py b/erpnext/setup/doctype/email_digest/test_email_digest.py index 13a97ea86ea..7ea0da03382 100644 --- a/erpnext/setup/doctype/email_digest/test_email_digest.py +++ b/erpnext/setup/doctype/email_digest/test_email_digest.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestEmailDigest(IntegrationTestCase): +class TestEmailDigest(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/employee/test_employee.py b/erpnext/setup/doctype/employee/test_employee.py index 73de3bf2e5d..90b7cff1fba 100644 --- a/erpnext/setup/doctype/employee/test_employee.py +++ b/erpnext/setup/doctype/employee/test_employee.py @@ -5,14 +5,14 @@ import unittest import frappe import frappe.utils from frappe.query_builder import Criterion -from frappe.tests import IntegrationTestCase import erpnext from erpnext.accounts.utils import build_qb_match_conditions from erpnext.setup.doctype.employee.employee import InactiveEmployeeStatusError +from erpnext.tests.utils import ERPNextTestSuite -class TestEmployee(IntegrationTestCase): +class TestEmployee(ERPNextTestSuite): def test_employee_status_left(self): employee1 = make_employee("test_employee_1@company.com") employee2 = make_employee("test_employee_2@company.com") diff --git a/erpnext/setup/doctype/employee_group/test_employee_group.py b/erpnext/setup/doctype/employee_group/test_employee_group.py index 9003d72bbe4..6d7ed2614c5 100644 --- a/erpnext/setup/doctype/employee_group/test_employee_group.py +++ b/erpnext/setup/doctype/employee_group/test_employee_group.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.setup.doctype.employee.test_employee import make_employee +from erpnext.tests.utils import ERPNextTestSuite -class TestEmployeeGroup(IntegrationTestCase): +class TestEmployeeGroup(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/global_defaults/test_global_defaults.py b/erpnext/setup/doctype/global_defaults/test_global_defaults.py index 3a301ba4232..303ca64ce88 100644 --- a/erpnext/setup/doctype/global_defaults/test_global_defaults.py +++ b/erpnext/setup/doctype/global_defaults/test_global_defaults.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestGlobalDefaults(IntegrationTestCase): +class TestGlobalDefaults(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/holiday_list/test_holiday_list.py b/erpnext/setup/doctype/holiday_list/test_holiday_list.py index c5dbf0258df..342918b8d64 100644 --- a/erpnext/setup/doctype/holiday_list/test_holiday_list.py +++ b/erpnext/setup/doctype/holiday_list/test_holiday_list.py @@ -5,13 +5,13 @@ from contextlib import contextmanager from datetime import date, timedelta import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate from erpnext.setup.doctype.holiday_list.holiday_list import local_country_name +from erpnext.tests.utils import ERPNextTestSuite -class TestHolidayList(IntegrationTestCase): +class TestHolidayList(ERPNextTestSuite): def test_holiday_list(self): today_date = getdate() test_holiday_dates = [today_date - timedelta(days=5), today_date - timedelta(days=4)] diff --git a/erpnext/setup/doctype/incoterm/test_incoterm.py b/erpnext/setup/doctype/incoterm/test_incoterm.py index e38854e648b..d9338cac5af 100644 --- a/erpnext/setup/doctype/incoterm/test_incoterm.py +++ b/erpnext/setup/doctype/incoterm/test_incoterm.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestIncoterm(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestIncoterm(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py index b6b9c9cdad6..f1a8697e00c 100644 --- a/erpnext/setup/doctype/item_group/test_item_group.py +++ b/erpnext/setup/doctype/item_group/test_item_group.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.nestedset import ( NestedSetChildExistsError, NestedSetInvalidMergeError, @@ -13,8 +12,10 @@ from frappe.utils.nestedset import ( rebuild_tree, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestItem(IntegrationTestCase): + +class TestItem(ERPNextTestSuite): def test_basic_tree(self, records=None): min_lft = 1 max_rgt = frappe.db.sql("select max(rgt) from `tabItem Group`")[0][0] diff --git a/erpnext/setup/doctype/party_type/test_party_type.py b/erpnext/setup/doctype/party_type/test_party_type.py index de199d5004c..85223760843 100644 --- a/erpnext/setup/doctype/party_type/test_party_type.py +++ b/erpnext/setup/doctype/party_type/test_party_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPartyType(IntegrationTestCase): +class TestPartyType(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py index b1c96fc66b0..191542d80c1 100644 --- a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py +++ b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py @@ -3,10 +3,11 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestTransactionDeletionRecord(IntegrationTestCase): +class TestTransactionDeletionRecord(ERPNextTestSuite): def setUp(self): # Clear all deletion cache flags from previous tests self._clear_all_deletion_cache_flags() diff --git a/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py b/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py index dd9346dd8ac..642165dbb60 100644 --- a/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py +++ b/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestUOMConversionFactor(IntegrationTestCase): +class TestUOMConversionFactor(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/vehicle/test_vehicle.py b/erpnext/setup/doctype/vehicle/test_vehicle.py index d5d464f67ed..c3b367e9f7e 100644 --- a/erpnext/setup/doctype/vehicle/test_vehicle.py +++ b/erpnext/setup/doctype/vehicle/test_vehicle.py @@ -3,11 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import random_string +from erpnext.tests.utils import ERPNextTestSuite -class TestVehicle(IntegrationTestCase): + +class TestVehicle(ERPNextTestSuite): def test_make_vehicle(self): vehicle = frappe.get_doc( { diff --git a/erpnext/stock/doctype/batch/test_batch.py b/erpnext/stock/doctype/batch/test_batch.py index 31d6cc1f241..1ba25cb44f3 100644 --- a/erpnext/stock/doctype/batch/test_batch.py +++ b/erpnext/stock/doctype/batch/test_batch.py @@ -5,7 +5,6 @@ import json import frappe from frappe.exceptions import ValidationError -from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt from frappe.utils.data import add_to_date, getdate @@ -22,9 +21,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.get_item_details import ItemDetailsCtx, get_item_details from erpnext.stock.serial_batch_bundle import SerialBatchCreation +from erpnext.tests.utils import ERPNextTestSuite -class TestBatch(IntegrationTestCase): +class TestBatch(ERPNextTestSuite): def test_item_has_batch_enabled(self): self.assertRaises( ValidationError, diff --git a/erpnext/stock/doctype/bin/test_bin.py b/erpnext/stock/doctype/bin/test_bin.py index 7ed3089e05e..93688948581 100644 --- a/erpnext/stock/doctype/bin/test_bin.py +++ b/erpnext/stock/doctype/bin/test_bin.py @@ -2,13 +2,13 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.utils import _create_bin +from erpnext.tests.utils import ERPNextTestSuite -class TestBin(IntegrationTestCase): +class TestBin(ERPNextTestSuite): def test_concurrent_inserts(self): """Ensure no duplicates are possible in case of concurrent inserts""" item_code = "_TestConcurrentBin" diff --git a/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py b/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py index 9496e3ed5a0..234b3871750 100644 --- a/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py +++ b/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCustomsTariffNumber(IntegrationTestCase): +class TestCustomsTariffNumber(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 8ce354d1058..2430eb219a9 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -6,7 +6,6 @@ import json from collections import defaultdict import frappe -from frappe.tests import IntegrationTestCase, change_settings from frappe.utils import add_days, cstr, flt, getdate, nowdate, nowtime, today from erpnext.accounts.doctype.account.test_account import get_inventory_account @@ -42,9 +41,10 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ) from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse from erpnext.stock.stock_ledger import get_previous_sle +from erpnext.tests.utils import ERPNextTestSuite -class TestDeliveryNote(IntegrationTestCase): +class TestDeliveryNote(ERPNextTestSuite): def test_delivery_note_qty(self): dn = create_delivery_note(qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): @@ -1022,7 +1022,7 @@ class TestDeliveryNote(IntegrationTestCase): self.assertEqual(dn2.per_billed, 100) self.assertEqual(dn2.status, "Completed") - @change_settings("Accounts Settings", {"delete_linked_ledger_entries": True}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": True}) def test_sales_invoice_qty_after_return(self): from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_return @@ -1323,7 +1323,7 @@ class TestDeliveryNote(IntegrationTestCase): frappe.db.set_single_value("Stock Settings", "use_serial_batch_fields", 1) frappe.db.set_single_value("Accounts Settings", "delete_linked_ledger_entries", 0) - @change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_terms_are_fetched_when_creating_sales_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template, @@ -2865,7 +2865,7 @@ class TestDeliveryNote(IntegrationTestCase): for entry in sabb.entries: self.assertEqual(entry.incoming_rate, 200) - @IntegrationTestCase.change_settings("Selling Settings", {"validate_selling_price": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"validate_selling_price": 1}) def test_validate_selling_price(self): item_code = make_item("VSP Item", properties={"is_stock_item": 1}).name make_stock_entry(item_code=item_code, target="_Test Warehouse - _TC", qty=1, basic_rate=10) diff --git a/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py b/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py index 2ecbb9e8861..18f83b4d22b 100644 --- a/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py +++ b/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestDeliverySettings(IntegrationTestCase): +class TestDeliverySettings(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py index 9966af7c99b..8e467f84fba 100644 --- a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, now_datetime, nowdate import erpnext @@ -11,10 +10,10 @@ from erpnext.stock.doctype.delivery_trip.delivery_trip import ( get_contact_and_address, notify_customers, ) -from erpnext.tests.utils import create_test_contact_and_address +from erpnext.tests.utils import ERPNextTestSuite, create_test_contact_and_address -class TestDeliveryTrip(IntegrationTestCase): +class TestDeliveryTrip(ERPNextTestSuite): def setUp(self): super().setUp() driver = create_driver() diff --git a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py index 1d7c475d1ae..ca61b9344c0 100644 --- a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py +++ b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py @@ -3,7 +3,6 @@ import frappe from frappe.custom.doctype.custom_field.custom_field import create_custom_field -from frappe.tests import IntegrationTestCase, change_settings from frappe.utils import nowdate, nowtime from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note @@ -19,9 +18,10 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_pu from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import InventoryDimensionNegativeStockError from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class TestInventoryDimension(IntegrationTestCase): +class TestInventoryDimension(ERPNextTestSuite): def setUp(self): prepare_test_data() create_store_dimension() @@ -497,7 +497,7 @@ class TestInventoryDimension(IntegrationTestCase): self.assertEqual(site_name, "Site 1") - @change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_validate_negative_stock_with_multiple_dimension(self): item_code = "Test Negative Multi Inventory Dimension Item" create_item(item_code) diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index c2de1e54fdb..132aef65e5f 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -7,7 +7,6 @@ import json import frappe from frappe.custom.doctype.property_setter.property_setter import make_property_setter from frappe.test_runner import make_test_objects -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.controllers.item_variant import ( @@ -27,6 +26,7 @@ from erpnext.stock.doctype.item.item import ( ) from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.get_item_details import ItemDetailsCtx, get_item_details +from erpnext.tests.utils import ERPNextTestSuite def make_item(item_code=None, properties=None, uoms=None, barcode=None): @@ -71,7 +71,7 @@ def make_item(item_code=None, properties=None, uoms=None, barcode=None): return item -class TestItem(IntegrationTestCase): +class TestItem(ERPNextTestSuite): def setUp(self): super().setUp() frappe.flags.attribute_values = None @@ -738,13 +738,13 @@ class TestItem(IntegrationTestCase): except frappe.ValidationError as e: self.fail(f"stock item considered non-stock item: {e}") - @IntegrationTestCase.change_settings("Stock Settings", {"item_naming_by": "Naming Series"}) + @ERPNextTestSuite.change_settings("Stock Settings", {"item_naming_by": "Naming Series"}) def test_autoname_series(self): item = frappe.new_doc("Item") item.item_group = "All Item Groups" item.save() # if item code saved without item_code then series worked - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_item_wise_negative_stock(self): """When global settings are disabled check that item that allows negative stock can still consume material in all known stock @@ -756,7 +756,7 @@ class TestItem(IntegrationTestCase): self.consume_item_code_with_differet_stock_transactions(item_code=item.name) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_backdated_negative_stock(self): """same as test above but backdated entries""" from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry @@ -769,7 +769,7 @@ class TestItem(IntegrationTestCase): ) self.consume_item_code_with_differet_stock_transactions(item_code=item.name) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"sample_retention_warehouse": "_Test Warehouse - _TC"} ) def test_retain_sample(self): diff --git a/erpnext/stock/doctype/item_alternative/test_item_alternative.py b/erpnext/stock/doctype/item_alternative/test_item_alternative.py index d96061e0d94..0a2119af3ec 100644 --- a/erpnext/stock/doctype/item_alternative/test_item_alternative.py +++ b/erpnext/stock/doctype/item_alternative/test_item_alternative.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt from erpnext.controllers.subcontracting_controller import make_rm_stock_entry @@ -24,9 +23,10 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import ( make_subcontracting_receipt, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestItemAlternative(IntegrationTestCase): +class TestItemAlternative(ERPNextTestSuite): def setUp(self): super().setUp() make_items() diff --git a/erpnext/stock/doctype/item_attribute/test_item_attribute.py b/erpnext/stock/doctype/item_attribute/test_item_attribute.py index 7ed800dca19..63958733eba 100644 --- a/erpnext/stock/doctype/item_attribute/test_item_attribute.py +++ b/erpnext/stock/doctype/item_attribute/test_item_attribute.py @@ -3,12 +3,12 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.item_attribute.item_attribute import ItemAttributeIncrementError +from erpnext.tests.utils import ERPNextTestSuite -class TestItemAttribute(IntegrationTestCase): +class TestItemAttribute(ERPNextTestSuite): def setUp(self): super().setUp() if frappe.db.exists("Item Attribute", "_Test_Length"): diff --git a/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py b/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py index bf82f3611ed..74bc8c37cd0 100644 --- a/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py +++ b/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestItemManufacturer(IntegrationTestCase): +class TestItemManufacturer(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py index 42726054c1b..5df5ae166c9 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.py +++ b/erpnext/stock/doctype/item_price/test_item_price.py @@ -3,14 +3,14 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.tests.utils import make_test_records_for_doctype from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem from erpnext.stock.get_item_details import ItemDetailsCtx, get_price_list_rate_for +from erpnext.tests.utils import ERPNextTestSuite -class TestItemPrice(IntegrationTestCase): +class TestItemPrice(ERPNextTestSuite): def setUp(self): super().setUp() frappe.db.sql("delete from `tabItem Price`") diff --git a/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py b/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py index b526eadd8e8..8eb4c864ae5 100644 --- a/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py +++ b/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestItemVariantSettings(IntegrationTestCase): +class TestItemVariantSettings(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py index 57de08306da..b24fcfcf712 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py @@ -5,7 +5,6 @@ import copy import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_to_date, flt, now, nowtime, today from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account @@ -21,10 +20,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle get_serial_nos_from_bundle, ) from erpnext.stock.serial_batch_bundle import SerialNoValuation +from erpnext.tests.utils import ERPNextTestSuite - -class TestLandedCostVoucher(IntegrationTestCase): +class TestLandedCostVoucher(ERPNextTestSuite): def test_landed_cost_voucher(self): frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) diff --git a/erpnext/stock/doctype/manufacturer/test_manufacturer.py b/erpnext/stock/doctype/manufacturer/test_manufacturer.py index 1469901e26a..4caa84be53a 100644 --- a/erpnext/stock/doctype/manufacturer/test_manufacturer.py +++ b/erpnext/stock/doctype/manufacturer/test_manufacturer.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestManufacturer(IntegrationTestCase): +class TestManufacturer(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index b04cbbee1f1..dd6ba500099 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -6,7 +6,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, today from erpnext.controllers.accounts_controller import InvalidQtyError @@ -21,9 +20,10 @@ from erpnext.stock.doctype.material_request.material_request import ( ) from erpnext.stock.doctype.stock_entry.stock_entry import make_stock_in_entry from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class TestMaterialRequest(IntegrationTestCase): +class TestMaterialRequest(ERPNextTestSuite): def test_material_request_qty(self): mr = frappe.copy_doc(self.globalTestRecords["Material Request"][0]) mr.items[0].qty = 0 diff --git a/erpnext/stock/doctype/packed_item/test_packed_item.py b/erpnext/stock/doctype/packed_item/test_packed_item.py index 5ace12184a7..8bab935cda7 100644 --- a/erpnext/stock/doctype/packed_item/test_packed_item.py +++ b/erpnext/stock/doctype/packed_item/test_packed_item.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, nowdate from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note @@ -11,6 +10,7 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde 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.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite def create_product_bundle( @@ -40,7 +40,7 @@ def create_product_bundle( return bundle, components -class TestPackedItem(IntegrationTestCase): +class TestPackedItem(ERPNextTestSuite): "Test impact on Packed Items table in various scenarios." @classmethod @@ -116,7 +116,7 @@ class TestPackedItem(IntegrationTestCase): self.assertEqual(so.packed_items[1].qty, 4) self.assertEqual(so.packed_items[3].qty, 12) - @IntegrationTestCase.change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) def test_bundle_item_cumulative_price(self): "Test if Bundle Item rate is cumulative from packed items." so = make_sales_order(item_code=self.bundle, qty=2, do_not_submit=True) diff --git a/erpnext/stock/doctype/packing_slip/test_packing_slip.py b/erpnext/stock/doctype/packing_slip/test_packing_slip.py index 8d16b2d8fe0..19e6c976edc 100644 --- a/erpnext/stock/doctype/packing_slip/test_packing_slip.py +++ b/erpnext/stock/doctype/packing_slip/test_packing_slip.py @@ -3,15 +3,15 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle from erpnext.stock.doctype.delivery_note.delivery_note import make_packing_slip from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite -class TestPackingSlip(IntegrationTestCase): +class TestPackingSlip(ERPNextTestSuite): def test_packing_slip(self): # Step - 1: Create a Product Bundle items = create_items() diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py index 0bd66b69afe..bf8d2ef5af1 100644 --- a/erpnext/stock/doctype/pick_list/test_pick_list.py +++ b/erpnext/stock/doctype/pick_list/test_pick_list.py @@ -3,7 +3,6 @@ import frappe from frappe import _dict -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle from erpnext.selling.doctype.sales_order.sales_order import create_pick_list @@ -21,9 +20,10 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import ( EmptyStockReconciliationItemsError, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestPickList(IntegrationTestCase): +class TestPickList(ERPNextTestSuite): def test_pick_list_picks_warehouse_for_each_item(self): item_code = make_item().name try: diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index a3ead18cb6c..1ca15a3af43 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -2,7 +2,6 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cint, cstr, flt, get_datetime, getdate, nowtime, today from pypika import functions as fn @@ -26,9 +25,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle make_serial_batch_bundle, ) from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseReceipt(IntegrationTestCase): +class TestPurchaseReceipt(ERPNextTestSuite): def setUp(self): frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) @@ -1301,7 +1301,7 @@ class TestPurchaseReceipt(IntegrationTestCase): self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_terms_are_fetched_when_creating_purchase_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template, @@ -1332,7 +1332,7 @@ class TestPurchaseReceipt(IntegrationTestCase): # self.assertEqual(po.payment_terms_template, pi.payment_terms_template) compare_payment_schedules(self, po, pi) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 1}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 1}) def test_neg_to_positive(self): from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry @@ -4458,7 +4458,7 @@ class TestPurchaseReceipt(IntegrationTestCase): frappe.db.set_single_value("Buying Settings", "set_valuation_rate_for_rejected_materials", 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Buying Settings", {"bill_for_rejected_quantity_in_purchase_invoice": 1, "set_valuation_rate_for_rejected_materials": 1}, ) @@ -4816,7 +4816,7 @@ class TestPurchaseReceipt(IntegrationTestCase): self.assertEqual(sles, [1500.0, 1500.0]) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_multiple_transactions_with_same_posting_datetime(self): from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.stock_ledger import NegativeStockError @@ -4851,7 +4851,7 @@ class TestPurchaseReceipt(IntegrationTestCase): self.assertRaises(NegativeStockError, pr.cancel) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Buying Settings", {"set_landed_cost_based_on_purchase_invoice_rate": 1, "maintain_same_rate": 0} ) def test_set_lcv_from_pi_created_against_po(self): diff --git a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py index df285665a38..257bd595b68 100644 --- a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py +++ b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.batch.test_batch import make_new_batch from erpnext.stock.doctype.item.test_item import make_item @@ -14,9 +13,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse from erpnext.stock.get_item_details import get_conversion_factor +from erpnext.tests.utils import ERPNextTestSuite -class TestPutawayRule(IntegrationTestCase): +class TestPutawayRule(ERPNextTestSuite): def setUp(self): if not frappe.db.exists("Item", "_Rice"): make_item( diff --git a/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py index 3885df7c74a..34b140515f2 100644 --- a/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py +++ b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.controllers.stock_controller import ( @@ -14,9 +13,10 @@ from erpnext.controllers.stock_controller import ( from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityInspection(IntegrationTestCase): +class TestQualityInspection(ERPNextTestSuite): def setUp(self): super().setUp() create_item("_Test Item with QA") @@ -218,7 +218,7 @@ class TestQualityInspection(IntegrationTestCase): qa.save() self.assertEqual(qa.status, "Accepted") - @IntegrationTestCase.change_settings("System Settings", {"number_format": "#.###,##"}) + @ERPNextTestSuite.change_settings("System Settings", {"number_format": "#.###,##"}) def test_diff_number_format(self): self.assertEqual(frappe.db.get_default("number_format"), "#.###,##") # sanity check diff --git a/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py b/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py index 8b85e5681c7..73dd8e5cd9f 100644 --- a/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py +++ b/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityInspectionParameter(IntegrationTestCase): +class TestQualityInspectionParameter(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py b/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py index d3c158676a5..4a468b80182 100644 --- a/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py +++ b/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityInspectionParameterGroup(IntegrationTestCase): +class TestQualityInspectionParameterGroup(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py b/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py index 9094ac1d8a0..5a69de5264a 100644 --- a/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py +++ b/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityInspectionTemplate(IntegrationTestCase): +class TestQualityInspectionTemplate(ERPNextTestSuite): pass 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 d4a8dc24c52..45d8d0ebcb5 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 @@ -5,7 +5,6 @@ from unittest.mock import MagicMock, call import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_to_date, now, nowdate, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -19,9 +18,10 @@ from erpnext.stock.doctype.repost_item_valuation.repost_item_valuation import ( from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.tests.test_utils import StockTestMixin from erpnext.stock.utils import PendingRepostingError +from erpnext.tests.utils import ERPNextTestSuite -class TestRepostItemValuation(IntegrationTestCase, StockTestMixin): +class TestRepostItemValuation(ERPNextTestSuite, StockTestMixin): def tearDown(self): frappe.flags.dont_execute_stock_reposts = False @@ -195,7 +195,7 @@ class TestRepostItemValuation(IntegrationTestCase, StockTestMixin): riv.set_status("Skipped") - @IntegrationTestCase.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) + @ERPNextTestSuite.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) def test_prevention_of_cancelled_transaction_riv(self): frappe.flags.dont_execute_stock_reposts = True @@ -374,7 +374,7 @@ class TestRepostItemValuation(IntegrationTestCase, StockTestMixin): company.accounts_frozen_till_date = "" company.save() - @IntegrationTestCase.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) + @ERPNextTestSuite.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) def test_create_repost_entry_for_cancelled_document(self): pr = make_purchase_receipt( company="_Test Company with perpetual inventory", diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py index d02affd68f0..5a34b4715dc 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py @@ -4,7 +4,6 @@ import json import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowtime, today from erpnext.stock.doctype.item.test_item import make_item @@ -15,9 +14,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.serial_and_batch_bundle impor make_serial_nos, ) from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestSerialandBatchBundle(IntegrationTestCase): +class TestSerialandBatchBundle(ERPNextTestSuite): def test_naming_for_sabb(self): frappe.db.set_single_value( "Stock Settings", "set_serial_and_batch_bundle_naming_based_on_naming_series", 1 @@ -769,7 +769,7 @@ class TestSerialandBatchBundle(IntegrationTestCase): make_serial_nos(item_code, serial_nos) self.assertTrue(frappe.db.exists("Serial No", serial_no_id)) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"auto_create_serial_and_batch_bundle_for_outward": 1} ) def test_duplicate_serial_and_batch_bundle(self): diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py index dfc2a1edd6d..f9b17998bf1 100644 --- a/erpnext/stock/doctype/serial_no/test_serial_no.py +++ b/erpnext/stock/doctype/serial_no/test_serial_no.py @@ -7,7 +7,6 @@ import frappe from frappe import _dict -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import make_item @@ -20,9 +19,10 @@ from erpnext.stock.doctype.serial_no.serial_no import * from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class TestSerialNo(IntegrationTestCase): +class TestSerialNo(ERPNextTestSuite): def tearDown(self): frappe.db.rollback() diff --git a/erpnext/stock/doctype/shipment/test_shipment.py b/erpnext/stock/doctype/shipment/test_shipment.py index 4a26107524e..7e58f942faf 100644 --- a/erpnext/stock/doctype/shipment/test_shipment.py +++ b/erpnext/stock/doctype/shipment/test_shipment.py @@ -4,12 +4,12 @@ from datetime import date, timedelta import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.delivery_note.delivery_note import make_shipment +from erpnext.tests.utils import ERPNextTestSuite -class TestShipment(IntegrationTestCase): +class TestShipment(ERPNextTestSuite): def test_shipment_from_delivery_note(self): delivery_note = create_test_delivery_note() delivery_note.submit() diff --git a/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py b/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py index 81f8f4393bc..04c1403cb30 100644 --- a/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py +++ b/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestShipmentParcelTemplate(IntegrationTestCase): +class TestShipmentParcelTemplate(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py b/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py index 2d0769cf496..e60ffc118fa 100644 --- a/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py +++ b/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py @@ -2,14 +2,14 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -# On IntegrationTestCase, the doctype test records and all +# On ERPNextTestSuite, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -class IntegrationTestStockClosingBalance(IntegrationTestCase): +class TestStockClosingBalance(ERPNextTestSuite): """ Integration tests for StockClosingBalance. Use this class for testing interactions between multiple components. diff --git a/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py b/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py index db4577503e6..91d3f3d7b34 100644 --- a/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py +++ b/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py @@ -2,14 +2,15 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -# On IntegrationTestCase, the doctype test records and all +from erpnext.tests.utils import ERPNextTestSuite + +# On ERPNextTestSuite, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -class IntegrationTestStockClosingEntry(IntegrationTestCase): +class TestStockClosingEntry(ERPNextTestSuite): """ Integration tests for StockClosingEntry. Use this class for testing interactions between multiple components. diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 583cb4bedc6..967d473a030 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -3,7 +3,6 @@ from frappe.permissions import add_user_permission, remove_user_permission -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cstr, flt, get_time, getdate, nowtime, today from erpnext.accounts.doctype.account.test_account import get_inventory_account @@ -38,6 +37,7 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ) from erpnext.stock.serial_batch_bundle import SerialBatchCreation from erpnext.stock.stock_ledger import NegativeStockError, get_previous_sle +from erpnext.tests.utils import ERPNextTestSuite def get_sle(**args): @@ -56,7 +56,7 @@ def get_sle(**args): ) -class TestStockEntry(IntegrationTestCase): +class TestStockEntry(ERPNextTestSuite): def tearDown(self): frappe.db.rollback() frappe.set_user("Administrator") @@ -866,7 +866,7 @@ class TestStockEntry(IntegrationTestCase): fg_cost = next(filter(lambda x: x.item_code == "_Test FG Item 2", stock_entry.get("items"))).amount self.assertEqual(fg_cost, flt(rm_cost + bom_operation_cost + work_order.additional_operating_cost, 2)) - @IntegrationTestCase.change_settings("Manufacturing Settings", {"material_consumption": 1}) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"material_consumption": 1}) def test_work_order_manufacture_with_material_consumption(self): from erpnext.manufacturing.doctype.work_order.work_order import ( make_stock_entry as _make_stock_entry, @@ -1293,7 +1293,7 @@ class TestStockEntry(IntegrationTestCase): self.assertEqual(se.items[0].expense_account, "_Test Account Cost for Goods Sold - _TC") self.assertEqual(se.items[1].expense_account, "_Test Account Cost for Goods Sold - _TC") - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_future_negative_sle(self): # Initialize item, batch, warehouse, opening qty item_code = "_Test Future Neg Item" @@ -1336,7 +1336,7 @@ class TestStockEntry(IntegrationTestCase): self.assertRaises(NegativeStockError, create_stock_entries, sequence_of_entries) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_future_negative_sle_batch(self): from erpnext.stock.doctype.batch.test_batch import TestBatch @@ -1464,7 +1464,7 @@ class TestStockEntry(IntegrationTestCase): self.assertEqual(se.items[0].item_name, item.item_name) self.assertEqual(se.items[0].stock_uom, item.stock_uom) - @IntegrationTestCase.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) + @ERPNextTestSuite.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) def test_reposting_for_depedent_warehouse(self): from erpnext.stock.doctype.repost_item_valuation.repost_item_valuation import repost_sl_entries from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse @@ -2326,7 +2326,7 @@ class TestStockEntry(IntegrationTestCase): se.save() se.submit() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"sample_retention_warehouse": "_Test Warehouse 1 - _TC"} ) def test_sample_retention_stock_entry(self): @@ -2388,7 +2388,7 @@ class TestStockEntry(IntegrationTestCase): frappe.db.set_single_value("Manufacturing Settings", "material_consumption", original_value) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", { "material_consumption": 1, diff --git a/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py b/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py index 2ffeaed47f5..5b661957d0b 100644 --- a/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py +++ b/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestStockEntryType(IntegrationTestCase): +class TestStockEntryType(ERPNextTestSuite): def test_stock_entry_type_non_standard(self): stock_entry_type = "Test Manufacturing" diff --git a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py index c0ea44c59d5..8c8e3fee920 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py @@ -9,7 +9,6 @@ import frappe from frappe.core.page.permission_manager.permission_manager import reset from frappe.custom.doctype.property_setter.property_setter import make_property_setter from frappe.query_builder.functions import Timestamp -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_to_date, flt, today from erpnext.accounts.doctype.gl_entry.gl_entry import rename_gle_sle_docs @@ -29,9 +28,10 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ) from erpnext.stock.stock_ledger import get_previous_sle from erpnext.stock.tests.test_utils import StockTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestStockLedgerEntry(IntegrationTestCase, StockTestMixin): +class TestStockLedgerEntry(ERPNextTestSuite, StockTestMixin): def setUp(self): items = create_items() reset("Stock Entry") @@ -1256,7 +1256,7 @@ class TestStockLedgerEntry(IntegrationTestCase, StockTestMixin): self.assertEqual(sle[0].qty_after_transaction, 105) self.assertEqual(sle[0].actual_qty, 100) - @IntegrationTestCase.change_settings("System Settings", {"float_precision": 3, "currency_precision": 2}) + @ERPNextTestSuite.change_settings("System Settings", {"float_precision": 3, "currency_precision": 2}) def test_transfer_invariants(self): """Extact stock value should be transferred.""" @@ -1295,7 +1295,7 @@ class TestStockLedgerEntry(IntegrationTestCase, StockTestMixin): ) self.assertEqual(abs(sles[0].stock_value_difference), sles[1].stock_value_difference) - @IntegrationTestCase.change_settings("System Settings", {"float_precision": 4}) + @ERPNextTestSuite.change_settings("System Settings", {"float_precision": 4}) def test_negative_qty_with_precision(self): "Test if system precision is respected while validating negative qty." from erpnext.stock.doctype.item.test_item import create_item @@ -1335,7 +1335,7 @@ class TestStockLedgerEntry(IntegrationTestCase, StockTestMixin): self.assertEqual(flt(get_stock_balance(item_code, warehouse), 3), 0.000) - @IntegrationTestCase.change_settings("System Settings", {"float_precision": 4}) + @ERPNextTestSuite.change_settings("System Settings", {"float_precision": 4}) def test_future_negative_qty_with_precision(self): """ Ledger: @@ -1592,8 +1592,6 @@ def get_unique_suffix(): # tests to prevent future tests from failing. return str(uuid4())[:8].upper() - -class TestDeferredNaming(IntegrationTestCase): @classmethod def setUpClass(cls) -> None: super().setUpClass() diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 7cc6d4b484b..41e02cc4e33 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -7,7 +7,6 @@ import json import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cstr, flt, nowdate, nowtime from erpnext.accounts.utils import get_stock_and_account_balance @@ -31,9 +30,10 @@ from erpnext.stock.utils import ( get_stock_value_on, get_valuation_method, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestStockReconciliation(IntegrationTestCase, StockTestMixin): +class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): @classmethod def setUpClass(cls): create_batch_or_serial_no_items() @@ -50,7 +50,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin): def test_reco_for_moving_average(self): self._test_reco_sle_gle("Moving Average") - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 1}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 1}) def _test_reco_sle_gle(self, valuation_method): item_code = self.make_item(properties={"valuation_method": valuation_method}).name @@ -423,7 +423,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin): assertBalance(pr2, 11) assertBalance(sr4, 6) # check if future stock reco is unaffected - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_backdated_stock_reco_future_negative_stock(self): """ Test if a backdated stock reco causes future negative stock and is blocked. @@ -472,7 +472,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin): dn2.cancel() pr1.cancel() - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_backdated_stock_reco_cancellation_future_negative_stock(self): """ Test if a backdated stock reco cancellation that causes future negative stock is blocked. @@ -678,7 +678,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin): self.assertEqual(flt(sl_entry.actual_qty), 1.0) self.assertEqual(flt(sl_entry.qty_after_transaction), 1.0) - @IntegrationTestCase.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) + @ERPNextTestSuite.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) def test_backdated_stock_reco_entry(self): from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry diff --git a/erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py b/erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py index 74cf9f08b77..ff89ad34ab6 100644 --- a/erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py +++ b/erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.repost_item_valuation.repost_item_valuation import get_recipients +from erpnext.tests.utils import ERPNextTestSuite -class TestStockRepostingSettings(IntegrationTestCase): +class TestStockRepostingSettings(ERPNextTestSuite): def test_notify_reposting_error_to_role(self): role = "Notify Reposting Role" diff --git a/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py b/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py index aa49726374a..bd59b5dc975 100644 --- a/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py +++ b/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py @@ -4,8 +4,7 @@ from random import randint import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import cint, today +from frappe.utils import today from erpnext.selling.doctype.sales_order.sales_order import create_pick_list, make_delivery_note from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order @@ -19,15 +18,16 @@ from erpnext.stock.doctype.stock_reservation_entry.stock_reservation_entry impor has_reserved_stock, ) from erpnext.stock.utils import get_stock_balance +from erpnext.tests.utils import ERPNextTestSuite -class TestStockReservationEntry(IntegrationTestCase): +class TestStockReservationEntry(ERPNextTestSuite): def setUp(self) -> None: self.warehouse = "_Test Warehouse - _TC" self.sr_item = make_item(properties={"is_stock_item": 1, "valuation_rate": 100}) create_material_receipt(items={self.sr_item.name: self.sr_item}, warehouse=self.warehouse, qty=100) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_validate_stock_reservation_settings(self) -> None: from erpnext.stock.doctype.stock_reservation_entry.stock_reservation_entry import ( validate_stock_reservation_settings, @@ -120,7 +120,7 @@ class TestStockReservationEntry(IntegrationTestCase): sre.load_from_db() self.assertEqual(sre.status, "Cancelled") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"allow_negative_stock": 0, "enable_stock_reservation": 1} ) def test_update_reserved_qty_in_voucher(self) -> None: @@ -189,7 +189,7 @@ class TestStockReservationEntry(IntegrationTestCase): self.assertEqual(sre1.status, "Cancelled") self.assertEqual(so.items[0].stock_reserved_qty, 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"allow_negative_stock": 0, "enable_stock_reservation": 1} ) def test_cant_consume_reserved_stock(self) -> None: @@ -239,7 +239,7 @@ class TestStockReservationEntry(IntegrationTestCase): se.submit() se.cancel() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, @@ -382,7 +382,7 @@ class TestStockReservationEntry(IntegrationTestCase): for sre_detail in sre_details: self.assertEqual(sre_detail.reserved_qty, sre_detail.delivered_qty) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, @@ -502,7 +502,7 @@ class TestStockReservationEntry(IntegrationTestCase): # Test - 9: After Delivery Note cancellation, SB Entry Delivered Qty should be `0`. self.assertEqual(sb_entry.delivered_qty, 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, @@ -583,7 +583,7 @@ class TestStockReservationEntry(IntegrationTestCase): # Test - 3: Reserved Serial/Batch Nos should be equal to Picked Serial/Batch Nos. self.assertSetEqual(picked_sb_details, reserved_sb_details) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, @@ -663,7 +663,7 @@ class TestStockReservationEntry(IntegrationTestCase): # Test - 3: Reserved Serial/Batch Nos should be equal to PR Item Serial/Batch Nos. self.assertEqual(set(sb_details), set(reserved_sb_details)) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, diff --git a/erpnext/stock/doctype/stock_settings/test_stock_settings.py b/erpnext/stock/doctype/stock_settings/test_stock_settings.py index 18c523f9998..112fa52401d 100644 --- a/erpnext/stock/doctype/stock_settings/test_stock_settings.py +++ b/erpnext/stock/doctype/stock_settings/test_stock_settings.py @@ -3,10 +3,11 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestStockSettings(IntegrationTestCase): +class TestStockSettings(ERPNextTestSuite): def setUp(self): super().setUp() frappe.db.set_single_value("Stock Settings", "clean_description_html", 0) diff --git a/erpnext/stock/doctype/uom_category/test_uom_category.py b/erpnext/stock/doctype/uom_category/test_uom_category.py index ebd2b5644c0..e664222da43 100644 --- a/erpnext/stock/doctype/uom_category/test_uom_category.py +++ b/erpnext/stock/doctype/uom_category/test_uom_category.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestUOMCategory(IntegrationTestCase): +class TestUOMCategory(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/variant_field/test_variant_field.py b/erpnext/stock/doctype/variant_field/test_variant_field.py index ab35caf96b8..c63f8f1702b 100644 --- a/erpnext/stock/doctype/variant_field/test_variant_field.py +++ b/erpnext/stock/doctype/variant_field/test_variant_field.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestVariantField(IntegrationTestCase): +class TestVariantField(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/warehouse/test_warehouse.py b/erpnext/stock/doctype/warehouse/test_warehouse.py index fc5feff5812..5a36d5c213e 100644 --- a/erpnext/stock/doctype/warehouse/test_warehouse.py +++ b/erpnext/stock/doctype/warehouse/test_warehouse.py @@ -2,16 +2,16 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase import erpnext from erpnext.accounts.doctype.account.test_account import create_account from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.warehouse.warehouse import convert_to_group_or_ledger, get_children +from erpnext.tests.utils import ERPNextTestSuite -class TestWarehouse(IntegrationTestCase): +class TestWarehouse(ERPNextTestSuite): def test_parent_warehouse(self): parent_warehouse = frappe.get_doc("Warehouse", "_Test Warehouse Group - _TC") self.assertEqual(parent_warehouse.is_group, 1) diff --git a/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py b/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py index 4afa82219cb..ce06e4356e2 100644 --- a/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py +++ b/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestWarehouseType(IntegrationTestCase): +class TestWarehouseType(ERPNextTestSuite): pass diff --git a/erpnext/stock/report/available_serial_no/test_available_serial_no.py b/erpnext/stock/report/available_serial_no/test_available_serial_no.py index b8741af4506..a1ec59da78f 100644 --- a/erpnext/stock/report/available_serial_no/test_available_serial_no.py +++ b/erpnext/stock/report/available_serial_no/test_available_serial_no.py @@ -2,15 +2,15 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestStockLedgerReeport(IntegrationTestCase): +class TestStockLedgerReeport(ERPNextTestSuite): def setUp(self) -> None: item = create_item("_Test Item with Serial No", is_stock_item=1) item.has_serial_no = 1 diff --git a/erpnext/stock/report/item_shortage_report/test_item_shortage_report.py b/erpnext/stock/report/item_shortage_report/test_item_shortage_report.py index 76549a14927..2a61fbf1f32 100644 --- a/erpnext/stock/report/item_shortage_report/test_item_shortage_report.py +++ b/erpnext/stock/report/item_shortage_report/test_item_shortage_report.py @@ -2,16 +2,16 @@ # For license information, please see license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.report.item_shortage_report.item_shortage_report import ( execute as item_shortage_report, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestItemShortageReport(IntegrationTestCase): +class TestItemShortageReport(ERPNextTestSuite): def test_item_shortage_report(self): item = make_item().name so = make_sales_order(item_code=item) diff --git a/erpnext/stock/report/reserved_stock/test_reserved_stock.py b/erpnext/stock/report/reserved_stock/test_reserved_stock.py index cf74df5c160..8f4cc94e704 100644 --- a/erpnext/stock/report/reserved_stock/test_reserved_stock.py +++ b/erpnext/stock/report/reserved_stock/test_reserved_stock.py @@ -2,7 +2,6 @@ # See license.txt from random import randint -from frappe.tests import IntegrationTestCase from frappe.utils.data import today from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order @@ -12,9 +11,10 @@ from erpnext.stock.doctype.stock_reservation_entry.test_stock_reservation_entry create_material_receipt, ) from erpnext.stock.report.reserved_stock.reserved_stock import get_data as reserved_stock_report +from erpnext.tests.utils import ERPNextTestSuite -class TestReservedStock(IntegrationTestCase): +class TestReservedStock(ERPNextTestSuite): def setUp(self) -> None: super().setUp() self.stock_qty = 100 @@ -24,7 +24,7 @@ class TestReservedStock(IntegrationTestCase): cancel_all_stock_reservation_entries() return super().tearDown() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, diff --git a/erpnext/stock/report/stock_ageing/test_stock_ageing.py b/erpnext/stock/report/stock_ageing/test_stock_ageing.py index 52d8abf0c28..4e2e5ca9d88 100644 --- a/erpnext/stock/report/stock_ageing/test_stock_ageing.py +++ b/erpnext/stock/report/stock_ageing/test_stock_ageing.py @@ -2,12 +2,12 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.report.stock_ageing.stock_ageing import FIFOSlots, format_report_data +from erpnext.tests.utils import ERPNextTestSuite -class TestStockAgeing(IntegrationTestCase): +class TestStockAgeing(ERPNextTestSuite): def setUp(self) -> None: self.filters = frappe._dict(company="_Test Company", to_date="2021-12-10", ranges=["30", "60", "90"]) diff --git a/erpnext/stock/report/stock_analytics/test_stock_analytics.py b/erpnext/stock/report/stock_analytics/test_stock_analytics.py index 70be5cf4e81..5603a3a111c 100644 --- a/erpnext/stock/report/stock_analytics/test_stock_analytics.py +++ b/erpnext/stock/report/stock_analytics/test_stock_analytics.py @@ -2,13 +2,13 @@ import datetime import frappe from frappe import _dict -from frappe.tests import IntegrationTestCase from frappe.utils.data import add_to_date, getdate from erpnext.accounts.utils import get_fiscal_year from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.report.stock_analytics.stock_analytics import execute, get_period_date_ranges +from erpnext.tests.utils import ERPNextTestSuite def stock_analytics(filters): @@ -16,7 +16,7 @@ def stock_analytics(filters): return col, data -class TestStockAnalyticsReport(IntegrationTestCase): +class TestStockAnalyticsReport(ERPNextTestSuite): def setUp(self) -> None: self.item = make_item().name self.warehouse = "_Test Warehouse - _TC" diff --git a/erpnext/stock/report/stock_balance/test_stock_balance.py b/erpnext/stock/report/stock_balance/test_stock_balance.py index a0176026c48..1ab36a5c011 100644 --- a/erpnext/stock/report/stock_balance/test_stock_balance.py +++ b/erpnext/stock/report/stock_balance/test_stock_balance.py @@ -2,12 +2,12 @@ from typing import Any import frappe from frappe import _dict -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.report.stock_balance.stock_balance import execute +from erpnext.tests.utils import ERPNextTestSuite def stock_balance(filters): @@ -15,7 +15,7 @@ def stock_balance(filters): return [_dict(row) for row in execute(filters)[1]] -class TestStockBalance(IntegrationTestCase): +class TestStockBalance(ERPNextTestSuite): # ----------- utils def setUp(self): diff --git a/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py b/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py index 66e7560caa6..85abfc36ca3 100644 --- a/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py +++ b/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py @@ -2,15 +2,15 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.maintenance.doctype.maintenance_schedule.test_maintenance_schedule import ( make_serial_item_with_serial, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestStockLedgerReeport(IntegrationTestCase): +class TestStockLedgerReeport(ERPNextTestSuite): def setUp(self) -> None: make_serial_item_with_serial(self, "_Test Stock Report Serial Item") self.filters = frappe._dict( diff --git a/erpnext/stock/report/test_reports.py b/erpnext/stock/report/test_reports.py index 986c1404cbe..5f8aa9a32ea 100644 --- a/erpnext/stock/report/test_reports.py +++ b/erpnext/stock/report/test_reports.py @@ -1,10 +1,6 @@ -import unittest - -import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.make_random import get_random -from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report +from erpnext.tests.utils import ERPNextTestSuite, ReportFilters, ReportName, execute_script_report DEFAULT_FILTERS = { "company": "_Test Company", @@ -84,7 +80,7 @@ OPTIONAL_FILTERS = { } -class TestReports(IntegrationTestCase): +class TestReports(ERPNextTestSuite): def test_execute_all_stock_reports(self): """Test that all script report in stock modules are executable with supported filters""" for report, filter in REPORT_FILTER_TEST_CASES: diff --git a/erpnext/stock/tests/test_get_item_details.py b/erpnext/stock/tests/test_get_item_details.py index a10714a1f25..fdc563064ec 100644 --- a/erpnext/stock/tests/test_get_item_details.py +++ b/erpnext/stock/tests/test_get_item_details.py @@ -1,10 +1,10 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.get_item_details import get_item_details +from erpnext.tests.utils import ERPNextTestSuite -class TestGetItemDetail(IntegrationTestCase): +class TestGetItemDetail(ERPNextTestSuite): def test_get_item_detail_purchase_order(self): args = frappe._dict( { diff --git a/erpnext/stock/tests/test_utils.py b/erpnext/stock/tests/test_utils.py index 085d3d41cbe..f6625d2d93c 100644 --- a/erpnext/stock/tests/test_utils.py +++ b/erpnext/stock/tests/test_utils.py @@ -2,9 +2,9 @@ import json import frappe from frappe.query_builder.functions import Timestamp -from frappe.tests import IntegrationTestCase from erpnext.stock.utils import scan_barcode +from erpnext.tests.utils import ERPNextTestSuite class StockTestMixin: @@ -70,7 +70,7 @@ class StockTestMixin: self.assertEqual(exp_value, act_value, msg=f"{k} doesn't match \n{exp_gle}\n{act_gle}") -class TestStockUtilities(IntegrationTestCase, StockTestMixin): +class TestStockUtilities(ERPNextTestSuite, StockTestMixin): def test_barcode_scanning(self): simple_item = self.make_item(properties={"barcodes": [{"barcode": "12399"}]}) self.assertEqual(scan_barcode("12399")["item_code"], simple_item.name) diff --git a/erpnext/stock/tests/test_valuation.py b/erpnext/stock/tests/test_valuation.py index c5931c7b990..5951e9371ef 100644 --- a/erpnext/stock/tests/test_valuation.py +++ b/erpnext/stock/tests/test_valuation.py @@ -2,20 +2,20 @@ import json import unittest import frappe -from frappe.tests import IntegrationTestCase from hypothesis import given from hypothesis import strategies as st from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.valuation import FIFOValuation, LIFOValuation, round_off_if_near_zero +from erpnext.tests.utils import ERPNextTestSuite qty_gen = st.floats(min_value=-1e6, max_value=1e6) value_gen = st.floats(min_value=1, max_value=1e6) stock_queue_generator = st.lists(st.tuples(qty_gen, value_gen), min_size=10) -class TestFIFOValuation(IntegrationTestCase): +class TestFIFOValuation(ERPNextTestSuite): def setUp(self): self.queue = FIFOValuation([]) @@ -195,7 +195,7 @@ class TestFIFOValuation(IntegrationTestCase): self.assertTotalValue(total_value) -class TestLIFOValuation(IntegrationTestCase): +class TestLIFOValuation(ERPNextTestSuite): def setUp(self): self.stack = LIFOValuation([]) @@ -317,7 +317,7 @@ class TestLIFOValuation(IntegrationTestCase): self.assertTotalValue(total_value) -class TestLIFOValuationSLE(IntegrationTestCase): +class TestLIFOValuationSLE(ERPNextTestSuite): ITEM_CODE = "_Test LIFO item" WAREHOUSE = "_Test Warehouse - _TC" diff --git a/erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py b/erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py index a831211af93..d44603f9a0a 100644 --- a/erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py +++ b/erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py @@ -2,10 +2,11 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestSubcontractingBOM(IntegrationTestCase): +class TestSubcontractingBOM(ERPNextTestSuite): pass diff --git a/erpnext/subcontracting/doctype/subcontracting_inward_order/test_subcontracting_inward_order.py b/erpnext/subcontracting/doctype/subcontracting_inward_order/test_subcontracting_inward_order.py index 1d57660d6ef..9463b11bf4c 100644 --- a/erpnext/subcontracting/doctype/subcontracting_inward_order/test_subcontracting_inward_order.py +++ b/erpnext/subcontracting/doctype/subcontracting_inward_order/test_subcontracting_inward_order.py @@ -2,13 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry as make_stock_entry_from_wo from erpnext.selling.doctype.sales_order.sales_order import make_subcontracting_inward_order @@ -16,9 +9,10 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class IntegrationTestSubcontractingInwardOrder(IntegrationTestCase): +class IntegrationTestSubcontractingInwardOrder(ERPNextTestSuite): """ Integration tests for SubcontractingInwardOrder. Use this class for testing interactions between multiple components. @@ -295,8 +289,8 @@ class IntegrationTestSubcontractingInwardOrder(IntegrationTestCase): self.assertEqual(scio.items[0].delivered_qty, 2) self.assertEqual(scio.items[0].returned_qty, 1) - @IntegrationTestCase.change_settings("Selling Settings", {"allow_delivery_of_overproduced_qty": 1}) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_delivery_of_overproduced_qty": 1}) + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"overproduction_percentage_for_work_order": 20} ) def test_over_production_delivery(self): @@ -329,8 +323,8 @@ class IntegrationTestSubcontractingInwardOrder(IntegrationTestCase): delivery.items[0].qty = 6 self.assertRaises(frappe.ValidationError, delivery.submit) - @IntegrationTestCase.change_settings("Selling Settings", {"deliver_scrap_items": 1}) - def test_scrap_delivery(self): + @ERPNextTestSuite.change_settings("Selling Settings", {"deliver_scrap_items": 1}) + def test_secondary_items_delivery(self): new_bom = frappe.copy_doc(frappe.get_doc("BOM", "BOM-Basic FG Item-001")) new_bom.scrap_items.append(frappe.new_doc("BOM Scrap Item", item_code="Basic RM 2", qty=1)) new_bom.submit() diff --git a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py index 363a9cdd565..0ce5ef4216b 100644 --- a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py +++ b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py @@ -5,7 +5,6 @@ import copy from collections import defaultdict import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt from erpnext.buying.doctype.purchase_order.purchase_order import get_mapped_subcontracting_order @@ -31,9 +30,10 @@ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import ( make_subcontracting_receipt, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSubcontractingOrder(IntegrationTestCase): +class TestSubcontractingOrder(ERPNextTestSuite): def setUp(self): make_subcontracted_items() make_raw_materials() diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py index 489f2bf82cd..6447db4ade4 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py @@ -5,7 +5,6 @@ import copy import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cint, flt, nowtime, today import erpnext @@ -41,9 +40,10 @@ from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order im from erpnext.subcontracting.doctype.subcontracting_receipt.subcontracting_receipt import ( BOMQuantityError, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSubcontractingReceipt(IntegrationTestCase): +class TestSubcontractingReceipt(ERPNextTestSuite): def setUp(self): make_subcontracted_items() make_raw_materials() @@ -497,7 +497,7 @@ class TestSubcontractingReceipt(IntegrationTestCase): self.assertEqual(expected_values[gle.account][0], gle.debit) self.assertEqual(expected_values[gle.account][1], gle.credit) - @IntegrationTestCase.change_settings("Stock Settings", {"use_serial_batch_fields": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"use_serial_batch_fields": 0}) def test_subcontracting_receipt_with_zero_service_cost(self): warehouse = "Stores - TCP1" service_items = [ @@ -1439,7 +1439,7 @@ class TestSubcontractingReceipt(IntegrationTestCase): sr.reload() self.assertEqual(sr.items[0].rejected_qty, 2) # Should remain the same - @IntegrationTestCase.change_settings("Buying Settings", {"auto_create_purchase_receipt": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"auto_create_purchase_receipt": 1}) def test_auto_create_purchase_receipt(self): from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order @@ -1503,7 +1503,7 @@ class TestSubcontractingReceipt(IntegrationTestCase): self.assertEqual(pr_details[0]["total_taxes_and_charges"], 60) - @IntegrationTestCase.change_settings("Buying Settings", {"auto_create_purchase_receipt": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"auto_create_purchase_receipt": 1}) def test_auto_create_purchase_receipt_with_no_reference_of_po_item(self): from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order @@ -2001,8 +2001,8 @@ class TestSubcontractingReceipt(IntegrationTestCase): self.assertRaises(BOMQuantityError, scr.submit) - @IntegrationTestCase.change_settings("Buying Settings", {"over_transfer_allowance": 20}) - @IntegrationTestCase.change_settings("Stock Settings", {"over_delivery_receipt_allowance": 20}) + @ERPNextTestSuite.change_settings("Buying Settings", {"over_transfer_allowance": 20}) + @ERPNextTestSuite.change_settings("Stock Settings", {"over_delivery_receipt_allowance": 20}) def test_over_receipt(self): from erpnext.controllers.subcontracting_controller import make_rm_stock_entry diff --git a/erpnext/support/doctype/issue/test_issue.py b/erpnext/support/doctype/issue/test_issue.py index 92979839d1b..acb3869ce6b 100644 --- a/erpnext/support/doctype/issue/test_issue.py +++ b/erpnext/support/doctype/issue/test_issue.py @@ -5,15 +5,15 @@ import unittest import frappe from frappe import _ from frappe.core.doctype.user_permission.test_user_permission import create_user -from frappe.tests import IntegrationTestCase from frappe.utils import flt, get_datetime from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import ( create_service_level_agreements_for_issues, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSetUp(IntegrationTestCase): +class TestSetUp(ERPNextTestSuite): def setUp(self): frappe.db.sql("delete from `tabService Level Agreement`") frappe.db.sql("delete from `tabService Level Priority`") diff --git a/erpnext/support/doctype/issue_priority/test_issue_priority.py b/erpnext/support/doctype/issue_priority/test_issue_priority.py index 8a7140ff3cb..df844c54a16 100644 --- a/erpnext/support/doctype/issue_priority/test_issue_priority.py +++ b/erpnext/support/doctype/issue_priority/test_issue_priority.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestIssuePriority(IntegrationTestCase): +class TestIssuePriority(ERPNextTestSuite): def test_priorities(self): make_priorities() priorities = frappe.get_list("Issue Priority") diff --git a/erpnext/support/doctype/issue_type/test_issue_type.py b/erpnext/support/doctype/issue_type/test_issue_type.py index 6bdc647aa3a..276db1f3661 100644 --- a/erpnext/support/doctype/issue_type/test_issue_type.py +++ b/erpnext/support/doctype/issue_type/test_issue_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestIssueType(IntegrationTestCase): +class TestIssueType(ERPNextTestSuite): pass diff --git a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py index 988bd54e9f6..4ddedd1954c 100644 --- a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py +++ b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py @@ -4,16 +4,16 @@ import datetime import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt from erpnext.support.doctype.issue_priority.test_issue_priority import make_priorities from erpnext.support.doctype.service_level_agreement.service_level_agreement import ( get_service_level_agreement_fields, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestServiceLevelAgreement(IntegrationTestCase): +class TestServiceLevelAgreement(ERPNextTestSuite): def setUp(self): self.create_company() frappe.db.set_single_value("Support Settings", "track_service_level_agreement", 1) diff --git a/erpnext/support/doctype/support_settings/test_support_settings.py b/erpnext/support/doctype/support_settings/test_support_settings.py index 751c8d907cd..56bcd245d48 100644 --- a/erpnext/support/doctype/support_settings/test_support_settings.py +++ b/erpnext/support/doctype/support_settings/test_support_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSupportSettings(IntegrationTestCase): +class TestSupportSettings(ERPNextTestSuite): pass diff --git a/erpnext/support/doctype/warranty_claim/test_warranty_claim.py b/erpnext/support/doctype/warranty_claim/test_warranty_claim.py index ff41f36b2cd..1d5cf1f98b1 100644 --- a/erpnext/support/doctype/warranty_claim/test_warranty_claim.py +++ b/erpnext/support/doctype/warranty_claim/test_warranty_claim.py @@ -2,9 +2,8 @@ # See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestWarrantyClaim(IntegrationTestCase): +class TestWarrantyClaim(ERPNextTestSuite): pass diff --git a/erpnext/support/report/issue_analytics/test_issue_analytics.py b/erpnext/support/report/issue_analytics/test_issue_analytics.py index 1598ef9d295..039b8ef0551 100644 --- a/erpnext/support/report/issue_analytics/test_issue_analytics.py +++ b/erpnext/support/report/issue_analytics/test_issue_analytics.py @@ -2,7 +2,6 @@ import unittest import frappe from frappe.desk.form.assign_to import add as add_assignment -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, getdate from erpnext.support.doctype.issue.test_issue import create_customer, make_issue @@ -10,11 +9,12 @@ from erpnext.support.doctype.service_level_agreement.test_service_level_agreemen create_service_level_agreements_for_issues, ) from erpnext.support.report.issue_analytics.issue_analytics import execute +from erpnext.tests.utils import ERPNextTestSuite months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] -class TestIssueAnalytics(IntegrationTestCase): +class TestIssueAnalytics(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/telephony/doctype/call_log/test_call_log.py b/erpnext/telephony/doctype/call_log/test_call_log.py index e50a13d9f9e..bed31027f01 100644 --- a/erpnext/telephony/doctype/call_log/test_call_log.py +++ b/erpnext/telephony/doctype/call_log/test_call_log.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCallLog(IntegrationTestCase): +class TestCallLog(ERPNextTestSuite): pass diff --git a/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py b/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py index 594e17e0f32..9171b30c105 100644 --- a/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py +++ b/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestIncomingCallSettings(IntegrationTestCase): +class TestIncomingCallSettings(ERPNextTestSuite): pass diff --git a/erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py b/erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py index 3c8e4952401..e222f866612 100644 --- a/erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py +++ b/erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestTelephonyCallType(IntegrationTestCase): +class TestTelephonyCallType(ERPNextTestSuite): pass diff --git a/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py b/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py index c1c6d68d964..d660fb1a6fc 100644 --- a/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py +++ b/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestVoiceCallSettings(IntegrationTestCase): +class TestVoiceCallSettings(ERPNextTestSuite): pass diff --git a/erpnext/tests/test_activation.py b/erpnext/tests/test_activation.py index 8968017d2f0..7c338e105d1 100644 --- a/erpnext/tests/test_activation.py +++ b/erpnext/tests/test_activation.py @@ -1,9 +1,8 @@ -from frappe.tests import IntegrationTestCase - +from erpnext.tests.utils import ERPNextTestSuite from erpnext.utilities.activation import get_level -class TestActivation(IntegrationTestCase): +class TestActivation(ERPNextTestSuite): def test_activation(self): site_info = {"activation": {"activation_level": 0, "sales_data": []}} levels = get_level(site_info) diff --git a/erpnext/tests/test_init.py b/erpnext/tests/test_init.py index 70944f4114c..4be96199ddd 100644 --- a/erpnext/tests/test_init.py +++ b/erpnext/tests/test_init.py @@ -1,12 +1,8 @@ -import unittest - -import frappe -from frappe.tests import IntegrationTestCase - from erpnext import encode_company_abbr +from erpnext.tests.utils import ERPNextTestSuite -class TestInit(IntegrationTestCase): +class TestInit(ERPNextTestSuite): def test_encode_company_abbr(self): abbr = "NFECT" diff --git a/erpnext/tests/test_notifications.py b/erpnext/tests/test_notifications.py index 9c27229d335..1e0a48065dd 100644 --- a/erpnext/tests/test_notifications.py +++ b/erpnext/tests/test_notifications.py @@ -4,10 +4,11 @@ import unittest import frappe from frappe.desk import notifications -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestNotifications(IntegrationTestCase): +class TestNotifications(ERPNextTestSuite): def test_get_notifications_for_targets(self): """ Test notification config entries for targets as percentages diff --git a/erpnext/tests/test_perf.py b/erpnext/tests/test_perf.py index 4967d981dda..cb4ecd2ee13 100644 --- a/erpnext/tests/test_perf.py +++ b/erpnext/tests/test_perf.py @@ -1,5 +1,6 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite INDEXED_FIELDS = { "Bin": ["item_code"], @@ -8,7 +9,7 @@ INDEXED_FIELDS = { } -class TestPerformance(IntegrationTestCase): +class TestPerformance(ERPNextTestSuite): def test_ensure_indexes(self): # These fields are not explicitly indexed BUT they are prefix in some # other composite index. If those are removed this test should be diff --git a/erpnext/tests/test_point_of_sale.py b/erpnext/tests/test_point_of_sale.py index 589c7cb0e48..36fad7ad64f 100644 --- a/erpnext/tests/test_point_of_sale.py +++ b/erpnext/tests/test_point_of_sale.py @@ -2,16 +2,14 @@ # MIT License. See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase - from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile from erpnext.selling.page.point_of_sale.point_of_sale import get_items from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPointOfSale(IntegrationTestCase): +class TestPointOfSale(ERPNextTestSuite): def test_item_search(self): """ Test Stock and Service Item Search. diff --git a/erpnext/tests/test_regional.py b/erpnext/tests/test_regional.py index 83f551aae8e..648986bf648 100644 --- a/erpnext/tests/test_regional.py +++ b/erpnext/tests/test_regional.py @@ -1,9 +1,9 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase import erpnext +from erpnext.tests.utils import ERPNextTestSuite @erpnext.allow_regional @@ -11,7 +11,7 @@ def test_method(): return "original" -class TestInit(IntegrationTestCase): +class TestInit(ERPNextTestSuite): def test_regional_overrides(self): frappe.flags.country = "Maldives" self.assertEqual(test_method(), "original") diff --git a/erpnext/tests/test_webform.py b/erpnext/tests/test_webform.py index 5f600941e8f..8b4ed9ceec9 100644 --- a/erpnext/tests/test_webform.py +++ b/erpnext/tests/test_webform.py @@ -1,13 +1,13 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.buying.doctype.supplier.test_supplier import create_supplier +from erpnext.tests.utils import ERPNextTestSuite -class TestWebsite(IntegrationTestCase): +class TestWebsite(ERPNextTestSuite): def test_permission_for_custom_doctype(self): create_user("Supplier 1", "supplier1@gmail.com") create_user("Supplier 2", "supplier2@gmail.com") diff --git a/erpnext/tests/test_zform_loads.py b/erpnext/tests/test_zform_loads.py index ef68c10273f..3d24b77c92a 100644 --- a/erpnext/tests/test_zform_loads.py +++ b/erpnext/tests/test_zform_loads.py @@ -2,12 +2,13 @@ import frappe from frappe.desk.form.load import getdoc -from frappe.tests import IntegrationTestCase from frappe.www.printview import get_html_and_style +from erpnext.tests.utils import ERPNextTestSuite -class TestFormLoads(IntegrationTestCase): - @IntegrationTestCase.change_settings("Print Settings", {"allow_print_for_cancelled": 1}) + +class TestFormLoads(ERPNextTestSuite): + @ERPNextTestSuite.change_settings("Print Settings", {"allow_print_for_cancelled": 1}) def test_load(self): erpnext_modules = frappe.get_all("Module Def", filters={"app_name": "erpnext"}, pluck="name") doctypes = frappe.get_all( diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index a2a9ba57377..9d0f4ebc0e4 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -7,7 +7,6 @@ from typing import Any, NewType import frappe from frappe import _ from frappe.core.doctype.report.report import get_report_module_dotted_path -from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime ReportFilters = dict[str, Any] diff --git a/erpnext/utilities/doctype/video/test_video.py b/erpnext/utilities/doctype/video/test_video.py index 4d37c575f84..55201932259 100644 --- a/erpnext/utilities/doctype/video/test_video.py +++ b/erpnext/utilities/doctype/video/test_video.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestVideo(IntegrationTestCase): +class TestVideo(ERPNextTestSuite): pass diff --git a/erpnext/utilities/doctype/video_settings/test_video_settings.py b/erpnext/utilities/doctype/video_settings/test_video_settings.py index fea375e5128..2fb854128ff 100644 --- a/erpnext/utilities/doctype/video_settings/test_video_settings.py +++ b/erpnext/utilities/doctype/video_settings/test_video_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestVideoSettings(IntegrationTestCase): +class TestVideoSettings(ERPNextTestSuite): pass From 3aef8ffa24e372f59ab454fa6178b37165a11fae Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 6 Jun 2025 13:25:30 +0530 Subject: [PATCH 028/217] refactor: temporary standing decorator for change_settings --- erpnext/tests/utils.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 9d0f4ebc0e4..502cdfb5a63 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -2,6 +2,7 @@ # License: GNU General Public License v3. See license.txt import unittest +from contextlib import contextmanager from typing import Any, NewType import frappe @@ -120,6 +121,14 @@ def if_lending_app_not_installed(function): class ERPNextTestSuite(unittest.TestCase): + @classmethod + def registerAs(cls, _as): + def decorator(cm_func): + setattr(cls, cm_func.__name__, _as(cm_func)) + return cm_func + + return decorator + @classmethod def setUpClass(cls): super().setUpClass() @@ -621,3 +630,29 @@ class ERPNextTestSuite(unittest.TestCase): }, ) ) + + +@ERPNextTestSuite.registerAs(staticmethod) +@contextmanager +def change_settings(doctype, settings_dict=None, /, **settings) -> None: + """Temporarily: change settings in a settings doctype.""" + import copy + + if settings_dict is None: + settings_dict = settings + + settings = frappe.get_doc(doctype) + previous_settings = copy.deepcopy(settings_dict) + for key in previous_settings: + previous_settings[key] = getattr(settings, key) + + for key, value in settings_dict.items(): + setattr(settings, key, value) + settings.save(ignore_permissions=True) + + yield + + settings = frappe.get_doc(doctype) + for key, value in previous_settings.items(): + setattr(settings, key, value) + settings.save(ignore_permissions=True) From fbd2a181bd8ab9cc22bfee2c6e77a02443f8611b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 7 Jun 2025 13:37:53 +0530 Subject: [PATCH 029/217] refactor(test): make all presets in setupclass --- .../operations/install_fixtures.py | 7 +- erpnext/tests/utils.py | 320 +++++++++++++++--- 2 files changed, 273 insertions(+), 54 deletions(-) diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index b1d64f8311b..c72b205f482 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -23,7 +23,7 @@ def read_lines(filename: str) -> list[str]: return (Path(__file__).parent.parent / "data" / filename).read_text().splitlines() -def install(country=None): +def get_preset_records(country=None): records = [ # ensure at least an empty Address Template exists for this Country {"doctype": "Address Template", "country": country}, @@ -316,6 +316,11 @@ def install(country=None): {"doctype": "Workstation Operating Component", "component_name": _("Rent")}, {"doctype": "Workstation Operating Component", "component_name": _("Wages")}, ] + return records + + +def install(country=None): + records = get_preset_records(country) for doctype, title_field, filename in ( ("Designation", "designation_name", "designation.txt"), diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 502cdfb5a63..b97aa2df7c7 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -131,17 +131,57 @@ class ERPNextTestSuite(unittest.TestCase): @classmethod def setUpClass(cls): - super().setUpClass() + cls.make_presets() cls.make_persistant_master_data() + @classmethod + def make_presets(cls): + from frappe.desk.page.setup_wizard.install_fixtures import update_genders, update_salutations + + from erpnext.setup.setup_wizard.operations.install_fixtures import add_uom_data, get_preset_records + + update_genders() + update_salutations() + + records = get_preset_records("India") + presets_primary_key_map = { + "Address Template": "country", + "Item Group": "item_group_name", + "Territory": "territory_name", + "Customer Group": "customer_group_name", + "Supplier Group": "supplier_group_name", + "Sales Person": "sales_person_name", + "Mode of Payment": "mode_of_payment", + "Activity Type": "activity_type", + "Item Attribute": "attribute_name", + "Party Type": "party_type", + "Project Type": "project_type", + "Print Heading": "print_heading", + "Share Type": "title", + "Market Segment": "market_segment", + } + for x in records: + dt = x.get("doctype") + dn = x.get("name") or x.get(presets_primary_key_map.get(dt)) + + if not frappe.db.exists(dt, dn): + doc = frappe.get_doc(x) + doc.insert() + + add_uom_data() + + frappe.db.commit() + @classmethod def make_persistant_master_data(cls): - # presets and default are mandatory for company - cls.make_warehouse_type() - cls.make_uom() - cls.make_address_template() cls.make_fiscal_year() cls.make_company() + cls.make_supplier_group() + cls.make_payment_term() + cls.make_payment_terms_template() + cls.make_tax_category() + cls.make_account() + cls.make_supplier() cls.update_stock_settings() frappe.db.commit() @@ -207,54 +247,6 @@ class ERPNextTestSuite(unittest.TestCase): ) ) - @classmethod - def make_address_template(cls): - records = [ - { - "doctype": "Address Template", - "country": "India", - "is_default": True, - "template": """ - {{ address_line1 }}
- {% if address_line2 %}{{ address_line2 }}
{% endif -%} - {{ city }}
- {% if state %}{{ state }}
{% endif -%} - {% if pincode %}{{ pincode }}
{% endif -%} - {{ country }}
-
- {% if phone %}{{ _("Phone") }}: {{ phone }}
{% endif -%} - {% if fax %}{{ _("Fax") }}: {{ fax }}
{% endif -%} - {% if email_id %}{{ _("Email") }}: {{ email_id }}
{% endif -%} - """, - } - ] - cls.address_template = [] - for x in records: - if not frappe.db.exists("Address Template", {"country": x.get("country")}): - cls.address_template.append(frappe.get_doc(x).insert()) - else: - cls.address_template.append(frappe.get_doc("Address Template", {"country": x.get("country")})) - - @classmethod - def make_uom(cls): - records = [{"doctype": "UOM", "uom_name": "Nos", "must_be_whole_number": 1, "common_code": "C62"}] - cls.uom = [] - for x in records: - if not frappe.db.exists("UOM", {"uom_name": x.get("uom_name")}): - cls.warehouse_type.append(frappe.get_doc(x).insert()) - else: - cls.warehouse_type.append(frappe.get_doc("UOM", {"uom_name": x.get("uom_name")})) - - @classmethod - def make_warehouse_type(cls): - records = [{"doctype": "Warehouse Type", "name": "Transit"}] - cls.warehouse_type = [] - for x in records: - if not frappe.db.exists("Warehouse Type", {"name": x.get("name")}): - cls.warehouse_type.append(frappe.get_doc(x).insert()) - else: - cls.warehouse_type.append(frappe.get_doc("Warehouse Type", {"name": x.get("name")})) - @classmethod def make_monthly_distribution(cls): records = [ @@ -631,6 +623,228 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_payment_term(cls): + records = [ + { + "doctype": "Payment Term", + "due_date_based_on": "Day(s) after invoice date", + "payment_term_name": "_Test N30", + "description": "_Test Net 30 Days", + "invoice_portion": 50, + "credit_days": 30, + }, + { + "doctype": "Payment Term", + "due_date_based_on": "Day(s) after invoice date", + "payment_term_name": "_Test COD", + "description": "_Test Cash on Delivery", + "invoice_portion": 50, + "credit_days": 0, + }, + { + "doctype": "Payment Term", + "due_date_based_on": "Month(s) after the end of the invoice month", + "payment_term_name": "_Test EONM", + "description": "_Test End of Next Month", + "invoice_portion": 100, + "credit_months": 1, + }, + { + "doctype": "Payment Term", + "due_date_based_on": "Day(s) after invoice date", + "payment_term_name": "_Test N30 1", + "description": "_Test Net 30 Days", + "invoice_portion": 100, + "credit_days": 30, + }, + ] + cls.payment_terms = [] + for x in records: + if not frappe.db.exists("Payment Term", {"payment_term_name": x.get("payment_term_name")}): + cls.payment_terms.append(frappe.get_doc(x).insert()) + else: + cls.payment_terms.append( + frappe.get_doc("Payment Term", {"payment_term_name": x.get("payment_term_name")}) + ) + + @classmethod + def make_payment_terms_template(cls): + records = [ + { + "doctype": "Payment Terms Template", + "terms": [ + { + "doctype": "Payment Terms Template Detail", + "due_date_based_on": "Day(s) after invoice date", + "idx": 1, + "description": "Cash on Delivery", + "invoice_portion": 50, + "credit_days": 0, + "credit_months": 0, + "payment_term": "_Test COD", + }, + { + "doctype": "Payment Terms Template Detail", + "due_date_based_on": "Day(s) after invoice date", + "idx": 2, + "description": "Net 30 Days ", + "invoice_portion": 50, + "credit_days": 30, + "credit_months": 0, + "payment_term": "_Test N30", + }, + ], + "template_name": "_Test Payment Term Template", + }, + { + "doctype": "Payment Terms Template", + "terms": [ + { + "doctype": "Payment Terms Template Detail", + "due_date_based_on": "Month(s) after the end of the invoice month", + "idx": 1, + "description": "_Test End of Next Months", + "invoice_portion": 100, + "credit_days": 0, + "credit_months": 1, + "payment_term": "_Test EONM", + } + ], + "template_name": "_Test Payment Term Template 1", + }, + { + "doctype": "Payment Terms Template", + "terms": [ + { + "doctype": "Payment Terms Template Detail", + "due_date_based_on": "Day(s) after invoice date", + "idx": 1, + "description": "_Test Net Within 30 days", + "invoice_portion": 100, + "credit_days": 30, + "credit_months": 0, + "payment_term": "_Test N30 1", + } + ], + "template_name": "_Test Payment Term Template 3", + }, + ] + cls.payment_terms_template = [] + for x in records: + if not frappe.db.exists("Payment Terms Template", {"template_name": x.get("template_name")}): + cls.payment_terms_template.append(frappe.get_doc(x).insert()) + else: + cls.payment_terms_template.append( + frappe.get_doc("Payment Terms Template", {"template_name": x.get("template_name")}) + ) + + @classmethod + def make_tax_category(cls): + records = [ + {"doctype": "Tax Category", "title": "_Test Tax Category 1"}, + {"doctype": "Tax Category", "title": "_Test Tax Category 2"}, + {"doctype": "Tax Category", "title": "_Test Tax Category 3"}, + ] + cls.tax_category = [] + for x in records: + if not frappe.db.exists("Tax Category", {"name": x.get("title")}): + cls.tax_category.append(frappe.get_doc(x).insert()) + else: + cls.tax_category.append(frappe.get_doc("Tax Category", {"name": x.get("title")})) + + @classmethod + def make_account(cls): + records = [ + { + "doctype": "Account", + "account_name": "_Test Payable USD", + "parent_account": "Accounts Receivable - _TC", + "company": "_Test Company", + "account_currency": "USD", + }, + ] + cls.accounts = [] + for x in records: + if not frappe.db.exists("Account", {"account_name": x.get("account_name")}): + cls.accounts.append(frappe.get_doc(x).insert()) + else: + cls.accounts.append(frappe.get_doc("Account", {"account_name": x.get("account_name")})) + + @classmethod + def make_supplier(cls): + records = [ + { + "doctype": "Supplier", + "supplier_name": "_Test Supplier With Template 1", + "supplier_group": "_Test Supplier Group", + "payment_terms": "_Test Payment Term Template 3", + }, + { + "doctype": "Supplier", + "supplier_name": "_Test Supplier P", + "supplier_group": "_Test Supplier Group", + }, + { + "doctype": "Supplier", + "supplier_name": "_Test Supplier with Country", + "supplier_group": "_Test Supplier Group", + "country": "Greece", + }, + { + "doctype": "Supplier", + "supplier_name": "_Test Supplier", + "supplier_group": "_Test Supplier Group", + }, + { + "doctype": "Supplier", + "supplier_name": "_Test Supplier 1", + "supplier_group": "_Test Supplier Group", + }, + { + "doctype": "Supplier", + "supplier_name": "_Test Supplier 2", + "supplier_group": "_Test Supplier Group", + }, + { + "doctype": "Supplier", + "supplier_name": "_Test Supplier USD", + "supplier_group": "_Test Supplier Group", + "default_currency": "USD", + "accounts": [{"company": "_Test Company", "account": "_Test Payable USD - _TC"}], + }, + { + "doctype": "Supplier", + "supplier_name": "_Test Supplier With Tax Category", + "supplier_group": "_Test Supplier Group", + "tax_category": "_Test Tax Category 1", + }, + ] + cls.suppliers = [] + for x in records: + if not frappe.db.exists("Supplier", {"supplier_name": x.get("supplier_name")}): + cls.suppliers.append(frappe.get_doc(x).insert()) + else: + cls.suppliers.append(frappe.get_doc("Supplier", {"supplier_name": x.get("supplier_name")})) + + @classmethod + def make_supplier_group(cls): + records = [ + { + "doctype": "Supplier Group", + "supplier_group_name": "_Test Supplier Group", + "parent_supplier_group": "All Supplier Groups", + } + ] + cls.supplier_groups = [] + for x in records: + if not frappe.db.exists("Supplier Group", {"supplier_group_name": x.get("supplier_group_name")}): + cls.supplier_groups.append(frappe.get_doc(x).insert()) + else: + cls.supplier_groups.append( + frappe.get_doc("Supplier Group", {"supplier_group_name": x.get("supplier_group_name")}) + ) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From f0b4b02358ca2a6f29da53085bd2962da84156e5 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 10 Jun 2025 17:06:31 +0530 Subject: [PATCH 030/217] refactor(test): even more master data setup --- erpnext/tests/utils.py | 234 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 232 insertions(+), 2 deletions(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index b97aa2df7c7..b63502f8b7d 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -182,6 +182,11 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_tax_category() cls.make_account() cls.make_supplier() + cls.make_role() + cls.make_department() + cls.make_territory() + cls.make_customer_group() + cls.make_user() cls.update_stock_settings() frappe.db.commit() @@ -297,6 +302,196 @@ class ERPNextTestSuite(unittest.TestCase): else: cls.projects.append(frappe.get_doc("Project", {"project_name": x.get("project_name")})) + @classmethod + def make_customer_group(cls): + records = [ + { + "customer_group_name": "_Test Customer Group", + "doctype": "Customer Group", + "is_group": 0, + "parent_customer_group": "All Customer Groups", + }, + { + "customer_group_name": "_Test Customer Group 1", + "doctype": "Customer Group", + "is_group": 0, + "parent_customer_group": "All Customer Groups", + }, + ] + cls.customer_group = [] + for x in records: + if not frappe.db.exists("Customer Group", {"customer_group_name": x.get("customer_group_name")}): + cls.customer_group.append(frappe.get_doc(x).insert()) + else: + cls.customer_group.append( + frappe.get_doc("Customer Group", {"customer_group_name": x.get("customer_group_name")}) + ) + + @classmethod + def make_territory(cls): + records = [ + { + "doctype": "Territory", + "is_group": 0, + "parent_territory": "All Territories", + "territory_name": "_Test Territory", + }, + { + "doctype": "Territory", + "is_group": 1, + "parent_territory": "All Territories", + "territory_name": "_Test Territory India", + }, + { + "doctype": "Territory", + "is_group": 0, + "parent_territory": "_Test Territory India", + "territory_name": "_Test Territory Maharashtra", + }, + { + "doctype": "Territory", + "is_group": 0, + "parent_territory": "All Territories", + "territory_name": "_Test Territory Rest Of The World", + }, + { + "doctype": "Territory", + "is_group": 0, + "parent_territory": "All Territories", + "territory_name": "_Test Territory United States", + }, + ] + cls.territories = [] + for x in records: + if not frappe.db.exists("Territory", {"territory_name": x.get("territory_name")}): + cls.territories.append(frappe.get_doc(x).insert()) + else: + cls.territories.append( + frappe.get_doc("Territory", {"territory_name": x.get("territory_name")}) + ) + + @classmethod + def make_department(cls): + records = [ + { + "doctype": "Department", + "department_name": "_Test Department", + "company": "_Test Company", + "parent_department": "All Departments", + }, + { + "doctype": "Department", + "department_name": "_Test Department 1", + "company": "_Test Company", + "parent_department": "All Departments", + }, + ] + cls.department = [] + for x in records: + if not frappe.db.exists("Department", {"department_name": x.get("department_name")}): + cls.department.append(frappe.get_doc(x).insert()) + else: + cls.department.append( + frappe.get_doc("Department", {"department_name": x.get("department_name")}) + ) + + @classmethod + def make_role(cls): + records = [ + {"doctype": "Role", "role_name": "_Test Role", "desk_access": 1}, + {"doctype": "Role", "role_name": "_Test Role 2", "desk_access": 1}, + {"doctype": "Role", "role_name": "_Test Role 3", "desk_access": 1}, + {"doctype": "Role", "role_name": "_Test Role 4", "desk_access": 0}, + ] + cls.roles = [] + for x in records: + if not frappe.db.exists("Role", {"role_name": x.get("role_name")}): + cls.roles.append(frappe.get_doc(x).insert()) + else: + cls.roles.append(frappe.get_doc("Role", {"role_name": x.get("role_name")})) + + @classmethod + def make_user(cls): + records = [ + { + "doctype": "User", + "email": "test@example.com", + "enabled": 1, + "first_name": "_Test", + "new_password": "Eastern_43A1W", + "roles": [ + {"doctype": "Has Role", "parentfield": "roles", "role": "_Test Role"}, + {"doctype": "Has Role", "parentfield": "roles", "role": "System Manager"}, + ], + }, + { + "doctype": "User", + "email": "test1@example.com", + "first_name": "_Test1", + "new_password": "Eastern_43A1W", + }, + { + "doctype": "User", + "email": "test2@example.com", + "first_name": "_Test2", + "new_password": "Eastern_43A1W", + "enabled": 1, + }, + { + "doctype": "User", + "email": "test3@example.com", + "first_name": "_Test3", + "new_password": "Eastern_43A1W", + "enabled": 1, + }, + { + "doctype": "User", + "email": "test4@example.com", + "first_name": "_Test4", + "new_password": "Eastern_43A1W", + "enabled": 1, + }, + { + "doctype": "User", + "email": "test'5@example.com", + "first_name": "_Test'5", + "new_password": "Eastern_43A1W", + "enabled": 1, + }, + { + "doctype": "User", + "email": "testperm@example.com", + "first_name": "_Test Perm", + "new_password": "Eastern_43A1W", + "enabled": 1, + }, + { + "doctype": "User", + "email": "testdelete@example.com", + "enabled": 1, + "first_name": "_Test", + "new_password": "Eastern_43A1W", + "roles": [ + {"doctype": "Has Role", "parentfield": "roles", "role": "_Test Role 2"}, + {"doctype": "Has Role", "parentfield": "roles", "role": "System Manager"}, + ], + }, + { + "doctype": "User", + "email": "testpassword@example.com", + "enabled": 1, + "first_name": "_Test", + "new_password": "Eastern_43A1W", + "roles": [{"doctype": "Has Role", "parentfield": "roles", "role": "System Manager"}], + }, + ] + cls.users = [] + for x in records: + if not frappe.db.exists("User", {"email": x.get("email")}): + cls.users.append(frappe.get_doc(x).insert()) + else: + cls.users.append(frappe.get_doc("User", {"email": x.get("email")})) + @classmethod def make_employees(cls): records = [ @@ -560,6 +755,23 @@ class ERPNextTestSuite(unittest.TestCase): # "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, }, + { + "doctype": "Company", + "default_currency": "USD", + "full_name": "Test User", + "company_name": "Wind Power LLC", + "timezone": "America/New_York", + "company_abbr": "WP", + "industry": "Manufacturing", + "country": "United States", + # "fy_start_date": f"{current_year}-01-01", + # "fy_end_date": f"{current_year}-12-31", + "language": "english", + "company_tagline": "Testing", + "email": "test@erpnext.com", + "password": "test", + "chart_of_accounts": "Standard", + }, ] cls.companies = [] for x in records: @@ -763,13 +975,31 @@ class ERPNextTestSuite(unittest.TestCase): "company": "_Test Company", "account_currency": "USD", }, + { + "doctype": "Account", + "account_name": "_Test Bank", + "parent_account": "Bank Accounts - _TC", + "company": "_Test Company", + }, + { + "doctype": "Account", + "account_name": "_Test Bank", + "parent_account": "Bank Accounts - TCP1", + "company": "_Test Company with perpetual inventory", + }, ] cls.accounts = [] for x in records: - if not frappe.db.exists("Account", {"account_name": x.get("account_name")}): + if not frappe.db.exists( + "Account", {"account_name": x.get("account_name"), "company": x.get("company")} + ): cls.accounts.append(frappe.get_doc(x).insert()) else: - cls.accounts.append(frappe.get_doc("Account", {"account_name": x.get("account_name")})) + cls.accounts.append( + frappe.get_doc( + "Account", {"account_name": x.get("account_name"), "company": x.get("company")} + ) + ) @classmethod def make_supplier(cls): From b5558d411b10ae52c1618cedffda2849874bcd18 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 09:53:57 +0530 Subject: [PATCH 031/217] refactor: suppress welcome mail --- erpnext/tests/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index b63502f8b7d..e3339b6febd 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -488,7 +488,9 @@ class ERPNextTestSuite(unittest.TestCase): cls.users = [] for x in records: if not frappe.db.exists("User", {"email": x.get("email")}): - cls.users.append(frappe.get_doc(x).insert()) + user = frappe.get_doc(x) + user.flags.no_welcome_mail = True + cls.users.append(user.insert()) else: cls.users.append(frappe.get_doc("User", {"email": x.get("email")})) From 2554750a5962b358ab4a93316f0264c121311a6f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 10:52:16 +0530 Subject: [PATCH 032/217] refactor(test): make cost center --- erpnext/tests/utils.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index e3339b6febd..d9f4525c411 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -187,6 +187,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_territory() cls.make_customer_group() cls.make_user() + cls.make_cost_center() cls.update_stock_settings() frappe.db.commit() @@ -1077,6 +1078,45 @@ class ERPNextTestSuite(unittest.TestCase): frappe.get_doc("Supplier Group", {"supplier_group_name": x.get("supplier_group_name")}) ) + @classmethod + def make_cost_center(cls): + records = [ + { + "company": "_Test Company", + "cost_center_name": "_Test Cost Center", + "doctype": "Cost Center", + "is_group": 0, + "parent_cost_center": "_Test Company - _TC", + }, + { + "company": "_Test Company", + "cost_center_name": "_Test Cost Center 2", + "doctype": "Cost Center", + "is_group": 0, + "parent_cost_center": "_Test Company - _TC", + }, + { + "company": "_Test Company", + "cost_center_name": "_Test Write Off Cost Center", + "doctype": "Cost Center", + "is_group": 0, + "parent_cost_center": "_Test Company - _TC", + }, + ] + cls.cost_center = [] + for x in records: + if not frappe.db.exists( + "Cost Center", {"cost_center_name": x.get("cost_center_name"), "company": x.get("company")} + ): + cls.cost_center.append(frappe.get_doc(x).insert()) + else: + cls.cost_center.append( + frappe.get_doc( + "Cost Center", + {"cost_center_name": x.get("cost_center_name"), "company": x.get("company")}, + ) + ) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From 348bb95268e8f0948ef7298bdeee538f69f1ef1f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 11:00:18 +0530 Subject: [PATCH 033/217] refactor(test): setup fiscal years without any gap --- erpnext/tests/utils.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index d9f4525c411..6ff2510bc14 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -796,21 +796,8 @@ class ERPNextTestSuite(unittest.TestCase): ] start = 2012 - this_year = now_datetime().year end = now_datetime().year + 25 - # The current year fails to load with the following error: - # Year start date or end date is overlapping with 2024. To avoid please set company - # This is a quick-fix: if current FY is needed, please refactor test data properly - for year in range(start, this_year): - records.append( - { - "doctype": "Fiscal Year", - "year": f"_Test Fiscal Year {year}", - "year_start_date": f"{year}-01-01", - "year_end_date": f"{year}-12-31", - } - ) - for year in range(this_year + 1, end): + for year in range(start, end): records.append( { "doctype": "Fiscal Year", From 01f2d3699e16f7c505040eeffdf94195f91b921e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 11:29:50 +0530 Subject: [PATCH 034/217] refactor(test): make persistent location --- erpnext/tests/utils.py | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 6ff2510bc14..7438f6090ae 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -188,6 +188,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_customer_group() cls.make_user() cls.make_cost_center() + cls.make_location() cls.update_stock_settings() frappe.db.commit() @@ -1104,6 +1105,59 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_location(cls): + records = [ + {"doctype": "Location", "location_name": "Test Location Area", "is_group": 1, "is_container": 1}, + { + "doctype": "Location", + "location_name": "Basil Farm", + "location": '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"point_type":"circle","radius":884.5625420736483},"geometry":{"type":"Point","coordinates":[72.875834,19.100566]}}]}', + "parent_location": "Test Location Area", + "parent": "Test Location Area", + "is_group": 1, + "is_container": 1, + }, + { + "doctype": "Location", + "location_name": "Division 1", + "location": '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"point_type":"circle","radius":542.3424997060739},"geometry":{"type":"Point","coordinates":[72.852359,19.11557]}}]}', + "parent_location": "Basil Farm", + "parent": "Basil Farm", + "is_group": 1, + "is_container": 1, + }, + { + "doctype": "Location", + "location_name": "Field 1", + "location": '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[72.846758,19.118287],[72.846758,19.121206],[72.850535,19.121206],[72.850535,19.118287],[72.846758,19.118287]]]}}]}', + "parent_location": "Division 1", + "parent": "Division 1", + "is_group": 1, + "is_container": 1, + }, + { + "doctype": "Location", + "location_name": "Block 1", + "location": '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[72.921495,19.073313],[72.924929,19.068121],[72.934713,19.06585],[72.929392,19.05579],[72.94158,19.056926],[72.951365,19.095213],[72.921495,19.073313]]]}}]}', + "parent_location": "Field 1", + "parent": "Field 1", + "is_group": 0, + "is_container": 1, + }, + ] + cls.location = [] + for x in records: + if not frappe.db.exists("Location", {"location_name": x.get("location_name")}): + cls.location.append(frappe.get_doc(x).insert()) + else: + cls.location.append( + frappe.get_doc( + "Location", + {"location_name": x.get("location_name")}, + ) + ) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From 1e13426715050ef18f9bef4940963de99c10da5e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 11:32:14 +0530 Subject: [PATCH 035/217] chore: typo in setup method --- erpnext/tests/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 7438f6090ae..05bd12396d8 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -132,7 +132,7 @@ class ERPNextTestSuite(unittest.TestCase): @classmethod def setUpClass(cls): cls.make_presets() - cls.make_persistant_master_data() + cls.make_persistent_master_data() @classmethod def make_presets(cls): @@ -173,7 +173,7 @@ class ERPNextTestSuite(unittest.TestCase): frappe.db.commit() @classmethod - def make_persistant_master_data(cls): + def make_persistent_master_data(cls): cls.make_fiscal_year() cls.make_company() cls.make_supplier_group() From c041a94cc0e5dd5c156b699cdeeb370c77a557ec Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 12:22:32 +0530 Subject: [PATCH 036/217] refactor(test): make warehouse --- erpnext/tests/utils.py | 81 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 05bd12396d8..81b1312fce5 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -188,6 +188,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_customer_group() cls.make_user() cls.make_cost_center() + cls.make_warehouse() cls.make_location() cls.update_stock_settings() @@ -1158,6 +1159,86 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_warehouse(cls): + records = [ + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse", + "is_group": 0, + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Scrap Warehouse", + "is_group": 0, + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse 1", + "is_group": 0, + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse 2", + "is_group": 0, + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Rejected Warehouse", + "is_group": 0, + }, + { + "company": "_Test Company 1", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse 2", + "is_group": 0, + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse No Account", + "is_group": 0, + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse Group", + "is_group": 1, + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse Group-C1", + "is_group": 0, + "parent_warehouse": "_Test Warehouse Group - _TC", + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse Group-C2", + "is_group": 0, + "parent_warehouse": "_Test Warehouse Group - _TC", + }, + ] + cls.warehouse = [] + for x in records: + if not frappe.db.exists( + "Warehouse", {"warehouse_name": x.get("warehouse_name"), "company": x.get("company")} + ): + cls.warehouse.append(frappe.get_doc(x).insert()) + else: + cls.warehouse.append( + frappe.get_doc( + "Warehouse", + {"warehouse_name": x.get("warehouse_name"), "company": x.get("company")}, + ) + ) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From aa0f9219c84e9adc3707c14f0312369401529560 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 12:24:49 +0530 Subject: [PATCH 037/217] refactor(test): make item --- erpnext/tests/utils.py | 491 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 491 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 81b1312fce5..ebfa93504be 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -189,6 +189,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_user() cls.make_cost_center() cls.make_warehouse() + cls.make_item() cls.make_location() cls.update_stock_settings() @@ -1239,6 +1240,496 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_item(cls): + records = [ + { + "description": "_Test Item 1", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item", + "item_group": "_Test Item Group", + "item_name": "_Test Item", + "apply_warehouse_wise_reorder_level": 1, + "opening_stock": 10, + "valuation_rate": 100, + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + "reorder_levels": [ + { + "material_request_type": "Purchase", + "warehouse": "_Test Warehouse - _TC", + "warehouse_reorder_level": 20, + "warehouse_reorder_qty": 20, + } + ], + "uoms": [ + {"uom": "_Test UOM", "conversion_factor": 1.0}, + {"uom": "_Test UOM 1", "conversion_factor": 10.0}, + ], + "stock_uom": "_Test UOM", + }, + { + "description": "_Test Item 2", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item 2", + "item_group": "_Test Item Group", + "item_name": "_Test Item 2", + "stock_uom": "_Test UOM", + "opening_stock": 10, + "valuation_rate": 100, + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Item Home Desktop 100 3", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item Home Desktop 100", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Item Home Desktop 100", + "valuation_rate": 100, + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + "taxes": [ + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + } + ], + "stock_uom": "_Test UOM 1", + }, + { + "description": "_Test Item Home Desktop 200 4", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_sub_contracted_item": 0, + "item_code": "_Test Item Home Desktop 200", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Item Home Desktop 200", + "stock_uom": "_Test UOM 1", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Product Bundle Item 5", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 0, + "is_sub_contracted_item": 0, + "item_code": "_Test Product Bundle Item", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Product Bundle Item", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test FG Item 6", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 1, + "item_code": "_Test FG Item", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test FG Item", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Non Stock Item 7", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 0, + "is_sub_contracted_item": 0, + "item_code": "_Test Non Stock Item", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Non Stock Item", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Serialized Item 8", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 1, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Serialized Item", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Serialized Item", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Serialized Item 9", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 1, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Serialized Item With Series", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Serialized Item With Series", + "serial_no_series": "ABCD.#####", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Item Home Desktop Manufactured 10", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item Home Desktop Manufactured", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Item Home Desktop Manufactured", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test FG Item 2 11", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 1, + "item_code": "_Test FG Item 2", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test FG Item 2", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Variant Item 12", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 1, + "item_code": "_Test Variant Item", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Variant Item", + "stock_uom": "_Test UOM", + "has_variants": 1, + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + "attributes": [{"attribute": "Test Size"}], + "apply_warehouse_wise_reorder_level": 1, + "reorder_levels": [ + { + "material_request_type": "Purchase", + "warehouse": "_Test Warehouse - _TC", + "warehouse_reorder_level": 20, + "warehouse_reorder_qty": 20, + } + ], + }, + { + "description": "_Test Item 1", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item Warehouse Group Wise Reorder", + "item_group": "_Test Item Group", + "item_name": "_Test Item Warehouse Group Wise Reorder", + "apply_warehouse_wise_reorder_level": 1, + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse Group-C1 - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + "reorder_levels": [ + { + "warehouse_group": "_Test Warehouse Group - _TC", + "material_request_type": "Purchase", + "warehouse": "_Test Warehouse Group-C1 - _TC", + "warehouse_reorder_level": 20, + "warehouse_reorder_qty": 20, + } + ], + "stock_uom": "_Test UOM", + }, + { + "description": "_Test Item With Item Tax Template", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item With Item Tax Template", + "item_group": "_Test Item Group", + "item_name": "_Test Item With Item Tax Template", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + "taxes": [ + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + }, + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 12 - _TC", + "tax_category": "_Test Tax Category 1", + }, + ], + }, + { + "description": "_Test Item Inherit Group Item Tax Template 1", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item Inherit Group Item Tax Template 1", + "item_group": "_Test Item Group Tax Parent", + "item_name": "_Test Item Inherit Group Item Tax Template 1", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Item Inherit Group Item Tax Template 2", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item Inherit Group Item Tax Template 2", + "item_group": "_Test Item Group Tax Child Override", + "item_name": "_Test Item Inherit Group Item Tax Template 2", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + }, + { + "description": "_Test Item Override Group Item Tax Template", + "doctype": "Item", + "has_batch_no": 0, + "has_serial_no": 0, + "inspection_required": 0, + "is_stock_item": 1, + "is_sub_contracted_item": 0, + "item_code": "_Test Item Override Group Item Tax Template", + "item_group": "_Test Item Group Tax Child Override", + "item_name": "_Test Item Override Group Item Tax Template", + "stock_uom": "_Test UOM", + "item_defaults": [ + { + "company": "_Test Company", + "default_warehouse": "_Test Warehouse - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + "income_account": "Sales - _TC", + } + ], + "taxes": [ + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 20 - _TC", + }, + { + "doctype": "Item Tax", + "parentfield": "taxes", + "tax_category": "_Test Tax Category 1", + "item_tax_template": "_Test Item Tax Template 1 - _TC", + }, + ], + }, + { + "description": "_Test", + "doctype": "Item", + "is_stock_item": 1, + "item_code": "138-CMS Shoe", + "item_group": "_Test Item Group", + "item_name": "138-CMS Shoe", + "stock_uom": "_Test UOM", + }, + ] + cls.item = [] + for x in records: + if not frappe.db.exists( + "Item", {"item_code": x.get("item_code"), "item_name": x.get("item_name")} + ): + cls.item.append(frappe.get_doc(x).insert()) + else: + cls.item.append( + frappe.get_doc( + "Item", + {"item_code": x.get("item_code"), "item_name": x.get("item_name")}, + ) + ) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From 654ebd37766964efc2add9dde6d70f1ac0c6c67b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 12:29:42 +0530 Subject: [PATCH 038/217] refactor(test): make item group --- erpnext/tests/utils.py | 122 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index ebfa93504be..f973f11bca3 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -189,6 +189,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_user() cls.make_cost_center() cls.make_warehouse() + cls.make_item_group() cls.make_item() cls.make_location() cls.update_stock_settings() @@ -1240,6 +1241,127 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_item_group(cls): + records = [ + { + "doctype": "Item Group", + "is_group": 0, + "item_group_name": "_Test Item Group", + "parent_item_group": "All Item Groups", + "item_group_defaults": [ + { + "company": "_Test Company", + "buying_cost_center": "_Test Cost Center 2 - _TC", + "selling_cost_center": "_Test Cost Center 2 - _TC", + "default_warehouse": "_Test Warehouse - _TC", + } + ], + }, + { + "doctype": "Item Group", + "is_group": 0, + "item_group_name": "_Test Item Group Desktops", + "parent_item_group": "All Item Groups", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group A", + "parent_item_group": "All Item Groups", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group B", + "parent_item_group": "All Item Groups", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group B - 1", + "parent_item_group": "_Test Item Group B", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group B - 2", + "parent_item_group": "_Test Item Group B", + }, + { + "doctype": "Item Group", + "is_group": 0, + "item_group_name": "_Test Item Group B - 3", + "parent_item_group": "_Test Item Group B", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group C", + "parent_item_group": "All Item Groups", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group C - 1", + "parent_item_group": "_Test Item Group C", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group C - 2", + "parent_item_group": "_Test Item Group C", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group D", + "parent_item_group": "All Item Groups", + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group Tax Parent", + "parent_item_group": "All Item Groups", + "taxes": [ + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "tax_category": "", + }, + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 12 - _TC", + "tax_category": "_Test Tax Category 1", + }, + ], + }, + { + "doctype": "Item Group", + "is_group": 0, + "item_group_name": "_Test Item Group Tax Child Override", + "parent_item_group": "_Test Item Group Tax Parent", + "taxes": [ + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 15 - _TC", + "tax_category": "", + } + ], + }, + ] + cls.item_group = [] + for x in records: + if not frappe.db.exists("Item Group", {"item_group_name": x.get("item_group_name")}): + cls.item_group.append(frappe.get_doc(x).insert()) + else: + cls.item_group.append( + frappe.get_doc("Item Group", {"item_group_name": x.get("item_group_name")}) + ) + @classmethod def make_item(cls): records = [ From ceca3299e74ad4eea78115b2a5f712c78c39c980 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 12:33:35 +0530 Subject: [PATCH 039/217] refactor(test): make uom --- erpnext/tests/utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index f973f11bca3..d0b01b46f8b 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -189,6 +189,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_user() cls.make_cost_center() cls.make_warehouse() + cls.make_uom() cls.make_item_group() cls.make_item() cls.make_location() @@ -1241,6 +1242,24 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_uom(cls): + records = [ + {"doctype": "UOM", "must_be_whole_number": 1, "uom_name": "_Test UOM"}, + {"doctype": "UOM", "uom_name": "_Test UOM 1"}, + ] + cls.uom = [] + for x in records: + if not frappe.db.exists("UOM", {"uom_name": x.get("uom_name")}): + cls.uom.append(frappe.get_doc(x).insert()) + else: + cls.uom.append( + frappe.get_doc( + "UOM", + {"uom_name": x.get("uom_name")}, + ) + ) + @classmethod def make_item_group(cls): records = [ From 8cbe0d2d357cb6052c5a14a2fb02c6686f221827 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 14:00:50 +0530 Subject: [PATCH 040/217] refactor(test): make item tax template --- erpnext/tests/utils.py | 96 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index d0b01b46f8b..278bf4e8bb3 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -190,6 +190,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_cost_center() cls.make_warehouse() cls.make_uom() + cls.make_item_tax_template() cls.make_item_group() cls.make_item() cls.make_location() @@ -1260,6 +1261,101 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_item_tax_template(cls): + records = [ + { + "doctype": "Item Tax Template", + "title": "_Test Account Excise Duty @ 10", + "company": "_Test Company", + "taxes": [ + { + "doctype": "Item Tax Template Detail", + "parentfield": "taxes", + "tax_rate": 10, + "tax_type": "_Test Account Excise Duty - _TC", + } + ], + }, + { + "doctype": "Item Tax Template", + "title": "_Test Account Excise Duty @ 12", + "company": "_Test Company", + "taxes": [ + { + "doctype": "Item Tax Template Detail", + "parentfield": "taxes", + "tax_rate": 12, + "tax_type": "_Test Account Excise Duty - _TC", + } + ], + }, + { + "doctype": "Item Tax Template", + "title": "_Test Account Excise Duty @ 15", + "company": "_Test Company", + "taxes": [ + { + "doctype": "Item Tax Template Detail", + "parentfield": "taxes", + "tax_rate": 15, + "tax_type": "_Test Account Excise Duty - _TC", + } + ], + }, + { + "doctype": "Item Tax Template", + "title": "_Test Account Excise Duty @ 20", + "company": "_Test Company", + "taxes": [ + { + "doctype": "Item Tax Template Detail", + "parentfield": "taxes", + "tax_rate": 20, + "tax_type": "_Test Account Excise Duty - _TC", + } + ], + }, + { + "doctype": "Item Tax Template", + "title": "_Test Item Tax Template 1", + "company": "_Test Company", + "taxes": [ + { + "doctype": "Item Tax Template Detail", + "parentfield": "taxes", + "tax_rate": 5, + "tax_type": "_Test Account Excise Duty - _TC", + }, + { + "doctype": "Item Tax Template Detail", + "parentfield": "taxes", + "tax_rate": 10, + "tax_type": "_Test Account Education Cess - _TC", + }, + { + "doctype": "Item Tax Template Detail", + "parentfield": "taxes", + "tax_rate": 15, + "tax_type": "_Test Account S&H Education Cess - _TC", + }, + ], + }, + ] + cls.item_tax_template = [] + for x in records: + if not frappe.db.exists( + "Item Tax Template", {"title": x.get("title"), "company": x.get("company")} + ): + cls.item_tax_template.append(frappe.get_doc(x).insert()) + else: + cls.item_tax_template.append( + frappe.get_doc( + "Item Tax Template", + {"title": x.get("title"), "company": x.get("company")}, + ) + ) + @classmethod def make_item_group(cls): records = [ From f5260223026f889e9e5bae4818bbae9d0acce346 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 14:19:55 +0530 Subject: [PATCH 041/217] refactor(test): make test accounts --- erpnext/tests/utils.py | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 278bf4e8bb3..59227991da2 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -176,6 +176,7 @@ class ERPNextTestSuite(unittest.TestCase): def make_persistent_master_data(cls): cls.make_fiscal_year() cls.make_company() + cls.make_test_account() cls.make_supplier_group() cls.make_payment_term() cls.make_payment_terms_template() @@ -1967,6 +1968,73 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_test_account(cls): + records = [ + # [account_name, parent_account, is_group] + ["_Test Bank", "Bank Accounts", 0, "Bank", None], + ["_Test Bank USD", "Bank Accounts", 0, "Bank", "USD"], + ["_Test Bank EUR", "Bank Accounts", 0, "Bank", "EUR"], + ["_Test Cash", "Cash In Hand", 0, "Cash", None], + ["_Test Account Stock Expenses", "Direct Expenses", 1, None, None], + ["_Test Account Shipping Charges", "_Test Account Stock Expenses", 0, "Chargeable", None], + ["_Test Account Customs Duty", "_Test Account Stock Expenses", 0, "Tax", None], + ["_Test Account Insurance Charges", "_Test Account Stock Expenses", 0, "Chargeable", None], + ["_Test Account Stock Adjustment", "_Test Account Stock Expenses", 0, "Stock Adjustment", None], + ["_Test Employee Advance", "Current Liabilities", 0, None, None], + ["_Test Account Tax Assets", "Current Assets", 1, None, None], + ["_Test Account VAT", "_Test Account Tax Assets", 0, "Tax", None], + ["_Test Account Service Tax", "_Test Account Tax Assets", 0, "Tax", None], + ["_Test Account Reserves and Surplus", "Current Liabilities", 0, None, None], + ["_Test Account Cost for Goods Sold", "Expenses", 0, None, None], + ["_Test Account Excise Duty", "_Test Account Tax Assets", 0, "Tax", None], + ["_Test Account Education Cess", "_Test Account Tax Assets", 0, "Tax", None], + ["_Test Account S&H Education Cess", "_Test Account Tax Assets", 0, "Tax", None], + ["_Test Account CST", "Direct Expenses", 0, "Tax", None], + ["_Test Account Discount", "Direct Expenses", 0, None, None], + ["_Test Write Off", "Indirect Expenses", 0, None, None], + ["_Test Exchange Gain/Loss", "Indirect Expenses", 0, None, None], + ["_Test Account Sales", "Direct Income", 0, None, None], + # related to Account Inventory Integration + ["_Test Account Stock In Hand", "Current Assets", 0, None, None], + # fixed asset depreciation + ["_Test Fixed Asset", "Current Assets", 0, "Fixed Asset", None], + ["_Test Accumulated Depreciations", "Current Assets", 0, "Accumulated Depreciation", None], + ["_Test Depreciations", "Expenses", 0, "Depreciation", None], + ["_Test Gain/Loss on Asset Disposal", "Expenses", 0, None, None], + # Receivable / Payable Account + ["_Test Receivable", "Current Assets", 0, "Receivable", None], + ["_Test Payable", "Current Liabilities", 0, "Payable", None], + ["_Test Receivable USD", "Current Assets", 0, "Receivable", "USD"], + ["_Test Payable USD", "Current Liabilities", 0, "Payable", "USD"], + ] + + cls.test_accounts = [] + for company, abbr in [ + ["_Test Company", "_TC"], + ["_Test Company 1", "_TC1"], + ["_Test Company with perpetual inventory", "TCP1"], + ]: + for account_name, parent_account, is_group, account_type, currency in records: + if not frappe.db.exists("Account", {"account_name": account_name, "company": company}): + cls.test_accounts.append( + frappe.get_doc( + { + "doctype": "Account", + "account_name": account_name, + "parent_account": parent_account + " - " + abbr, + "company": company, + "is_group": is_group, + "account_type": account_type, + "account_currency": currency, + } + ).insert() + ) + else: + cls.test_accounts.append( + frappe.get_doc("Account", {"account_name": account_name, "company": company}) + ) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From 1dbaa8d91f94674b075e6916c76e438083671616 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 14:25:55 +0530 Subject: [PATCH 042/217] refactor(test): make item attribute --- erpnext/tests/utils.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 59227991da2..9737e2534db 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -193,6 +193,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_uom() cls.make_item_tax_template() cls.make_item_group() + cls.make_item_attribute() cls.make_item() cls.make_location() cls.update_stock_settings() @@ -1262,6 +1263,45 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_item_attribute(cls): + records = [ + { + "doctype": "Item Attribute", + "attribute_name": "Test Size", + "priority": 1, + "item_attribute_values": [ + {"attribute_value": "Extra Small", "abbr": "XSL"}, + {"attribute_value": "Small", "abbr": "S"}, + {"attribute_value": "Medium", "abbr": "M"}, + {"attribute_value": "Large", "abbr": "L"}, + {"attribute_value": "Extra Large", "abbr": "XL"}, + {"attribute_value": "2XL", "abbr": "2XL"}, + ], + }, + { + "doctype": "Item Attribute", + "attribute_name": "Test Colour", + "priority": 2, + "item_attribute_values": [ + {"attribute_value": "Red", "abbr": "R"}, + {"attribute_value": "Green", "abbr": "G"}, + {"attribute_value": "Blue", "abbr": "B"}, + ], + }, + ] + cls.item_attribute = [] + for x in records: + if not frappe.db.exists("Item Attribute", {"attribute_name": x.get("attribute_name")}): + cls.item_attribute.append(frappe.get_doc(x).insert()) + else: + cls.item_attribute.append( + frappe.get_doc( + "Item Attribute", + {"attribute_name": x.get("attribute_name")}, + ) + ) + @classmethod def make_item_tax_template(cls): records = [ From 6fbca354ea945f45edbe5690c87b077a20ac0d23 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 14:39:51 +0530 Subject: [PATCH 043/217] refactor(test): make price list and update selling settings --- erpnext/tests/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 9737e2534db..03578f69d67 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -196,10 +196,18 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_item_attribute() cls.make_item() cls.make_location() + cls.make_price_list() + cls.update_selling_settings() cls.update_stock_settings() frappe.db.commit() + @classmethod + def update_selling_settings(cls): + selling_settings = frappe.get_doc("Selling Settings") + selling_settings.selling_price_list = "Standard Selling" + selling_settings.save() + @classmethod def update_stock_settings(cls): stock_settings = frappe.get_doc("Stock Settings") From f31d2e74bc4b6e9f33ab5106fb727f0d95ef487d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 15:15:11 +0530 Subject: [PATCH 044/217] refactor(test): make customer --- erpnext/tests/utils.py | 71 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 03578f69d67..f25eaf7c461 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -187,6 +187,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_department() cls.make_territory() cls.make_customer_group() + cls.make_customer() cls.make_user() cls.make_cost_center() cls.make_warehouse() @@ -2083,6 +2084,76 @@ class ERPNextTestSuite(unittest.TestCase): frappe.get_doc("Account", {"account_name": account_name, "company": company}) ) + @classmethod + def make_customer(cls): + records = [ + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer With Template", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer P", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer 1", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer 2", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer 3", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer USD", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + "default_currency": "USD", + "accounts": [{"company": "_Test Company", "account": "_Test Receivable USD - _TC"}], + }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer With Tax Category", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + "tax_category": "_Test Tax Category 1", + }, + ] + cls.customer = [] + for x in records: + if not frappe.db.exists("Customer", {"customer_name": x.get("customer_name")}): + cls.customer.append(frappe.get_doc(x).insert()) + else: + cls.customer.append(frappe.get_doc("Customer", {"customer_name": x.get("customer_name")})) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From 015cf6fcb9a4f5cda9ea6ccbdecb5ae0cdec84e0 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 15:56:07 +0530 Subject: [PATCH 045/217] refactor(test): call super() method first --- .../accounts/doctype/bank_transaction/test_auto_match_party.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py b/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py index 81407aaf06b..da8239ac6ac 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py +++ b/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py @@ -14,15 +14,16 @@ IBAN_2 = "DE02500105170137075030" class TestAutoMatchParty(ERPNextTestSuite): @classmethod def setUpClass(cls): + super().setUpClass() create_bank_account() frappe.db.set_single_value("Accounts Settings", "enable_party_matching", 1) frappe.db.set_single_value("Accounts Settings", "enable_fuzzy_matching", 1) - return super().setUpClass() @classmethod def tearDownClass(cls): frappe.db.set_single_value("Accounts Settings", "enable_party_matching", 0) frappe.db.set_single_value("Accounts Settings", "enable_fuzzy_matching", 0) + super().tearDownClass() def test_match_by_account_number(self): create_supplier_for_match(account_no=IBAN_1[11:]) From 04e2ffb9667c663d5dfbd8bdadd3b666296746b8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 16:01:10 +0530 Subject: [PATCH 046/217] refactor(test): flaky test data in bank reconciliation tool --- .../bank_reconciliation_tool/test_bank_reconciliation_tool.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py index 9c5bcef0933..96ef76c934b 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py @@ -43,6 +43,7 @@ class TestBankReconciliationTool(AccountsTestMixin, ERPNextTestSuite): "bank": bank.name, "is_company_account": True, "account": self.bank, # account from Chart of Accounts + "company": self.company, } ) .insert() From f0834cb2e85ee16520a0090761a591f925046d85 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 16:19:32 +0530 Subject: [PATCH 047/217] refactor(test): make price list - more test records --- erpnext/tests/utils.py | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index f25eaf7c461..78546581b5b 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -242,6 +242,55 @@ class ERPNextTestSuite(unittest.TestCase): "selling": 1, "currency": "INR", }, + { + "buying": 1, + "currency": "INR", + "doctype": "Price List", + "enabled": 1, + "price_not_uom_dependant": 1, + "price_list_name": "_Test Price List", + "selling": 1, + }, + { + "buying": 1, + "currency": "INR", + "doctype": "Price List", + "enabled": 1, + "price_list_name": "_Test Price List 2", + "selling": 1, + }, + { + "buying": 1, + "currency": "INR", + "doctype": "Price List", + "enabled": 1, + "price_list_name": "_Test Price List India", + "selling": 1, + }, + { + "buying": 1, + "currency": "USD", + "doctype": "Price List", + "enabled": 1, + "price_list_name": "_Test Price List Rest of the World", + "selling": 1, + }, + { + "buying": 0, + "currency": "USD", + "doctype": "Price List", + "enabled": 1, + "price_list_name": "_Test Selling Price List", + "selling": 1, + }, + { + "buying": 1, + "currency": "USD", + "doctype": "Price List", + "enabled": 1, + "price_list_name": "_Test Buying Price List", + "selling": 0, + }, ] cls.price_list = [] for x in records: From 8c1057088d14163769751e49e2ca445e4cf2cd04 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 16:24:53 +0530 Subject: [PATCH 048/217] refactor(test): flaky test data setup for coupon code --- erpnext/accounts/doctype/coupon_code/test_coupon_code.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py index 936eac018e3..e7bcf115f1f 100644 --- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py +++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py @@ -86,6 +86,7 @@ def test_create_test_data(): "partner_name": "_Test Coupon Partner", "commission_rate": 2, "referral_code": "COPART", + "territory": "All Territories", } ) sales_partner.insert() From e939927bc3b16653172f4bb4323b2bc617dfa07b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 16:52:37 +0530 Subject: [PATCH 049/217] refactor(test): flaky test setup in Exchange Rate Revaluation --- .../exchange_rate_revaluation/test_exchange_rate_revaluation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py index 24aa5a628fd..e8f57730892 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py @@ -30,6 +30,8 @@ class TestExchangeRateRevaluation(AccountsTestMixin, ERPNextTestSuite): system_settings = frappe.get_doc("System Settings") system_settings.float_precision = 2 system_settings.currency_precision = 2 + system_settings.language = "en" + system_settings.time_zone = "Asia/Kolkata" system_settings.save() # Using Exchange Gain/Loss account for unrealized as well. From 442dc6d3d0ace7fe88bda4d8030bc4543db88f42 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 20:34:33 +0530 Subject: [PATCH 050/217] refactor(test): fix flaky test setup for opening invoice creation --- .../test_opening_invoice_creation_tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py index 70f91cdab55..bfe0bd13e90 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py @@ -16,10 +16,10 @@ from erpnext.tests.utils import ERPNextTestSuite class TestOpeningInvoiceCreationTool(ERPNextTestSuite): @classmethod def setUpClass(cls): + super().setUpClass() if not frappe.db.exists("Company", "_Test Opening Invoice Company"): make_company() create_dimension() - return super().setUpClass() def make_invoices( self, From 0b7b4d92445882b6180e66fb7c5b9580d0c23a8b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 20:38:28 +0530 Subject: [PATCH 051/217] refactor(test): flaky test setup in pos closing entry --- .../accounts/doctype/pos_closing_entry/test_pos_closing_entry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py index 6041d4fcac1..1485a9532f8 100644 --- a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py +++ b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py @@ -27,6 +27,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPOSClosingEntry(ERPNextTestSuite): @classmethod def setUpClass(cls): + super().setUpClass() frappe.db.sql("delete from `tabPOS Opening Entry`") cls.enterClassContext(cls.change_settings("POS Settings", {"invoice_type": "POS Invoice"})) From 6f8ac1ba2830249dd2422b8d1e9f0bec3a5e350d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Jun 2025 20:42:04 +0530 Subject: [PATCH 052/217] refactor(test): update system settings in super() --- erpnext/tests/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 78546581b5b..0287f8f9c3d 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -200,9 +200,17 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_price_list() cls.update_selling_settings() cls.update_stock_settings() + cls.update_system_settings() frappe.db.commit() + @classmethod + def update_system_settings(cls): + system_settings = frappe.get_doc("System Settings") + system_settings.time_zone = "Asia/Kolkata" + system_settings.language = "en" + system_settings.save() + @classmethod def update_selling_settings(cls): selling_settings = frappe.get_doc("Selling Settings") From 9a0c59df7328147be0f6d38e1e91474a588c18e9 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 07:30:19 +0530 Subject: [PATCH 053/217] refactor: utility to load JSON records --- erpnext/tests/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 0287f8f9c3d..2376eca8323 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -8,6 +8,7 @@ from typing import Any, NewType import frappe from frappe import _ from frappe.core.doctype.report.report import get_report_module_dotted_path +from frappe.tests.utils import load_test_records_for from frappe.utils import now_datetime ReportFilters = dict[str, Any] @@ -134,6 +135,16 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_presets() cls.make_persistent_master_data() + # initilize global test records attribute + if not hasattr(cls, "globalTestRecords"): + cls.globalTestRecords = {} + + @classmethod + def load_test_records(cls, doctype): + if doctype not in cls.globalTestRecords: + records = load_test_records_for(doctype) + cls.globalTestRecords[doctype] = records[doctype] + @classmethod def make_presets(cls): from frappe.desk.page.setup_wizard.install_fixtures import update_genders, update_salutations From f79a3e0217e528b05698ab9ecf86cfd59705a594 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 07:30:33 +0530 Subject: [PATCH 054/217] refactor: load journal entry test records and make holiday list --- .../journal_entry/test_journal_entry.py | 3 + .../doctype/journal_entry/test_records.json | 94 +++++++++++++++++++ erpnext/tests/utils.py | 19 ++-- 3 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 erpnext/accounts/doctype/journal_entry/test_records.json diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index 36e6a9182ad..69ff1049e47 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -12,6 +12,9 @@ from erpnext.tests.utils import ERPNextTestSuite class TestJournalEntry(ERPNextTestSuite): + def setUp(self): + self.load_test_records("Journal Entry") + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_journal_entry_with_against_jv(self): jv_invoice = frappe.copy_doc(self.globalTestRecords["Journal Entry"][2]) diff --git a/erpnext/accounts/doctype/journal_entry/test_records.json b/erpnext/accounts/doctype/journal_entry/test_records.json new file mode 100644 index 00000000000..717c579c7a3 --- /dev/null +++ b/erpnext/accounts/doctype/journal_entry/test_records.json @@ -0,0 +1,94 @@ +[ + { + "cheque_date": "2013-03-14", + "cheque_no": "33", + "company": "_Test Company", + "doctype": "Journal Entry", + "accounts": [ + { + "account": "Debtors - _TC", + "party_type": "Customer", + "party": "_Test Customer", + "credit_in_account_currency": 400.0, + "debit_in_account_currency": 0.0, + "doctype": "Journal Entry Account", + "parentfield": "accounts", + "cost_center": "_Test Cost Center - _TC" + }, + { + "account": "_Test Bank - _TC", + "credit_in_account_currency": 0.0, + "debit_in_account_currency": 400.0, + "doctype": "Journal Entry Account", + "parentfield": "accounts", + "cost_center": "_Test Cost Center - _TC" + } + ], + "naming_series": "_T-Journal Entry-", + "posting_date": "2013-02-14", + "user_remark": "test", + "voucher_type": "Bank Entry" + }, + + { + "cheque_date": "2013-02-14", + "cheque_no": "33", + "company": "_Test Company", + "doctype": "Journal Entry", + "accounts": [ + { + "account": "_Test Payable - _TC", + "party_type": "Supplier", + "party": "_Test Supplier", + "credit_in_account_currency": 0.0, + "debit_in_account_currency": 400.0, + "doctype": "Journal Entry Account", + "parentfield": "accounts", + "cost_center": "_Test Cost Center - _TC" + }, + { + "account": "_Test Bank - _TC", + "credit_in_account_currency": 400.0, + "debit_in_account_currency": 0.0, + "doctype": "Journal Entry Account", + "parentfield": "accounts", + "cost_center": "_Test Cost Center - _TC" + } + ], + "naming_series": "_T-Journal Entry-", + "posting_date": "2013-02-14", + "user_remark": "test", + "voucher_type": "Bank Entry" + }, + + { + "cheque_date": "2013-02-14", + "cheque_no": "33", + "company": "_Test Company", + "doctype": "Journal Entry", + "accounts": [ + { + "account": "Debtors - _TC", + "party_type": "Customer", + "party": "_Test Customer", + "credit_in_account_currency": 0.0, + "debit_in_account_currency": 400.0, + "doctype": "Journal Entry Account", + "parentfield": "accounts", + "cost_center": "_Test Cost Center - _TC" + }, + { + "account": "Sales - _TC", + "credit_in_account_currency": 400.0, + "debit_in_account_currency": 0.0, + "doctype": "Journal Entry Account", + "parentfield": "accounts", + "cost_center": "_Test Cost Center - _TC" + } + ], + "naming_series": "_T-Journal Entry-", + "posting_date": "2013-02-14", + "user_remark": "test", + "voucher_type": "Bank Entry" + } +] diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 2376eca8323..ee54d027251 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -186,6 +186,7 @@ class ERPNextTestSuite(unittest.TestCase): @classmethod def make_persistent_master_data(cls): cls.make_fiscal_year() + cls.make_holiday_list() cls.make_company() cls.make_test_account() cls.make_supplier_group() @@ -744,7 +745,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, "allow_account_creation_against_child_company": 1, }, @@ -756,7 +757,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Retail", "chart_of_accounts": "Standard", - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, }, { @@ -767,7 +768,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Retail", "chart_of_accounts": "Standard", - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, }, { @@ -779,7 +780,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, }, { @@ -792,7 +793,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, }, { @@ -804,7 +805,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, }, { @@ -816,7 +817,7 @@ class ERPNextTestSuite(unittest.TestCase): "domain": "Manufacturing", "chart_of_accounts": "Standard", "enable_perpetual_inventory": 1, - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, }, { "abbr": "_TC6", @@ -827,7 +828,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, }, { @@ -840,7 +841,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - # "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": cls.holiday_list[0].name, "enable_perpetual_inventory": 0, }, { From 62d1336c43b02c536ace6e06211a2c68156ff203 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 07:43:04 +0530 Subject: [PATCH 055/217] refactor(test): flaky PE test; load currency exchange record --- .../payment_entry/test_payment_entry.py | 2 + .../currency_exchange/test_records.json | 56 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 erpnext/setup/doctype/currency_exchange/test_records.json diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index 8aaf36192b7..dc7d1d21595 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -643,6 +643,7 @@ class TestPaymentEntry(ERPNextTestSuite): def test_payment_entry_retrieves_last_exchange_rate(self): from erpnext.setup.doctype.currency_exchange.test_currency_exchange import save_new_records + self.load_test_records("Currency Exchange") save_new_records(self.globalTestRecords["Currency Exchange"]) pe = frappe.new_doc("Payment Entry") @@ -980,6 +981,7 @@ class TestPaymentEntry(ERPNextTestSuite): def test_gl_of_multi_currency_payment_transaction(self): from erpnext.setup.doctype.currency_exchange.test_currency_exchange import save_new_records + self.load_test_records("Currency Exchange") save_new_records(self.globalTestRecords["Currency Exchange"]) paid_from = create_account( parent_account="Current Liabilities - _TC", diff --git a/erpnext/setup/doctype/currency_exchange/test_records.json b/erpnext/setup/doctype/currency_exchange/test_records.json new file mode 100644 index 00000000000..152060edfc4 --- /dev/null +++ b/erpnext/setup/doctype/currency_exchange/test_records.json @@ -0,0 +1,56 @@ +[ + { + "doctype": "Currency Exchange", + "date": "2016-01-01", + "exchange_rate": 60.0, + "from_currency": "USD", + "to_currency": "INR", + "for_buying": 1, + "for_selling": 0 + }, + { + "doctype": "Currency Exchange", + "date": "2016-01-01", + "exchange_rate": 0.773, + "from_currency": "USD", + "to_currency": "EUR", + "for_buying": 0, + "for_selling": 1 + }, + { + "doctype": "Currency Exchange", + "date": "2016-01-01", + "exchange_rate": 0.0167, + "from_currency": "INR", + "to_currency": "USD", + "for_buying": 1, + "for_selling": 0 + }, + { + "doctype": "Currency Exchange", + "date": "2016-01-10", + "exchange_rate": 65.1, + "from_currency": "USD", + "to_currency": "INR", + "for_buying": 1, + "for_selling": 0 + }, + { + "doctype": "Currency Exchange", + "date": "2016-01-30", + "exchange_rate": 62.9, + "from_currency": "USD", + "to_currency": "INR", + "for_buying": 1, + "for_selling": 1 + }, + { + "doctype": "Currency Exchange", + "date": "2016-01-10", + "exchange_rate": 65.1, + "from_currency": "INR", + "to_currency": "NGN", + "for_buying": 1, + "for_selling": 1 + } +] From 7ab253a90557839e7f45660feb7548470478d217 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 07:48:32 +0530 Subject: [PATCH 056/217] refactor(test): flaky pos invoice test; load stock entry json --- .../doctype/pos_invoice/test_pos_invoice.py | 1 + .../doctype/stock_entry/test_records.json | 105 ++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 erpnext/stock/doctype/stock_entry/test_records.json diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index d321ac3ae42..46bee8705c5 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -28,6 +28,7 @@ class TestPOSInvoice(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() + cls.load_test_records("Stock Entry") cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) cls.enterClassContext(cls.change_settings("POS Settings", invoice_type="POS Invoice")) make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item", qty=800, basic_rate=100) diff --git a/erpnext/stock/doctype/stock_entry/test_records.json b/erpnext/stock/doctype/stock_entry/test_records.json new file mode 100644 index 00000000000..dc212874139 --- /dev/null +++ b/erpnext/stock/doctype/stock_entry/test_records.json @@ -0,0 +1,105 @@ +[ + { + "company": "_Test Company", + "doctype": "Stock Entry", + "stock_entry_type": "Material Receipt", + "purpose": "Material Receipt", + "items": [ + { + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Stock Entry Detail", + "expense_account": "Stock Adjustment - _TC", + "basic_rate": 100, + "item_code": "_Test Item", + "parentfield": "items", + "qty": 50.0, + "stock_uom": "_Test UOM", + "t_warehouse": "_Test Warehouse - _TC", + "transfer_qty": 50.0, + "uom": "_Test UOM" + } + ] + }, + { + "company": "_Test Company", + "doctype": "Stock Entry", + "purpose": "Material Issue", + "stock_entry_type": "Material Issue", + "items": [ + { + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Stock Entry Detail", + "expense_account": "Stock Adjustment - _TC", + "basic_rate": 100, + "item_code": "_Test Item", + "parentfield": "items", + "qty": 40.0, + "s_warehouse": "_Test Warehouse - _TC", + "stock_uom": "_Test UOM", + "transfer_qty": 40.0, + "uom": "_Test UOM" + } + ] + }, + { + "company": "_Test Company", + "doctype": "Stock Entry", + "purpose": "Material Transfer", + "stock_entry_type": "Material Transfer", + "items": [ + { + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Stock Entry Detail", + "expense_account": "Stock Adjustment - _TC", + "basic_rate": 100, + "item_code": "_Test Item", + "parentfield": "items", + "qty": 45.0, + "s_warehouse": "_Test Warehouse - _TC", + "stock_uom": "_Test UOM", + "t_warehouse": "_Test Warehouse 1 - _TC", + "transfer_qty": 45.0, + "uom": "_Test UOM" + } + ] + }, + { + "company": "_Test Company", + "doctype": "Stock Entry", + "purpose": "Repack", + "stock_entry_type": "Repack", + "items": [ + { + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Stock Entry Detail", + "expense_account": "Stock Adjustment - _TC", + "basic_rate": 100, + "item_code": "_Test Item", + "parentfield": "items", + "qty": 50.0, + "s_warehouse": "_Test Warehouse - _TC", + "stock_uom": "_Test UOM", + "transfer_qty": 50.0, + "uom": "_Test UOM" + }, + { + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Stock Entry Detail", + "expense_account": "Stock Adjustment - _TC", + "basic_rate": 5000, + "item_code": "_Test Item Home Desktop 100", + "parentfield": "items", + "qty": 1, + "stock_uom": "_Test UOM", + "t_warehouse": "_Test Warehouse - _TC", + "transfer_qty": 1, + "uom": "_Test UOM" + } + ] + } +] From 978ac5ff31947ddb72a27286a8604cf76a737057 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 09:02:40 +0530 Subject: [PATCH 057/217] refactor(test): flaky post invoice test --- erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py | 5 +++-- erpnext/tests/utils.py | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 46bee8705c5..9b08b409fd8 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -1003,9 +1003,10 @@ class TestPOSInvoice(ERPNextTestSuite): se.cancel() def test_ignore_pricing_rule(self): + frappe.set_user("Administrator") from erpnext.accounts.doctype.pricing_rule.test_pricing_rule import make_pricing_rule - item_price = frappe.get_doc( + item_price = self.truncate_make_item_price( { "doctype": "Item Price", "item_code": "_Test Item", @@ -1013,7 +1014,7 @@ class TestPOSInvoice(ERPNextTestSuite): "price_list_rate": "450", } ) - item_price.insert() + pr = make_pricing_rule(selling=1, priority=5, discount_percentage=10) pr.save() diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index ee54d027251..fb204c87dca 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -145,6 +145,13 @@ class ERPNextTestSuite(unittest.TestCase): records = load_test_records_for(doctype) cls.globalTestRecords[doctype] = records[doctype] + @classmethod + def truncate_make_item_price(cls, record): + frappe.db.truncate("Item Price") + item_price = frappe.get_doc(record) + item_price.insert() + return item_price + @classmethod def make_presets(cls): from frappe.desk.page.setup_wizard.install_fixtures import update_genders, update_salutations From 84250d0245a224ef6a1b92827af0cc7803a008b7 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 09:11:51 +0530 Subject: [PATCH 058/217] refactor(test): flaky pos invoice merge log test --- .../doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py index c3381eec4e5..e14888447e2 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py @@ -415,6 +415,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): The second and third POS Invoice should be consolidated with a single Merge Log """ + self.load_test_records("Stock Entry") from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item se = make_serialized_item(self) From 02475d4efad777d1731d14bb940340eb7a800c63 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 09:12:09 +0530 Subject: [PATCH 059/217] refactor(test): flaky stock entry; load records json --- erpnext/stock/doctype/stock_entry/test_stock_entry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 967d473a030..e43af88d0f7 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -57,6 +57,9 @@ def get_sle(**args): class TestStockEntry(ERPNextTestSuite): + def setUp(self): + self.load_test_records("Stock Entry") + def tearDown(self): frappe.db.rollback() frappe.set_user("Administrator") From 1cee2a09175212871a41c6dd3843361ea8ae059e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 16:21:56 +0530 Subject: [PATCH 060/217] refactor(test): flaky pricing rule tests --- erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index 6312a2e4fb6..7b0c507ac0c 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -416,6 +416,7 @@ class TestPricingRule(ERPNextTestSuite): self.assertEqual(item.discount_amount, 110) self.assertEqual(item.rate, 990) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_pricing_rule_for_product_discount_on_same_item(self): frappe.delete_doc_if_exists("Pricing Rule", "_Test Pricing Rule") test_record = { @@ -1191,6 +1192,7 @@ class TestPricingRule(ERPNextTestSuite): si.delete() rule.delete() + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_pricing_rule_for_product_free_item_rounded_qty_and_recursion(self): frappe.delete_doc_if_exists("Pricing Rule", "_Test Pricing Rule") test_record = { @@ -1236,6 +1238,7 @@ class TestPricingRule(ERPNextTestSuite): so.save() self.assertEqual(len(so.items), 1) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_pricing_rule_for_product_free_item_round_free_qty(self): frappe.delete_doc_if_exists("Pricing Rule", "_Test Pricing Rule") test_record = { From 19fd69bda71327215d111eceaa2dbb25bddb40cb Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 16:26:36 +0530 Subject: [PATCH 061/217] refactor(test): fix flaky process deferred accounting tests --- .../test_process_deferred_accounting.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py index eb69562e0d4..91bf14867b1 100644 --- a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py +++ b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py @@ -53,6 +53,7 @@ class TestProcessDeferredAccounting(ERPNextTestSuite): start_date="2023-05-01", end_date="2023-06-30", type="Income", + company=self.companies[0].name, ) process_deferred_accounting.insert() @@ -83,6 +84,7 @@ class TestProcessDeferredAccounting(ERPNextTestSuite): start_date="2019-01-01", end_date="2019-01-31", type="Income", + company=self.companies[0].name, ) pda.submit() pda.cancel() From 5928e289d17e0363e27868c1d2e70698c744aad8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 16:35:41 +0530 Subject: [PATCH 062/217] refactor(test): fix flaky shareholder test --- erpnext/tests/utils.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index fb204c87dca..60a55e1be99 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -217,6 +217,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_item() cls.make_location() cls.make_price_list() + cls.make_shareholder() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() @@ -2230,6 +2231,27 @@ class ERPNextTestSuite(unittest.TestCase): else: cls.customer.append(frappe.get_doc("Customer", {"customer_name": x.get("customer_name")})) + @classmethod + def make_shareholder(cls): + records = [ + { + "doctype": "Shareholder", + "naming_series": "SH-", + "title": "Iron Man", + "company": "_Test Company", + }, + {"doctype": "Shareholder", "naming_series": "SH-", "title": "Thor", "company": "_Test Company"}, + {"doctype": "Shareholder", "naming_series": "SH-", "title": "Hulk", "company": "_Test Company"}, + ] + cls.shareholder = [] + for x in records: + if not frappe.db.exists("Shareholder", {"title": x.get("title"), "company": x.get("company")}): + cls.shareholder.append(frappe.get_doc(x).insert()) + else: + cls.shareholder.append( + frappe.get_doc("Shareholder", {"title": x.get("title"), "company": x.get("company")}) + ) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From 602b30ecaf774d2b6a2ea72be2bb036f3dae0d54 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 16:38:18 +0530 Subject: [PATCH 063/217] refactor(test): load shipping rule records --- .../doctype/shipping_rule/test_records.json | 108 ++++++++++++++++++ .../shipping_rule/test_shipping_rule.py | 3 + 2 files changed, 111 insertions(+) create mode 100644 erpnext/accounts/doctype/shipping_rule/test_records.json diff --git a/erpnext/accounts/doctype/shipping_rule/test_records.json b/erpnext/accounts/doctype/shipping_rule/test_records.json new file mode 100644 index 00000000000..26b37374433 --- /dev/null +++ b/erpnext/accounts/doctype/shipping_rule/test_records.json @@ -0,0 +1,108 @@ +[ + { + "account": "_Test Account Shipping Charges - _TC", + "calculate_based_on": "Net Total", + "company": "_Test Company", + "cost_center": "_Test Cost Center - _TC", + "doctype": "Shipping Rule", + "label": "_Test Shipping Rule", + "name": "_Test Shipping Rule", + "shipping_rule_type": "Selling", + "conditions": [ + { + "doctype": "Shipping Rule Condition", + "from_value": 0, + "parentfield": "conditions", + "shipping_amount": 50.0, + "to_value": 100 + }, + { + "doctype": "Shipping Rule Condition", + "from_value": 101, + "parentfield": "conditions", + "shipping_amount": 100.0, + "to_value": 200 + }, + { + "doctype": "Shipping Rule Condition", + "from_value": 201, + "parentfield": "conditions", + "shipping_amount": 200.0 + } + ], + "countries": [ + {"country": "India"} + ], + "worldwide_shipping": 1 + }, + { + "account": "_Test Account Shipping Charges - _TC", + "calculate_based_on": "Net Total", + "company": "_Test Company", + "cost_center": "_Test Cost Center - _TC", + "doctype": "Shipping Rule", + "label": "_Test Shipping Rule - India", + "name": "_Test Shipping Rule - India", + "conditions": [ + { + "doctype": "Shipping Rule Condition", + "from_value": 0, + "parentfield": "conditions", + "shipping_amount": 50.0, + "to_value": 100 + }, + { + "doctype": "Shipping Rule Condition", + "from_value": 101, + "parentfield": "conditions", + "shipping_amount": 100.0, + "to_value": 200 + }, + { + "doctype": "Shipping Rule Condition", + "from_value": 201, + "parentfield": "conditions", + "shipping_amount": 0.0 + } + ], + "countries": [ + {"country": "India"} + ] + }, + { + "account": "_Test Account Shipping Charges - _TC", + "calculate_based_on": "Net Total", + "company": "_Test Company", + "cost_center": "_Test Cost Center - _TC", + "doctype": "Shipping Rule", + "label": "_Test Shipping Rule - Rest of the World", + "name": "_Test Shipping Rule - Rest of the World", + "shipping_rule_type": "Buying", + "conditions": [ + { + "doctype": "Shipping Rule Condition", + "from_value": 0, + "parentfield": "conditions", + "shipping_amount": 500.0, + "to_value": 1000 + }, + { + "doctype": "Shipping Rule Condition", + "from_value": 1001, + "parentfield": "conditions", + "shipping_amount": 1000.0, + "to_value": 2000 + }, + { + "doctype": "Shipping Rule Condition", + "from_value": 2001, + "parentfield": "conditions", + "shipping_amount": 1500.0 + } + ], + "worldwide_shipping": 1, + "countries": [ + {"country": "Germany"} + ] + } +] diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py index 7a36be65817..62d9c7805b1 100644 --- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py @@ -13,6 +13,9 @@ from erpnext.tests.utils import ERPNextTestSuite class TestShippingRule(ERPNextTestSuite): + def setUp(self): + self.load_test_records("Shipping Rule") + def test_from_greater_than_to(self): shipping_rule = frappe.copy_doc(self.globalTestRecords["Shipping Rule"][0]) shipping_rule.name = self.globalTestRecords["Shipping Rule"][0].get("name") From 400d6b5b624862412de94faf62e3617f73488530 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 21 Jun 2025 16:52:23 +0530 Subject: [PATCH 064/217] refactor(test): flaky tax rule testsuite - Make Sales Stage preset --- .../operations/install_fixtures.py | 8 +- erpnext/tests/utils.py | 240 +++++++++++++++++- 2 files changed, 245 insertions(+), 3 deletions(-) diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index c72b205f482..01b034f2826 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -431,9 +431,9 @@ def add_market_segments(): make_records(records) -def add_sale_stages(): +def get_sale_stages(): # Sale Stages - records = [ + return [ {"doctype": "Sales Stage", "stage_name": _("Prospecting")}, {"doctype": "Sales Stage", "stage_name": _("Qualification")}, {"doctype": "Sales Stage", "stage_name": _("Needs Analysis")}, @@ -443,6 +443,10 @@ def add_sale_stages(): {"doctype": "Sales Stage", "stage_name": _("Proposal/Price Quote")}, {"doctype": "Sales Stage", "stage_name": _("Negotiation/Review")}, ] + + +def add_sale_stages(): + records = get_sale_stages() for sales_stage in records: frappe.get_doc(sales_stage).db_insert() diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 60a55e1be99..056a39b5faf 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -156,7 +156,11 @@ class ERPNextTestSuite(unittest.TestCase): def make_presets(cls): from frappe.desk.page.setup_wizard.install_fixtures import update_genders, update_salutations - from erpnext.setup.setup_wizard.operations.install_fixtures import add_uom_data, get_preset_records + from erpnext.setup.setup_wizard.operations.install_fixtures import ( + add_uom_data, + get_preset_records, + get_sale_stages, + ) update_genders() update_salutations() @@ -187,6 +191,10 @@ class ERPNextTestSuite(unittest.TestCase): doc.insert() add_uom_data() + # add sale stages + for sales_stage in get_sale_stages(): + if not frappe.db.exists("Sales Stage", {"stage_name": sales_stage.get("stage_name")}): + frappe.get_doc(sales_stage).insert() frappe.db.commit() @@ -218,6 +226,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_location() cls.make_price_list() cls.make_shareholder() + cls.make_sales_taxes_template() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() @@ -2252,6 +2261,235 @@ class ERPNextTestSuite(unittest.TestCase): frappe.get_doc("Shareholder", {"title": x.get("title"), "company": x.get("company")}) ) + @classmethod + def make_sales_taxes_template(cls): + records = [ + { + "company": "_Test Company", + "doctype": "Sales Taxes and Charges Template", + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "cost_center": "Main - _TC", + "parentfield": "taxes", + "rate": 6, + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "cost_center": "Main - _TC", + "parentfield": "taxes", + "rate": 6.36, + }, + ], + "title": "_Test Sales Taxes and Charges Template", + }, + { + "company": "_Test Company", + "doctype": "Sales Taxes and Charges Template", + "taxes": [ + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 100, + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 10, + }, + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12, + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 3, + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 1, + "row_id": 3, + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 5, + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12.5, + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": -10, + "row_id": 7, + }, + ], + "title": "_Test India Tax Master", + }, + { + "company": "_Test Company", + "doctype": "Sales Taxes and Charges Template", + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "cost_center": "Main - _TC", + "parentfield": "taxes", + "rate": 12, + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "cost_center": "Main - _TC", + "parentfield": "taxes", + "rate": 4, + }, + ], + "title": "_Test Sales Taxes and Charges Template - Rest of the World", + }, + { + "company": "_Test Company", + "doctype": "Sales Taxes and Charges Template", + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "cost_center": "Main - _TC", + "parentfield": "taxes", + "rate": 12, + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "cost_center": "Main - _TC", + "parentfield": "taxes", + "rate": 4, + }, + ], + "title": "_Test Sales Taxes and Charges Template 1", + }, + { + "company": "_Test Company", + "doctype": "Sales Taxes and Charges Template", + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "cost_center": "Main - _TC", + "parentfield": "taxes", + "rate": 12, + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "cost_center": "Main - _TC", + "parentfield": "taxes", + "rate": 4, + }, + ], + "title": "_Test Sales Taxes and Charges Template 2", + }, + { + "doctype": "Sales Taxes and Charges Template", + "title": "_Test Tax 1", + "company": "_Test Company", + "taxes": [ + { + "charge_type": "Actual", + "account_head": "Sales Expenses - _TC", + "cost_center": "Main - _TC", + "description": "Test Shopping cart taxes with Tax Rule", + "tax_amount": 1000, + } + ], + }, + { + "doctype": "Sales Taxes and Charges Template", + "title": "_Test Tax 2", + "company": "_Test Company", + "taxes": [ + { + "charge_type": "Actual", + "account_head": "Sales Expenses - _TC", + "cost_center": "Main - _TC", + "description": "Test Shopping cart taxes with Tax Rule", + "tax_amount": 200, + } + ], + }, + ] + cls.sales_taxes_and_template = [] + for x in records: + if not frappe.db.exists( + "Sales Taxes and Charges Template", {"title": x.get("title"), "company": x.get("company")} + ): + cls.sales_taxes_and_template.append(frappe.get_doc(x).insert()) + else: + cls.sales_taxes_and_template.append( + frappe.get_doc( + "Sales Taxes and Charges Template", + {"title": x.get("title"), "company": x.get("company")}, + ) + ) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From 523007ecde071d5ca4b3c376faa3297cdb5e82b2 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 25 Jun 2025 17:28:48 +0530 Subject: [PATCH 065/217] refactor(test): flaky test in lead --- erpnext/crm/doctype/lead/test_lead.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py index b1b4e162b32..ac9f7a0fa08 100644 --- a/erpnext/crm/doctype/lead/test_lead.py +++ b/erpnext/crm/doctype/lead/test_lead.py @@ -127,6 +127,7 @@ class TestLead(ERPNextTestSuite): create_todo("followup", "Lead", lead.name) opportunity = make_opportunity(lead.name) + opportunity.company = self.companies[0].name opportunity.save() self.assertEqual(opportunity.get("party_name"), lead.name) From 4cdf5f542ea17d3244e4041e9aa1f4bfbb9a808d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 25 Jun 2025 17:40:23 +0530 Subject: [PATCH 066/217] refactor: utility to return default supplier scorecards --- .../supplier_scorecard/supplier_scorecard.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py index a1142715e2c..b42a260d017 100644 --- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py +++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py @@ -266,8 +266,8 @@ def get_scorecard_date(period, start_date): return end_date -def make_default_records(): - install_variable_docs = [ +def get_default_scorecard_variables(): + return [ { "param_name": "total_accepted_items", "variable_label": "Total Accepted Items", @@ -374,7 +374,10 @@ def make_default_records(): "path": "get_invoiced_qty", }, ] - install_standing_docs = [ + + +def get_default_scorecard_standing(): + return [ { "min_grade": 0.0, "prevent_rfqs": 1, @@ -425,12 +428,17 @@ def make_default_records(): }, ] + +def make_default_records(): + install_variable_docs = get_default_scorecard_variables() for d in install_variable_docs: try: d["doctype"] = "Supplier Scorecard Variable" frappe.get_doc(d).insert() except frappe.NameError: pass + + install_standing_docs = get_default_scorecard_standing() for d in install_standing_docs: try: d["doctype"] = "Supplier Scorecard Standing" From 29cf028f9afa00740317cca80a5b8426b90617e6 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 16 Jul 2025 13:29:02 +0530 Subject: [PATCH 067/217] refactor: replace all IntegrationTestCase -> ERPNextTestSuite --- .../test_tax_withholding_entry.py | 11 ++--------- .../test_tax_withholding_group.py | 11 ++--------- .../test_consolidated_trial_balance.py | 4 ++-- .../assets/doctype/asset_repair/test_asset_repair.py | 1 - .../tests/test_item_wise_inventory_account.py | 6 +++--- erpnext/selling/doctype/quotation/test_quotation.py | 2 +- erpnext/stock/doctype/stock_entry/test_stock_entry.py | 6 +----- 7 files changed, 11 insertions(+), 30 deletions(-) diff --git a/erpnext/accounts/doctype/tax_withholding_entry/test_tax_withholding_entry.py b/erpnext/accounts/doctype/tax_withholding_entry/test_tax_withholding_entry.py index 8a09f46e079..3f52eb77ee5 100644 --- a/erpnext/accounts/doctype/tax_withholding_entry/test_tax_withholding_entry.py +++ b/erpnext/accounts/doctype/tax_withholding_entry/test_tax_withholding_entry.py @@ -1,17 +1,10 @@ # Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -# import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] +from erpnext.tests.utils import ERPNextTestSuite -class IntegrationTestTaxWithholdingEntry(IntegrationTestCase): +class IntegrationTestTaxWithholdingEntry(ERPNextTestSuite): """ Integration tests for TaxWithholdingEntry. Use this class for testing interactions between multiple components. diff --git a/erpnext/accounts/doctype/tax_withholding_group/test_tax_withholding_group.py b/erpnext/accounts/doctype/tax_withholding_group/test_tax_withholding_group.py index 268febe3d7e..eacdf7f36fc 100644 --- a/erpnext/accounts/doctype/tax_withholding_group/test_tax_withholding_group.py +++ b/erpnext/accounts/doctype/tax_withholding_group/test_tax_withholding_group.py @@ -1,17 +1,10 @@ # Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -# import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] +from erpnext.tests.utils import ERPNextTestSuite -class IntegrationTestTaxWithholdingGroup(IntegrationTestCase): +class IntegrationTestTaxWithholdingGroup(ERPNextTestSuite): """ Integration tests for TaxWithholdingGroup. Use this class for testing interactions between multiple components. diff --git a/erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py b/erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py index d9d74f483b0..3e6ea82e13b 100644 --- a/erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py +++ b/erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py @@ -3,18 +3,18 @@ import frappe from frappe import _ -from frappe.tests import IntegrationTestCase from frappe.utils import flt, today from erpnext.accounts.report.consolidated_trial_balance.consolidated_trial_balance import execute from erpnext.setup.utils import get_exchange_rate +from erpnext.tests.utils import ERPNextTestSuite class ForeignCurrencyTranslationReserveNotFoundError(frappe.ValidationError): pass -class TestConsolidatedTrialBalance(IntegrationTestCase): +class TestConsolidatedTrialBalance(ERPNextTestSuite): @classmethod def setUpClass(cls): from erpnext.accounts.report.trial_balance.test_trial_balance import create_company diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py index 9a837ca3853..e52e5b524a6 100644 --- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py @@ -5,7 +5,6 @@ import unittest import frappe from frappe import qb from frappe.query_builder.functions import Sum -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_months, flt, get_first_day, nowdate, nowtime, today from erpnext.assets.doctype.asset.asset import ( diff --git a/erpnext/controllers/tests/test_item_wise_inventory_account.py b/erpnext/controllers/tests/test_item_wise_inventory_account.py index e8b2c1343e7..92881fcdb78 100644 --- a/erpnext/controllers/tests/test_item_wise_inventory_account.py +++ b/erpnext/controllers/tests/test_item_wise_inventory_account.py @@ -5,8 +5,7 @@ import copy from collections import defaultdict import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import add_days, cint, today +from frappe.utils import add_days, today from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record @@ -14,9 +13,10 @@ from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestItemWiseInventoryAccount(IntegrationTestCase): +class TestItemWiseInventoryAccount(ERPNextTestSuite): def setUp(self): self.company = make_company() self.company_abbr = frappe.db.get_value("Company", self.company, "abbr") diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index e1889d10fd1..238b5144933 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -1021,7 +1021,7 @@ class TestQuotation(ERPNextTestSuite): quotation.reload() self.assertEqual(quotation.status, "Ordered") - @change_settings("Accounts Settings", {"allow_pegged_currencies_exchange_rates": True}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"allow_pegged_currencies_exchange_rates": True}) def test_make_quotation_qar_to_inr(self): quotation = make_quotation( currency="QAR", diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index e43af88d0f7..49ff8b425aa 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -2369,10 +2369,8 @@ class TestStockEntry(ERPNextTestSuite): self.assertEqual(target_sabb.entries[0].batch_no, batch) self.assertEqual([entry.serial_no for entry in target_sabb.entries], serial_nos[:2]) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"material_consumption": 0}) def test_raw_material_missing_validation(self): - original_value = frappe.db.get_single_value("Manufacturing Settings", "material_consumption") - frappe.db.set_single_value("Manufacturing Settings", "material_consumption", 0) - stock_entry = make_stock_entry( item_code="_Test Item", qty=1, @@ -2389,8 +2387,6 @@ class TestStockEntry(ERPNextTestSuite): stock_entry.save, ) - frappe.db.set_single_value("Manufacturing Settings", "material_consumption", original_value) - @ERPNextTestSuite.change_settings( "Manufacturing Settings", { From 32c98d2a3e124c291e274f405498e22662111815 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 16 Jul 2025 14:34:12 +0530 Subject: [PATCH 068/217] refactor(test): set_user utility method --- erpnext/tests/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 056a39b5faf..eedf022b828 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -2490,6 +2490,15 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @contextmanager + def set_user(self, user: str): + try: + old_user = frappe.session.user + frappe.set_user(user) + yield + finally: + frappe.set_user(old_user) + @ERPNextTestSuite.registerAs(staticmethod) @contextmanager From 25c8735298f7b531c9a7c48bdd9ca2d06087f50d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 16 Jul 2025 15:06:59 +0530 Subject: [PATCH 069/217] chore: remove default templated test case --- .../test_pegged_currencies.py | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/erpnext/accounts/doctype/pegged_currencies/test_pegged_currencies.py b/erpnext/accounts/doctype/pegged_currencies/test_pegged_currencies.py index 32bb3f34fd5..e695b11bcb5 100644 --- a/erpnext/accounts/doctype/pegged_currencies/test_pegged_currencies.py +++ b/erpnext/accounts/doctype/pegged_currencies/test_pegged_currencies.py @@ -2,28 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase, UnitTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class UnitTestPeggedCurrencies(UnitTestCase): - """ - Unit tests for PeggedCurrencies. - Use this class for testing individual functions and methods. - """ - - pass - - -class IntegrationTestPeggedCurrencies(IntegrationTestCase): - """ - Integration tests for PeggedCurrencies. - Use this class for testing interactions between multiple components. - """ - - pass From a434b89173b4657932140ff25503be1386d102a8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 16 Jul 2025 15:17:32 +0530 Subject: [PATCH 070/217] refactor(test): install supplier scorecard presets --- erpnext/tests/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index eedf022b828..edfd0850f22 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -196,6 +196,20 @@ class ERPNextTestSuite(unittest.TestCase): if not frappe.db.exists("Sales Stage", {"stage_name": sales_stage.get("stage_name")}): frappe.get_doc(sales_stage).insert() + from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import ( + get_default_scorecard_standing, + get_default_scorecard_variables, + ) + + for x in get_default_scorecard_variables(): + x["doctype"] = "Supplier Scorecard Variable" + if not frappe.db.exists("Supplier Scorecard Variable", {"name": x.get("variable_label")}): + frappe.get_doc(x).insert() + for x in get_default_scorecard_standing(): + x["doctype"] = "Supplier Scorecard Standing" + if not frappe.db.exists("Supplier Scorecard Standing", {"name": x.get("standing_name")}): + frappe.get_doc(x).insert() + frappe.db.commit() @classmethod From b0d44847ac312744c6edc6d9e2b76366bc26c714 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 16 Jul 2025 15:25:10 +0530 Subject: [PATCH 071/217] refactor(test): make supplier quotation deterministic --- .../supplier_quotation/test_records.json | 31 +++++++++++++++++++ .../test_supplier_quotation.py | 5 +++ 2 files changed, 36 insertions(+) create mode 100644 erpnext/buying/doctype/supplier_quotation/test_records.json diff --git a/erpnext/buying/doctype/supplier_quotation/test_records.json b/erpnext/buying/doctype/supplier_quotation/test_records.json new file mode 100644 index 00000000000..1b9b922e3c9 --- /dev/null +++ b/erpnext/buying/doctype/supplier_quotation/test_records.json @@ -0,0 +1,31 @@ +[ + { + "buying_price_list": "_Test Price List", + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "doctype": "Supplier Quotation", + "base_grand_total": 5000.0, + "grand_total": 5000.0, + "is_subcontracted": 0, + "naming_series": "_T-Supplier Quotation-", + "base_net_total": 5000.0, + "items": [ + { + "base_amount": 5000.0, + "description": "_Test FG Item", + "doctype": "Supplier Quotation Item", + "item_code": "_Test FG Item", + "item_name": "_Test FG Item", + "parentfield": "items", + "qty": 10.0, + "rate": 500.0, + "uom": "_Test UOM", + "warehouse": "_Test Warehouse - _TC" + } + ], + "supplier": "_Test Supplier", + "supplier_name": "_Test Supplier", + "transaction_date": "2013-02-12" + } +] diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py index 6c644707fa1..d6ff71322e7 100644 --- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py @@ -14,6 +14,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPurchaseOrder(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Supplier Quotation") + def test_update_child_supplier_quotation_add_item(self): sq = frappe.copy_doc(self.globalTestRecords["Supplier Quotation"][0]) sq.submit() From 2c526ae85698a2d657c3e80c4c14bd8c674d8d05 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 16 Jul 2025 15:31:38 +0530 Subject: [PATCH 072/217] refactor(test): make asset repair tests deterministic --- erpnext/assets/doctype/asset_repair/test_asset_repair.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py index e52e5b524a6..2d1137197c5 100644 --- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py @@ -32,6 +32,7 @@ class TestAssetRepair(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() + cls.load_test_records("Stock Entry") set_depreciation_settings_in_company() create_asset_data() create_item("_Test Stock Item") From e5d9d3cf7f4063f2fdc8a25338ad9f686b87499e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 7 Aug 2025 11:25:33 +0530 Subject: [PATCH 073/217] refactor(test): incorrect fieldname for abbrevation --- erpnext/tests/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index edfd0850f22..0845e12ad6d 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -881,7 +881,7 @@ class ERPNextTestSuite(unittest.TestCase): "full_name": "Test User", "company_name": "Wind Power LLC", "timezone": "America/New_York", - "company_abbr": "WP", + "abbr": "WP", "industry": "Manufacturing", "country": "United States", # "fy_start_date": f"{current_year}-01-01", From eb31298f583dc8e632b17206e5d88434cf6d781d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 8 Aug 2025 15:36:07 +0530 Subject: [PATCH 074/217] refactor(tests): make asset maintenance tests deterministic --- erpnext/tests/utils.py | 108 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 0845e12ad6d..dc00a18c4fe 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -236,6 +236,8 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_item_tax_template() cls.make_item_group() cls.make_item_attribute() + cls.make_asset_maintenance_team() + cls.make_asset_category() cls.make_item() cls.make_location() cls.make_price_list() @@ -520,6 +522,7 @@ class ERPNextTestSuite(unittest.TestCase): {"doctype": "Role", "role_name": "_Test Role 2", "desk_access": 1}, {"doctype": "Role", "role_name": "_Test Role 3", "desk_access": 1}, {"doctype": "Role", "role_name": "_Test Role 4", "desk_access": 0}, + {"doctype": "Role", "role_name": "Technician"}, ] cls.roles = [] for x in records: @@ -602,6 +605,27 @@ class ERPNextTestSuite(unittest.TestCase): "new_password": "Eastern_43A1W", "roles": [{"doctype": "Has Role", "parentfield": "roles", "role": "System Manager"}], }, + { + "doctype": "User", + "email": "marcus@abc.com", + "first_name": "marcus@abc.com", + "new_password": "password", + "roles": [{"doctype": "Has Role", "role": "Technician"}], + }, + { + "doctype": "User", + "email": "thalia@abc.com", + "first_name": "thalia@abc.com", + "new_password": "password", + "roles": [{"doctype": "Has Role", "role": "Technician"}], + }, + { + "doctype": "User", + "email": "mathias@abc.com", + "first_name": "mathias@abc.com", + "new_password": "password", + "roles": [{"doctype": "Has Role", "role": "Technician"}], + }, ] cls.users = [] for x in records: @@ -2102,6 +2126,19 @@ class ERPNextTestSuite(unittest.TestCase): "item_name": "138-CMS Shoe", "stock_uom": "_Test UOM", }, + { + "doctype": "Item", + "item_code": "Photocopier", + "item_name": "Photocopier", + "item_group": "All Item Groups", + "company": "_Test Company", + "is_fixed_asset": 1, + "is_stock_item": 0, + "asset_category": "Equipment", + "auto_create_assets": 1, + "asset_naming_series": "ABC.###", + "stock_uom": "_Test UOM", + }, ] cls.item = [] for x in records: @@ -2504,6 +2541,77 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_asset_category(cls): + records = [ + { + "doctype": "Asset Category", + "asset_category_name": "Equipment", + "total_number_of_depreciations": 3, + "frequency_of_depreciation": 3, + "accounts": [ + { + "company_name": "_Test Company", + "fixed_asset_account": "_Test Fixed Asset - _TC", + "accumulated_depreciation_account": "_Test Accumulated Depreciations - _TC", + "depreciation_expense_account": "_Test Depreciations - _TC", + } + ], + } + ] + cls.asset_category = [] + for x in records: + if not frappe.db.exists("Asset Category", {"asset_category_name": x.get("asset_category_name")}): + cls.asset_category.append(frappe.get_doc(x).insert()) + else: + cls.asset_category.append( + frappe.get_doc( + "Asset Category", + {"asset_category_name": x.get("asset_category_name")}, + ) + ) + + @classmethod + def make_asset_maintenance_team(cls): + records = [ + { + "doctype": "Asset Maintenance Team", + "maintenance_manager": "marcus@abc.com", + "maintenance_team_name": "Team Awesome", + "company": "_Test Company", + "maintenance_team_members": [ + { + "team_member": "marcus@abc.com", + "full_name": "marcus@abc.com", + "maintenance_role": "Technician", + }, + { + "team_member": "thalia@abc.com", + "full_name": "thalia@abc.com", + "maintenance_role": "Technician", + }, + { + "team_member": "mathias@abc.com", + "full_name": "mathias@abc.com", + "maintenance_role": "Technician", + }, + ], + } + ] + cls.asset_maintenance_team = [] + for x in records: + if not frappe.db.exists( + "Asset Maintenance Team", {"maintenance_team_name": x.get("maintenance_team_name")} + ): + cls.asset_maintenance_team.append(frappe.get_doc(x).insert()) + else: + cls.asset_maintenance_team.append( + frappe.get_doc( + "Asset Maintenance Team", + {"maintenance_team_name": x.get("maintenance_team_name")}, + ) + ) + @contextmanager def set_user(self, user: str): try: From 9dd6cf2cb7b80ebdb3de60e15f16ebfe4f97a4a8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 28 Aug 2025 17:21:00 +0530 Subject: [PATCH 075/217] refactor(test): handle setup of Workstation Operation Component --- erpnext/tests/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index dc00a18c4fe..3141737cd79 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -181,6 +181,7 @@ class ERPNextTestSuite(unittest.TestCase): "Print Heading": "print_heading", "Share Type": "title", "Market Segment": "market_segment", + "Workstation Operating Component": "component_name", } for x in records: dt = x.get("doctype") From 607f0789cc806219c3d86f901aefe5c5e5bca931 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 28 Aug 2025 17:21:18 +0530 Subject: [PATCH 076/217] refactor: avoid name clash --- erpnext/tests/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 3141737cd79..f5fadc0638e 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -239,7 +239,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_item_attribute() cls.make_asset_maintenance_team() cls.make_asset_category() - cls.make_item() + cls._make_item() cls.make_location() cls.make_price_list() cls.make_shareholder() @@ -1653,7 +1653,7 @@ class ERPNextTestSuite(unittest.TestCase): ) @classmethod - def make_item(cls): + def _make_item(cls): records = [ { "description": "_Test Item 1", From 1e08962eb48c8acb468db978c4f8acd9c4876652 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 29 Aug 2025 10:39:56 +0530 Subject: [PATCH 077/217] refactor(test): make purchase invoice tests deterministic --- .../purchase_invoice/test_purchase_invoice.py | 24 +- .../purchase_invoice/test_records.json | 209 ++++++++++++++++++ 2 files changed, 220 insertions(+), 13 deletions(-) create mode 100644 erpnext/accounts/doctype/purchase_invoice/test_records.json diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 4260bfbb5d8..5c11172c4b5 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -40,18 +40,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): unlink_payment_on_cancel_of_invoice() frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) - - @classmethod - def tearDownClass(cls): - unlink_payment_on_cancel_of_invoice(0) - - def tearDown(self): - frappe.db.rollback() + self.load_test_records("Purchase Invoice") + self.load_test_records("Journal Entry") def test_purchase_invoice_qty(self): pi = make_purchase_invoice(qty=0, do_not_save=True) @@ -349,6 +342,9 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): self.assertEqual(expected_values[gle.account][1], gle.debit) self.assertEqual(expected_values[gle.account][2], gle.credit) + @ERPNextTestSuite.change_settings( + "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1} + ) def test_purchase_invoice_with_exchange_rate_difference(self): from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( make_purchase_invoice as create_purchase_invoice, @@ -372,7 +368,7 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): # fetching the latest GL Entry with exchange gain and loss account account amount = frappe.db.get_value( - "GL Entry", {"account": exchange_gain_loss_account, "voucher_no": pi.name}, "debit" + "GL Entry", {"account": exchange_gain_loss_account, "voucher_no": pi.name}, "credit" ) discrepancy_caused_by_exchange_rate_diff = abs( pi.items[0].base_net_amount - pr.items[0].base_net_amount @@ -418,14 +414,14 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): # fetching the latest GL Entry with exchange gain and loss account account amount = frappe.db.get_value( - "GL Entry", {"account": exchange_gain_loss_account, "voucher_no": pi.name}, "debit" + "GL Entry", {"account": exchange_gain_loss_account, "voucher_no": pi.name}, "credit" ) discrepancy_caused_by_exchange_rate_diff = abs( pi.items[1].base_net_amount - pr.items[1].base_net_amount ) - self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount) + self.assertEqual(flt(discrepancy_caused_by_exchange_rate_diff, 2), amount) def test_purchase_invoice_change_naming_series(self): pi = frappe.copy_doc(self.globalTestRecords["Purchase Invoice"][1]) @@ -2276,6 +2272,7 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): def test_create_purchase_invoice_without_mandatory(self): pi = frappe.new_doc("Purchase Invoice") + pi.company = self.companies[0].name pi.flags.ignore_mandatory = True pi.insert(ignore_permissions=True) @@ -2404,6 +2401,7 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): "doctype": "Serial No", "item_code": serial_item, "serial_no": serial_no, + "company": self.companies[0].name, } ).insert() diff --git a/erpnext/accounts/doctype/purchase_invoice/test_records.json b/erpnext/accounts/doctype/purchase_invoice/test_records.json new file mode 100644 index 00000000000..9f9e90d8a75 --- /dev/null +++ b/erpnext/accounts/doctype/purchase_invoice/test_records.json @@ -0,0 +1,209 @@ +[ + { + "bill_no": "NA", + "buying_price_list": "_Test Price List", + "company": "_Test Company", + "conversion_rate": 1, + "credit_to": "_Test Payable - _TC", + "currency": "INR", + "doctype": "Purchase Invoice", + "items": [ + { + "amount": 500, + "base_amount": 500, + "base_rate": 50, + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Purchase Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "qty": 10, + "rate": 50, + "uom": "_Test UOM", + "warehouse": "_Test Warehouse - _TC" + }, + { + "amount": 750, + "base_amount": 750, + "base_rate": 150, + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Purchase Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "qty": 5, + "rate": 150, + "uom": "_Test UOM", + "warehouse": "_Test Warehouse - _TC" + } + ], + "grand_total": 0, + "naming_series": "T-PINV-", + "taxes": [ + { + "account_head": "_Test Account Shipping Charges - _TC", + "add_deduct_tax": "Add", + "category": "Valuation and Total", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "add_deduct_tax": "Add", + "category": "Valuation", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Excise Duty - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 1, + "row_id": 3 + }, + { + "account_head": "_Test Account CST - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 5 + }, + { + "account_head": "_Test Account VAT - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Discount - _TC", + "add_deduct_tax": "Deduct", + "category": "Total", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 10, + "row_id": 7 + } + ], + "supplier": "_Test Supplier", + "supplier_name": "_Test Supplier" + }, + + + + { + "bill_no": "NA", + "buying_price_list": "_Test Price List", + "company": "_Test Company", + "conversion_rate": 1.0, + "credit_to": "_Test Payable - _TC", + "currency": "INR", + "doctype": "Purchase Invoice", + "items": [ + { + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Purchase Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item", + "item_name": "_Test Item", + "parentfield": "items", + "qty": 10.0, + "rate": 50.0, + "uom": "_Test UOM" + } + ], + "grand_total": 0, + "naming_series": "T-PINV-", + "taxes": [ + { + "account_head": "_Test Account Shipping Charges - _TC", + "add_deduct_tax": "Add", + "category": "Valuation and Total", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 100.0 + }, + { + "account_head": "_Test Account VAT - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 120.0 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "add_deduct_tax": "Add", + "category": "Valuation", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 150.0 + } + ], + "supplier": "_Test Supplier", + "supplier_name": "_Test Supplier" + } +] From 3fcb860d6dce70157af540c3638476598ead5c3f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 29 Aug 2025 11:52:32 +0530 Subject: [PATCH 078/217] refactor(test): make sales invoice tests deterministic - allow_negative_stock is required for test_taxes_merging_from_delivery_note --- .../doctype/sales_invoice/test_records.json | 772 ++++++++++++++++++ .../sales_invoice/test_sales_invoice.py | 12 + erpnext/tests/utils.py | 1 + 3 files changed, 785 insertions(+) create mode 100644 erpnext/accounts/doctype/sales_invoice/test_records.json diff --git a/erpnext/accounts/doctype/sales_invoice/test_records.json b/erpnext/accounts/doctype/sales_invoice/test_records.json new file mode 100644 index 00000000000..9aee69cd053 --- /dev/null +++ b/erpnext/accounts/doctype/sales_invoice/test_records.json @@ -0,0 +1,772 @@ +[ + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "cost_center": "_Test Cost Center - _TC", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "items": [ + { + "amount": 500.0, + "base_amount": 500.0, + "base_rate": 500.0, + "cost_center": "_Test Cost Center - _TC", + "description": "138-CMS Shoe", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "138-CMS Shoe", + "item_name": "138-CMS Shoe", + "parentfield": "items", + "qty": 1.0, + "rate": 500.0, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "base_grand_total": 561.8, + "grand_total": 561.8, + "is_pos": 0, + "naming_series": "T-SINV-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 6 + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 6.36 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "amount": 500.0, + "base_amount": 500.0, + "base_rate": 500.0, + "cost_center": "_Test Cost Center - _TC", + "description": "_Test Item", + "doctype": "Sales Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "income_account": "Sales - _TC", + "item_code": "_Test Item", + "item_name": "_Test Item", + "parentfield": "items", + "price_list_rate": 500.0, + "qty": 1.0, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "base_grand_total": 630.0, + "grand_total": 630.0, + "is_pos": 0, + "naming_series": "T-SINV-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 16 + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 10 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "price_list_rate": 50, + "qty": 10, + "rate": 50, + "uom": "_Test UOM 1", + "conversion_factor": 1, + "stock_uom": "_Test UOM 1" + }, + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "price_list_rate": 150, + "qty": 5, + "uom": "_Test UOM", + "conversion_factor": 1, + "rate": 150, + "stock_uom": "_Test UOM" + } + ], + "grand_total": 0, + "is_pos": 0, + "naming_series": "T-SINV-", + "taxes": [ + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 1, + "row_id": 3 + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 5 + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": -10, + "row_id": 7 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "price_list_rate": 62.5, + "qty": 10, + "uom": "_Test UOM 1", + "conversion_factor": 1, + "stock_uom": "_Test UOM 1" + }, + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "price_list_rate": 190.66, + "qty": 5, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "grand_total": 0, + "is_pos": 0, + "naming_series": "T-SINV-", + "taxes": [ + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "idx": 1, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "idx": 2, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 2, + "row_id": 1 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "idx": 3, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 1, + "row_id": 1 + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "idx": 4, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "idx": 5, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "idx": 6, + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "idx": 7, + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "idx": 8, + "parentfield": "taxes", + "rate": -10, + "row_id": 7 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "cost_center": "_Test Cost Center - _TC", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "items": [ + { + "amount": 500.0, + "base_amount": 500.0, + "base_rate": 500.0, + "cost_center": "_Test Cost Center - _TC", + "description": "138-CMS Shoe", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "138-CMS Shoe", + "item_name": "138-CMS Shoe", + "parentfield": "items", + "qty": 1.0, + "rate": 500.0, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "base_grand_total": 561.8, + "grand_total": 561.8, + "is_pos": 0, + "naming_series": "T-SINV-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 6 + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 6.36 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "amount": 500.0, + "base_amount": 500.0, + "base_rate": 500.0, + "cost_center": "_Test Cost Center - _TC", + "description": "_Test Item", + "doctype": "Sales Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "income_account": "Sales - _TC", + "item_code": "_Test Item", + "item_name": "_Test Item", + "parentfield": "items", + "price_list_rate": 500.0, + "qty": 1.0, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "base_grand_total": 630.0, + "grand_total": 630.0, + "is_pos": 0, + "naming_series": "T-SINV-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 16 + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 10 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "price_list_rate": 50, + "qty": 10, + "rate": 50, + "uom": "_Test UOM 1", + "conversion_factor": 1, + "stock_uom": "_Test UOM 1" + }, + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "price_list_rate": 150, + "qty": 5, + "uom": "_Test UOM", + "conversion_factor": 1, + "rate": 150, + "stock_uom": "_Test UOM" + } + ], + "grand_total": 0, + "is_pos": 0, + "naming_series": "T-SINV-", + "taxes": [ + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 1, + "row_id": 3 + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 5 + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": -10, + "row_id": 7 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "price_list_rate": 62.5, + "qty": 10, + "uom": "_Test UOM 1", + "conversion_factor": 1, + "stock_uom": "_Test UOM 1" + }, + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "price_list_rate": 190.66, + "qty": 5, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "grand_total": 0, + "is_pos": 0, + "naming_series": "T-SINV-", + "taxes": [ + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "idx": 1, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "idx": 2, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 2, + "row_id": 1 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "idx": 3, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 1, + "row_id": 1 + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "idx": 4, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "idx": 5, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "idx": 6, + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "idx": 7, + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "idx": 8, + "parentfield": "taxes", + "rate": -10, + "row_id": 7 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + } +] diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 4c9c5f72e2e..9e4d5a92c1c 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -101,6 +101,9 @@ class TestSalesInvoice(ERPNextTestSuite): cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) cls.make_employees() cls.make_sales_person() + cls.load_test_records("Journal Entry") + cls.load_test_records("Stock Entry") + cls.load_test_records("Sales Invoice") unlink_payment_on_cancel_of_invoice() @classmethod @@ -533,6 +536,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertTrue(gle) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_tax_calculation_with_multiple_items(self): si = create_sales_invoice(qty=84, rate=4.6, do_not_save=True) item_row = si.get("items")[0] @@ -561,6 +565,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(si.grand_total, 5474.0) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_tax_calculation_with_item_tax_template(self): si = create_sales_invoice(qty=84, rate=4.6, do_not_save=True) item_row = si.get("items")[0] @@ -627,6 +632,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(si.rounding_adjustment, 0.43) self.assertEqual(si.rounded_total, 5676.0) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_tax_calculation_with_multiple_items_and_discount(self): si = create_sales_invoice(qty=1, rate=75, do_not_save=True) item_row = si.get("items")[0] @@ -2183,6 +2189,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(expected_values[gle.account][1], gle.debit) self.assertEqual(expected_values[gle.account][2], gle.credit) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_rounding_adjustment_2(self): si = create_sales_invoice(rate=400, do_not_save=True) for rate in [400.25, 600.30, 100.65]: @@ -2240,6 +2247,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(expected_account_values[0], gle.debit) self.assertEqual(expected_account_values[1], gle.credit) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_rounding_adjustment_3(self): from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import create_dimension @@ -3457,6 +3465,7 @@ class TestSalesInvoice(ERPNextTestSuite): frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", None) @ERPNextTestSuite.change_settings("Accounts Settings", {"over_billing_allowance": 0}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_over_billing_case_against_delivery_note(self): """ Test a case where duplicating the item with qty = 1 in the invoice @@ -4168,12 +4177,14 @@ class TestSalesInvoice(ERPNextTestSuite): si.save() return si + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_rounding_validation_for_opening_with_inclusive_tax(self): si = self._create_opening_invoice_with_inclusive_tax() # 'Round Off for Opening' not set in Company master # Ledger level validation must be thrown self.assertRaises(frappe.ValidationError, si.submit) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_ledger_entries_on_opening_invoice_with_rounding_loss_by_inclusive_tax(self): si = self._create_opening_invoice_with_inclusive_tax() # 'Round Off for Opening' is set in Company master @@ -4401,6 +4412,7 @@ class TestSalesInvoice(ERPNextTestSuite): doc = frappe.get_doc("Project", project.name) self.assertEqual(doc.total_billed_amount, si.grand_total) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_total_billed_amount_with_different_projects(self): # This test case is for checking the scenario where project is set at document level and for **some** child items only, not all from copy import copy diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index f5fadc0638e..5c19ff285a3 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -1669,6 +1669,7 @@ class ERPNextTestSuite(unittest.TestCase): "apply_warehouse_wise_reorder_level": 1, "opening_stock": 10, "valuation_rate": 100, + "allow_negative_stock": True, "item_defaults": [ { "company": "_Test Company", From 98d43f5933df4c2262701b1a7b2a94a8840f1ae4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 29 Aug 2025 12:10:46 +0530 Subject: [PATCH 079/217] refactor(test): set precision in class setup --- erpnext/tests/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 5c19ff285a3..a2e61057c8b 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -255,6 +255,7 @@ class ERPNextTestSuite(unittest.TestCase): system_settings = frappe.get_doc("System Settings") system_settings.time_zone = "Asia/Kolkata" system_settings.language = "en" + system_settings.currency_precision = system_settings.float_precision = 2 system_settings.save() @classmethod From d7840b5c45d77eaaf69936e23bd86d654aeaa5f1 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 4 Sep 2025 16:20:17 +0530 Subject: [PATCH 080/217] refactor(test): ensure new bankers rounding method is set --- erpnext/tests/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index a2e61057c8b..b0fb36fb757 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -256,6 +256,7 @@ class ERPNextTestSuite(unittest.TestCase): system_settings.time_zone = "Asia/Kolkata" system_settings.language = "en" system_settings.currency_precision = system_settings.float_precision = 2 + system_settings.rounding_method = "Banker's Rounding" system_settings.save() @classmethod From 2832aeb592249a487bf4cb64efb83a9e9a3b1bc6 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 16 Sep 2025 16:46:49 +0530 Subject: [PATCH 081/217] refactor(test): make tax withholding tests deterministic --- .../tax_withholding_category/test_tax_withholding_category.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index 922203637e9..966aaf43fdf 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -1034,6 +1034,7 @@ class TestTaxWithholdingCategory(ERPNextTestSuite): self.cleanup_invoices(invoices) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_multiple_items": 1}) def test_tds_calculation_on_net_total_partial_tds(self): self.setup_party_with_category("Supplier", "Test TDS Supplier4", "Cumulative Threshold TDS") invoices = [] From 10de2e348b574ad262ef050fcdb7b34c90453197 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 6 Nov 2025 16:34:35 +0530 Subject: [PATCH 082/217] refactor(test): remove empty IntegrationTestCase --- .../account_category/test_account_category.py | 16 ---------------- .../test_process_period_closing_voucher.py | 16 ---------------- .../test_master_production_schedule.py | 16 ---------------- .../sales_forecast/test_sales_forecast.py | 16 ---------------- .../workstation_cost/test_workstation_cost.py | 16 ---------------- .../test_workstation_operating_component.py | 16 ---------------- ...st_workstation_operating_component_account.py | 16 ---------------- .../test_delivery_schedule_item.py | 16 ---------------- .../item_lead_time/test_item_lead_time.py | 16 ---------------- 9 files changed, 144 deletions(-) diff --git a/erpnext/accounts/doctype/account_category/test_account_category.py b/erpnext/accounts/doctype/account_category/test_account_category.py index ea3c2c7783c..e695b11bcb5 100644 --- a/erpnext/accounts/doctype/account_category/test_account_category.py +++ b/erpnext/accounts/doctype/account_category/test_account_category.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestAccountCategory(IntegrationTestCase): - """ - Integration tests for AccountCategory. - Use this class for testing interactions between multiple components. - """ - - pass diff --git a/erpnext/accounts/doctype/process_period_closing_voucher/test_process_period_closing_voucher.py b/erpnext/accounts/doctype/process_period_closing_voucher/test_process_period_closing_voucher.py index 17ce2c13b09..e695b11bcb5 100644 --- a/erpnext/accounts/doctype/process_period_closing_voucher/test_process_period_closing_voucher.py +++ b/erpnext/accounts/doctype/process_period_closing_voucher/test_process_period_closing_voucher.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestProcessPeriodClosingVoucher(IntegrationTestCase): - """ - Integration tests for ProcessPeriodClosingVoucher. - Use this class for testing interactions between multiple components. - """ - - pass diff --git a/erpnext/manufacturing/doctype/master_production_schedule/test_master_production_schedule.py b/erpnext/manufacturing/doctype/master_production_schedule/test_master_production_schedule.py index 1263fc583b5..e695b11bcb5 100644 --- a/erpnext/manufacturing/doctype/master_production_schedule/test_master_production_schedule.py +++ b/erpnext/manufacturing/doctype/master_production_schedule/test_master_production_schedule.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestMasterProductionSchedule(IntegrationTestCase): - """ - Integration tests for MasterProductionSchedule. - Use this class for testing interactions between multiple components. - """ - - pass diff --git a/erpnext/manufacturing/doctype/sales_forecast/test_sales_forecast.py b/erpnext/manufacturing/doctype/sales_forecast/test_sales_forecast.py index 3f95a82d5f0..e695b11bcb5 100644 --- a/erpnext/manufacturing/doctype/sales_forecast/test_sales_forecast.py +++ b/erpnext/manufacturing/doctype/sales_forecast/test_sales_forecast.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestSalesForecast(IntegrationTestCase): - """ - Integration tests for SalesForecast. - Use this class for testing interactions between multiple components. - """ - - pass diff --git a/erpnext/manufacturing/doctype/workstation_cost/test_workstation_cost.py b/erpnext/manufacturing/doctype/workstation_cost/test_workstation_cost.py index ea948f62abc..e695b11bcb5 100644 --- a/erpnext/manufacturing/doctype/workstation_cost/test_workstation_cost.py +++ b/erpnext/manufacturing/doctype/workstation_cost/test_workstation_cost.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestWorkstationCost(IntegrationTestCase): - """ - Integration tests for WorkstationCost. - Use this class for testing interactions between multiple components. - """ - - pass diff --git a/erpnext/manufacturing/doctype/workstation_operating_component/test_workstation_operating_component.py b/erpnext/manufacturing/doctype/workstation_operating_component/test_workstation_operating_component.py index 0d327c6473d..e695b11bcb5 100644 --- a/erpnext/manufacturing/doctype/workstation_operating_component/test_workstation_operating_component.py +++ b/erpnext/manufacturing/doctype/workstation_operating_component/test_workstation_operating_component.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestWorkstationOperatingComponent(IntegrationTestCase): - """ - Integration tests for WorkstationOperatingComponent. - Use this class for testing interactions between multiple components. - """ - - pass diff --git a/erpnext/manufacturing/doctype/workstation_operating_component_account/test_workstation_operating_component_account.py b/erpnext/manufacturing/doctype/workstation_operating_component_account/test_workstation_operating_component_account.py index 3bf919b8df0..e695b11bcb5 100644 --- a/erpnext/manufacturing/doctype/workstation_operating_component_account/test_workstation_operating_component_account.py +++ b/erpnext/manufacturing/doctype/workstation_operating_component_account/test_workstation_operating_component_account.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestWorkstationOperatingComponentAccount(IntegrationTestCase): - """ - Integration tests for WorkstationOperatingComponentAccount. - Use this class for testing interactions between multiple components. - """ - - pass diff --git a/erpnext/selling/doctype/delivery_schedule_item/test_delivery_schedule_item.py b/erpnext/selling/doctype/delivery_schedule_item/test_delivery_schedule_item.py index d941e415c57..e695b11bcb5 100644 --- a/erpnext/selling/doctype/delivery_schedule_item/test_delivery_schedule_item.py +++ b/erpnext/selling/doctype/delivery_schedule_item/test_delivery_schedule_item.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestDeliveryScheduleItem(IntegrationTestCase): - """ - Integration tests for DeliveryScheduleItem. - Use this class for testing interactions between multiple components. - """ - - pass diff --git a/erpnext/stock/doctype/item_lead_time/test_item_lead_time.py b/erpnext/stock/doctype/item_lead_time/test_item_lead_time.py index 49601b5faad..e695b11bcb5 100644 --- a/erpnext/stock/doctype/item_lead_time/test_item_lead_time.py +++ b/erpnext/stock/doctype/item_lead_time/test_item_lead_time.py @@ -2,19 +2,3 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase - -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - - -class IntegrationTestItemLeadTime(IntegrationTestCase): - """ - Integration tests for ItemLeadTime. - Use this class for testing interactions between multiple components. - """ - - pass From 61cd154f0f0d7b5f4a254afd45536f741dbe8560 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 13 Nov 2025 13:14:20 +0530 Subject: [PATCH 083/217] refactor(test): make opportunity deterministic --- erpnext/crm/doctype/opportunity/test_opportunity.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index db9866d9b89..99bb18a85d8 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -31,6 +31,7 @@ class TestOpportunity(ERPNextTestSuite): "opportunity_from": "Lead", "enquiry_type": "Sales", "party_name": cls.leads[0].name, + "company": cls.companies[0].name, "transaction_date": "2013-12-12", "items": [ {"item_name": "Test Item", "description": "Some description", "qty": 5, "rate": 100} @@ -57,7 +58,7 @@ class TestOpportunity(ERPNextTestSuite): self.assertEqual(doc.status, "Quotation") def test_make_new_lead_if_required(self): - opp_doc = make_opportunity_from_lead() + opp_doc = make_opportunity_from_lead(self.companies[0].name) self.assertTrue(opp_doc.party_name) self.assertEqual(opp_doc.opportunity_from, "Lead") @@ -101,7 +102,7 @@ class TestOpportunity(ERPNextTestSuite): create_communication(opp_doc.doctype, opp_doc.name, opp_doc.contact_email) -def make_opportunity_from_lead(): +def make_opportunity_from_lead(company): new_lead_email_id = f"new{random_string(5)}@example.com" args = { "doctype": "Opportunity", @@ -109,6 +110,7 @@ def make_opportunity_from_lead(): "opportunity_type": "Sales", "with_items": 0, "transaction_date": today(), + "company": company, } # new lead should be created against the new.opportunity@example.com opp_doc = frappe.get_doc(args).insert(ignore_permissions=True) From 8e0c8e1c806b149ca6e10761af9ecf2bcbea793a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 13 Nov 2025 13:21:07 +0530 Subject: [PATCH 084/217] refactor(test): make prospect deterministic --- erpnext/crm/doctype/prospect/test_prospect.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/crm/doctype/prospect/test_prospect.py b/erpnext/crm/doctype/prospect/test_prospect.py index 26948fe9390..4d52ea543ab 100644 --- a/erpnext/crm/doctype/prospect/test_prospect.py +++ b/erpnext/crm/doctype/prospect/test_prospect.py @@ -12,11 +12,12 @@ from erpnext.tests.utils import ERPNextTestSuite class TestProspect(ERPNextTestSuite): def test_add_lead_to_prospect_and_address_linking(self): + company = self.companies[0].name lead_doc = make_lead() address_doc = make_address(address_title=lead_doc.name) address_doc.append("links", {"link_doctype": lead_doc.doctype, "link_name": lead_doc.name}) address_doc.save() - prospect_doc = make_prospect() + prospect_doc = make_prospect(company=company, company_name=company) add_lead_to_prospect(lead_doc.name, prospect_doc.name) prospect_doc.reload() lead_exists_in_prosoect = False @@ -37,6 +38,7 @@ class TestProspect(ERPNextTestSuite): "doctype": "Prospect", "company_name": "_Test Prospect", "customer_group": "_Test Customer Group", + "company": self.companies[0].name, } ) prospect.insert() @@ -58,6 +60,7 @@ def make_prospect(**args): { "doctype": "Prospect", "company_name": args.company_name or f"_Test Company {random_string(3)}", + "company": args.company, } ).insert() From 44a10ea50dd58b967b0e6edfd9d46ff50bdf0f3f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 13 Nov 2025 13:27:03 +0530 Subject: [PATCH 085/217] refactor(test): make maintenance schedule deterministic --- .../doctype/maintenance_schedule/test_maintenance_schedule.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py index 6ff2d7cb239..aec5e34bbb7 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py @@ -19,6 +19,7 @@ class TestMaintenanceSchedule(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() + cls.load_test_records("Stock Entry") cls.make_sales_person() @classmethod From a158fd1a7892bf853727df93c463304be1166856 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 13 Nov 2025 13:55:12 +0530 Subject: [PATCH 086/217] refactor(test): make timesheet and activity type deterministic --- .../activity_cost/test_activity_cost.py | 3 ++- .../doctype/timesheet/test_timesheet.py | 5 ++-- erpnext/tests/utils.py | 23 +++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py index 470b21cca87..19188c350fe 100644 --- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py +++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py @@ -15,6 +15,7 @@ class TestActivityCost(ERPNextTestSuite): super().setUpClass() # TODO: only 1 employee is required cls.make_employees() + cls.make_activity_type() def test_duplication(self): frappe.db.sql("delete from `tabActivity Cost`") @@ -23,7 +24,7 @@ class TestActivityCost(ERPNextTestSuite): { "employee": self.employees[0].name, "employee_name": self.employees[0].first_name, - "activity_type": "_Test Activity Type 1", + "activity_type": self.activity_type[1].name, "billing_rate": 100, "costing_rate": 50, } diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py index 0526f8733de..afbccea374f 100644 --- a/erpnext/projects/doctype/timesheet/test_timesheet.py +++ b/erpnext/projects/doctype/timesheet/test_timesheet.py @@ -19,6 +19,7 @@ class TestTimesheet(ERPNextTestSuite): def setUpClass(cls): super().setUpClass() cls.make_projects() + cls.make_activity_type() def setUp(self): frappe.db.delete("Timesheet") @@ -102,7 +103,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(timesheet.total_billable_amount, 0) def test_sales_invoice_from_timesheet(self): - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) timesheet = make_timesheet(emp, simulate=True, is_billable=1) sales_invoice = make_sales_invoice(timesheet.name, "_Test Item", "_Test Customer", currency="INR") @@ -287,7 +288,7 @@ class TestTimesheet(ERPNextTestSuite): This test ensures Timesheet status is recalculated correctly across billing and return lifecycle events. """ - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) timesheet = make_timesheet(emp, simulate=True, is_billable=1, do_not_submit=True) timesheet_detail = timesheet.append("time_logs", {}) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index b0fb36fb757..ae61bc6c522 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -2616,6 +2616,29 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_activity_type(cls): + records = [ + { + "doctype": "Activity Type", + "name": "_Test Activity Type", + "activity_type": "_Test Activity Type", + }, + { + "doctype": "Activity Type", + "name": "_Test Activity Type 1", + "activity_type": "_Test Activity Type 1", + }, + ] + cls.activity_type = [] + for x in records: + if not frappe.db.exists("Activity Type", {"activity_type": x.get("activity_type")}): + cls.activity_type.append(frappe.get_doc(x).insert()) + else: + cls.activity_type.append( + frappe.get_doc("Activity Type", {"activity_type": x.get("activity_type")}) + ) + @contextmanager def set_user(self, user: str): try: From 36e578e84834821c0c79e259924329b6c7ec0f8b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 15 Nov 2025 12:25:15 +0530 Subject: [PATCH 087/217] refactor(test): pos invoice tests are almost deterministic --- .../doctype/pos_invoice/test_pos_invoice.py | 125 ++++++++---------- erpnext/tests/utils.py | 7 - 2 files changed, 57 insertions(+), 75 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 9b08b409fd8..36b086695db 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -29,31 +29,28 @@ class TestPOSInvoice(ERPNextTestSuite): def setUpClass(cls): super().setUpClass() cls.load_test_records("Stock Entry") - cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) - cls.enterClassContext(cls.change_settings("POS Settings", invoice_type="POS Invoice")) - make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item", qty=800, basic_rate=100) - frappe.db.sql("delete from `tabTax Rule`") + def setUp(self): from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile - from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry - cls.test_user, cls.pos_profile = init_user_and_profile() - cls.opening_entry = create_opening_entry(cls.pos_profile, cls.test_user.name) - mode_of_payment = frappe.get_doc("Mode of Payment", "Bank Draft") - set_default_account_for_mode_of_payment(mode_of_payment, "_Test Company", "_Test Bank - _TC") + self.test_user, self.pos_profile = init_user_and_profile() - @classmethod - def tearDownClass(cls): - frappe.db.sql("delete from `tabPOS Invoice`") - opening_entry_doc = frappe.get_doc("POS Opening Entry", cls.opening_entry.name) - opening_entry_doc.cancel() - - def tearDown(self): if frappe.session.user != "Administrator": frappe.set_user("Administrator") - if frappe.db.get_single_value("Selling Settings", "validate_selling_price"): - frappe.db.set_single_value("Selling Settings", "validate_selling_price", 0) + frappe.db.set_single_value("Selling Settings", "validate_selling_price", 0) + frappe.db.set_single_value("POS Settings", "invoice_type", "POS Invoice") + make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item", qty=800, basic_rate=100) + frappe.db.sql("delete from `tabTax Rule`") + + from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry + + self.opening_entry = create_opening_entry(self.pos_profile, self.test_user.name) + mode_of_payment = frappe.get_doc("Mode of Payment", "Bank Draft") + set_default_account_for_mode_of_payment(mode_of_payment, "_Test Company", "_Test Bank - _TC") + + def tearDown(self): + frappe.db.rollback() def test_timestamp_change(self): w = create_pos_invoice(do_not_save=1) @@ -1003,43 +1000,41 @@ class TestPOSInvoice(ERPNextTestSuite): se.cancel() def test_ignore_pricing_rule(self): - frappe.set_user("Administrator") from erpnext.accounts.doctype.pricing_rule.test_pricing_rule import make_pricing_rule - item_price = self.truncate_make_item_price( - { - "doctype": "Item Price", - "item_code": "_Test Item", - "price_list": "_Test Price List", - "price_list_rate": "450", - } - ) + if not frappe.db.exists( + "Item Price", + {"item_code": "_Test Item", "price_list": "_Test Price List", "price_list_rate": "450"}, + ): + item_price = frappe.get_doc( + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Price List", + "price_list_rate": "450", + } + ) + item_price.insert() pr = make_pricing_rule(selling=1, priority=5, discount_percentage=10) pr.save() - try: - pos_inv = create_pos_invoice(qty=1, do_not_submit=1) - pos_inv.items[0].rate = 300 - pos_inv.save() - self.assertEqual(pos_inv.items[0].discount_percentage, 10) - # rate shouldn't change - self.assertEqual(pos_inv.items[0].rate, 405) + pos_inv = create_pos_invoice(qty=1, do_not_submit=1) + pos_inv.items[0].rate = 300 + pos_inv.save() + self.assertEqual(pos_inv.items[0].discount_percentage, 10) + # rate shouldn't change + self.assertEqual(pos_inv.items[0].rate, 405) - pos_inv.ignore_pricing_rule = 1 - pos_inv.save() - self.assertEqual(pos_inv.ignore_pricing_rule, 1) - # rate should reset since pricing rules are ignored - self.assertEqual(pos_inv.items[0].rate, 450) + pos_inv.ignore_pricing_rule = 1 + pos_inv.save() + self.assertEqual(pos_inv.ignore_pricing_rule, 1) + # rate should reset since pricing rules are ignored + self.assertEqual(pos_inv.items[0].rate, 450) - pos_inv.items[0].rate = 300 - pos_inv.save() - self.assertEqual(pos_inv.items[0].rate, 300) - - finally: - item_price.delete() - pos_inv.delete() - pr.delete() + pos_inv.items[0].rate = 300 + pos_inv.save() + self.assertEqual(pos_inv.items[0].rate, 300) def test_delivered_serial_no_case(self): from erpnext.accounts.doctype.pos_invoice_merge_log.test_pos_invoice_merge_log import ( @@ -1048,32 +1043,26 @@ class TestPOSInvoice(ERPNextTestSuite): from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item - frappe.db.savepoint("before_test_delivered_serial_no_case") - try: - se = make_serialized_item(self) - serial_no = get_serial_nos_from_bundle(se.get("items")[0].serial_and_batch_bundle)[0] + se = make_serialized_item(self) + serial_no = get_serial_nos_from_bundle(se.get("items")[0].serial_and_batch_bundle)[0] - dn = create_delivery_note(item_code="_Test Serialized Item With Series", serial_no=[serial_no]) - delivered_serial_no = get_serial_nos_from_bundle(dn.get("items")[0].serial_and_batch_bundle)[0] + dn = create_delivery_note(item_code="_Test Serialized Item With Series", serial_no=[serial_no]) + delivered_serial_no = get_serial_nos_from_bundle(dn.get("items")[0].serial_and_batch_bundle)[0] - self.assertEqual(serial_no, delivered_serial_no) + self.assertEqual(serial_no, delivered_serial_no) - init_user_and_profile() + init_user_and_profile() - pos_inv = create_pos_invoice( - item_code="_Test Serialized Item With Series", - serial_no=[serial_no], - qty=1, - rate=100, - do_not_submit=True, - ignore_sabb_validation=True, - ) + pos_inv = create_pos_invoice( + item_code="_Test Serialized Item With Series", + serial_no=[serial_no], + qty=1, + rate=100, + do_not_submit=True, + ignore_sabb_validation=True, + ) - self.assertRaises(frappe.ValidationError, pos_inv.submit) - - finally: - frappe.db.rollback(save_point="before_test_delivered_serial_no_case") - frappe.set_user("Administrator") + self.assertRaises(frappe.ValidationError, pos_inv.submit) def test_bundle_stock_availability_validation(self): from erpnext.accounts.doctype.pos_invoice.pos_invoice import ProductBundleStockValidationError diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index ae61bc6c522..fe467b7d52b 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -145,13 +145,6 @@ class ERPNextTestSuite(unittest.TestCase): records = load_test_records_for(doctype) cls.globalTestRecords[doctype] = records[doctype] - @classmethod - def truncate_make_item_price(cls, record): - frappe.db.truncate("Item Price") - item_price = frappe.get_doc(record) - item_price.insert() - return item_price - @classmethod def make_presets(cls): from frappe.desk.page.setup_wizard.install_fixtures import update_genders, update_salutations From 478473a295c00ee9e74464b08240deb10a8f8174 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 15 Nov 2025 15:00:48 +0530 Subject: [PATCH 088/217] refactor(test): better setup for loyalty point and POS Invoice --- .../test_loyalty_point_entry.py | 2 - .../loyalty_program/test_loyalty_program.py | 99 ----------- .../doctype/pos_invoice/test_pos_invoice.py | 2 - erpnext/tests/utils.py | 156 +++++++++++++++++- 4 files changed, 155 insertions(+), 104 deletions(-) diff --git a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py index d6abfa08b4f..c8f739f42a5 100644 --- a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py +++ b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py @@ -5,7 +5,6 @@ import unittest import frappe from frappe.utils import today -from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.tests.utils import ERPNextTestSuite @@ -15,7 +14,6 @@ class TestLoyaltyPointEntry(ERPNextTestSuite): def setUpClass(cls): super().setUpClass() # Create test records - create_records() cls.loyalty_program_name = "Test Single Loyalty" cls.customer_name = "Test Loyalty Customer" customer = frappe.get_doc("Customer", cls.customer_name) diff --git a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py index 970b3180efc..28731e4db51 100644 --- a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py +++ b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py @@ -14,12 +14,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestLoyaltyProgram(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - # create relevant item, customer, loyalty program, etc - create_records() - def test_loyalty_points_earned_single_tier(self): frappe.db.set_value("Customer", "Test Loyalty Customer", "loyalty_program", "Test Single Loyalty") # create a new sales invoice @@ -323,96 +317,3 @@ def create_sales_invoice_record(qty=1): ], } ) - - -def create_records(): - # create a new loyalty Account - if not frappe.db.exists("Account", "Loyalty - _TC"): - frappe.get_doc( - { - "doctype": "Account", - "account_name": "Loyalty", - "parent_account": "Direct Expenses - _TC", - "company": "_Test Company", - "is_group": 0, - "account_type": "Expense Account", - } - ).insert() - - # create a new loyalty program Single tier - if not frappe.db.exists("Loyalty Program", "Test Single Loyalty"): - frappe.get_doc( - { - "doctype": "Loyalty Program", - "loyalty_program_name": "Test Single Loyalty", - "auto_opt_in": 1, - "from_date": today(), - "loyalty_program_type": "Single Tier Program", - "conversion_factor": 1, - "expiry_duration": 10, - "company": "_Test Company", - "cost_center": "Main - _TC", - "expense_account": "Loyalty - _TC", - "collection_rules": [{"tier_name": "Bronce", "collection_factor": 1000, "min_spent": 0}], - } - ).insert() - - # create a new customer - if not frappe.db.exists("Customer", "Test Loyalty Customer"): - frappe.get_doc( - { - "customer_group": "_Test Customer Group", - "customer_name": "Test Loyalty Customer", - "customer_type": "Individual", - "doctype": "Customer", - "territory": "_Test Territory", - } - ).insert() - - # create a new loyalty program Multiple tier - if not frappe.db.exists("Loyalty Program", "Test Multiple Loyalty"): - frappe.get_doc( - { - "doctype": "Loyalty Program", - "loyalty_program_name": "Test Multiple Loyalty", - "auto_opt_in": 1, - "from_date": today(), - "loyalty_program_type": "Multiple Tier Program", - "conversion_factor": 1, - "expiry_duration": 10, - "company": "_Test Company", - "cost_center": "Main - _TC", - "expense_account": "Loyalty - _TC", - "collection_rules": [ - {"tier_name": "Bronze", "collection_factor": 1000, "min_spent": 0}, - {"tier_name": "Silver", "collection_factor": 1000, "min_spent": 10000}, - {"tier_name": "Gold", "collection_factor": 1000, "min_spent": 19000}, - ], - } - ).insert() - - # create an item - if not frappe.db.exists("Item", "Loyal Item"): - frappe.get_doc( - { - "doctype": "Item", - "item_code": "Loyal Item", - "item_name": "Loyal Item", - "item_group": "All Item Groups", - "company": "_Test Company", - "is_stock_item": 1, - "opening_stock": 100, - "valuation_rate": 10000, - } - ).insert() - - # create item price - if not frappe.db.exists("Item Price", {"price_list": "Standard Selling", "item_code": "Loyal Item"}): - frappe.get_doc( - { - "doctype": "Item Price", - "price_list": "Standard Selling", - "item_code": "Loyal Item", - "price_list_rate": 10000, - } - ).insert() diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 36b086695db..37c176f8bd1 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -640,9 +640,7 @@ class TestPOSInvoice(ERPNextTestSuite): from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( get_loyalty_program_details_with_points, ) - from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records - create_records() frappe.db.set_value("Customer", "Test Loyalty Customer", "loyalty_program", "Test Single Loyalty") before_lp_details = get_loyalty_program_details_with_points( "Test Loyalty Customer", company="_Test Company", loyalty_program="Test Single Loyalty" diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index fe467b7d52b..7102c313eb1 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -9,7 +9,7 @@ import frappe from frappe import _ from frappe.core.doctype.report.report import get_report_module_dotted_path from frappe.tests.utils import load_test_records_for -from frappe.utils import now_datetime +from frappe.utils import now_datetime, today ReportFilters = dict[str, Any] ReportName = NewType("ReportName", str) @@ -235,6 +235,8 @@ class ERPNextTestSuite(unittest.TestCase): cls._make_item() cls.make_location() cls.make_price_list() + cls.make_item_price() + cls.make_loyalty_program() cls.make_shareholder() cls.make_sales_taxes_template() cls.update_selling_settings() @@ -2136,6 +2138,17 @@ class ERPNextTestSuite(unittest.TestCase): "asset_naming_series": "ABC.###", "stock_uom": "_Test UOM", }, + { + "doctype": "Item", + "item_code": "Loyal Item", + "item_name": "Loyal Item", + "item_group": "All Item Groups", + "company": "_Test Company", + "is_stock_item": 1, + "opening_stock": 100, + "valuation_rate": 10000, + "stock_uom": "_Test UOM", + }, ] cls.item = [] for x in records: @@ -2190,6 +2203,8 @@ class ERPNextTestSuite(unittest.TestCase): ["_Test Payable", "Current Liabilities", 0, "Payable", None], ["_Test Receivable USD", "Current Assets", 0, "Receivable", "USD"], ["_Test Payable USD", "Current Liabilities", 0, "Payable", "USD"], + # Loyalty Account + ["Loyalty", "Direct Expenses", 0, "Expense Account", None], ] cls.test_accounts = [] @@ -2280,6 +2295,13 @@ class ERPNextTestSuite(unittest.TestCase): "territory": "_Test Territory", "tax_category": "_Test Tax Category 1", }, + { + "customer_group": "_Test Customer Group", + "customer_name": "Test Loyalty Customer", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, ] cls.customer = [] for x in records: @@ -2632,6 +2654,138 @@ class ERPNextTestSuite(unittest.TestCase): frappe.get_doc("Activity Type", {"activity_type": x.get("activity_type")}) ) + @classmethod + def make_loyalty_program(cls): + records = [ + { + "doctype": "Loyalty Program", + "loyalty_program_name": "Test Single Loyalty", + "auto_opt_in": 1, + "from_date": today(), + "loyalty_program_type": "Single Tier Program", + "conversion_factor": 1, + "expiry_duration": 10, + "company": "_Test Company", + "cost_center": "Main - _TC", + "expense_account": "Loyalty - _TC", + "collection_rules": [{"tier_name": "Bronce", "collection_factor": 1000, "min_spent": 0}], + }, + { + "doctype": "Loyalty Program", + "loyalty_program_name": "Test Multiple Loyalty", + "auto_opt_in": 1, + "from_date": today(), + "loyalty_program_type": "Multiple Tier Program", + "conversion_factor": 1, + "expiry_duration": 10, + "company": "_Test Company", + "cost_center": "Main - _TC", + "expense_account": "Loyalty - _TC", + "collection_rules": [ + {"tier_name": "Bronze", "collection_factor": 1000, "min_spent": 0}, + {"tier_name": "Silver", "collection_factor": 1000, "min_spent": 10000}, + {"tier_name": "Gold", "collection_factor": 1000, "min_spent": 19000}, + ], + }, + ] + cls.loyalty_program = [] + for x in records: + if not frappe.db.exists( + "Loyalty Program", {"loyalty_program_name": x.get("loyalty_program_name")} + ): + cls.loyalty_program.append(frappe.get_doc(x).insert()) + else: + cls.loyalty_program.append( + frappe.get_doc("Loyalty Program", {"loyalty_program_name": x.get("loyalty_program_name")}) + ) + + @classmethod + def make_item_price(cls): + records = [ + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Price List", + "price_list_rate": 100, + "valid_from": "2017-04-18", + "valid_upto": "2017-04-26", + }, + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Price List Rest of the World", + "price_list_rate": 10, + }, + { + "doctype": "Item Price", + "item_code": "_Test Item 2", + "price_list": "_Test Price List Rest of the World", + "price_list_rate": 20, + "valid_from": "2017-04-18", + "valid_upto": "2017-04-26", + "customer": "_Test Customer", + "uom": "_Test UOM", + }, + { + "doctype": "Item Price", + "item_code": "_Test Item Home Desktop 100", + "price_list": "_Test Price List", + "price_list_rate": 1000, + "valid_from": "2017-04-10", + "valid_upto": "2017-04-17", + }, + { + "doctype": "Item Price", + "item_code": "_Test Item Home Desktop Manufactured", + "price_list": "_Test Price List", + "price_list_rate": 1000, + "valid_from": "2017-04-10", + "valid_upto": "2017-04-17", + }, + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Buying Price List", + "price_list_rate": 100, + "supplier": "_Test Supplier", + }, + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Selling Price List", + "price_list_rate": 200, + "customer": "_Test Customer", + }, + { + "doctype": "Item Price", + "price_list": _("Standard Selling"), + "item_code": "Loyal Item", + "price_list_rate": 10000, + }, + ] + cls.item_price = [] + for x in records: + if not frappe.db.exists( + "Item Price", + { + "item_code": x.get("item_code"), + "price_list": x.get("price_list"), + "price_list_rate": x.get("price_list_rate"), + }, + ): + cls.item_price.append(frappe.get_doc(x).insert()) + else: + cls.item_price.append( + frappe.get_doc( + "Item Price", + { + "item_code": x.get("item_code"), + "price_list": x.get("price_list"), + "price_list_rate": x.get("price_list_rate"), + }, + ) + ) + @contextmanager def set_user(self, user: str): try: From ad8d8e6541f44bd2cb4230ddb859624c455dfb7b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 20 Nov 2025 12:00:05 +0530 Subject: [PATCH 089/217] refactor(test): make pos invoice deterministic --- .../doctype/pos_invoice/test_pos_invoice.py | 142 ++------------- .../pos_invoice/test_pos_invoice_merge.py | 168 ++++++++++++++++++ .../pos_invoice_merge_log.py | 2 +- 3 files changed, 179 insertions(+), 133 deletions(-) create mode 100644 erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 37c176f8bd1..0868d4a8d99 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -24,7 +24,7 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.tests.utils import ERPNextTestSuite -class TestPOSInvoice(ERPNextTestSuite): +class POSInvoiceTestMixin(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -43,15 +43,20 @@ class TestPOSInvoice(ERPNextTestSuite): make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item", qty=800, basic_rate=100) frappe.db.sql("delete from `tabTax Rule`") - from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry - - self.opening_entry = create_opening_entry(self.pos_profile, self.test_user.name) mode_of_payment = frappe.get_doc("Mode of Payment", "Bank Draft") set_default_account_for_mode_of_payment(mode_of_payment, "_Test Company", "_Test Bank - _TC") def tearDown(self): frappe.db.rollback() + +class TestPOSInvoice(POSInvoiceTestMixin): + def setUp(self): + super().setUp() + from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry + + self.opening_entry = create_opening_entry(self.pos_profile, self.test_user.name) + def test_timestamp_change(self): w = create_pos_invoice(do_not_save=1) w.docstatus = 0 @@ -677,6 +682,7 @@ class TestPOSInvoice(ERPNextTestSuite): get_loyalty_program_details_with_points, ) + frappe.db.set_value("Customer", "Test Loyalty Customer", "loyalty_program", "Test Single Loyalty") # add 10 loyalty points pos_inv = create_pos_invoice(customer="Test Loyalty Customer", rate=10000, do_not_save=1) pos_inv.append( @@ -706,134 +712,6 @@ class TestPOSInvoice(ERPNextTestSuite): ) self.assertEqual(after_redeem_lp_details.loyalty_points, 9) - def test_merging_into_sales_invoice_with_discount(self): - from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import ( - init_user_and_profile, - ) - from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import ( - consolidate_pos_invoices, - ) - - frappe.db.sql("delete from `tabPOS Invoice`") - test_user, pos_profile = init_user_and_profile() - pos_inv = create_pos_invoice(rate=300, additional_discount_percentage=10, do_not_submit=1) - pos_inv.append("payments", {"mode_of_payment": "Cash", "amount": 270}) - pos_inv.save() - pos_inv.submit() - - pos_inv2 = create_pos_invoice(rate=3200, do_not_submit=1) - pos_inv2.append("payments", {"mode_of_payment": "Cash", "amount": 3200}) - pos_inv2.save() - pos_inv2.submit() - - consolidate_pos_invoices() - - pos_inv.load_from_db() - rounded_total = frappe.db.get_value("Sales Invoice", pos_inv.consolidated_invoice, "rounded_total") - self.assertEqual(rounded_total, 3470) - - def test_merging_into_sales_invoice_with_discount_and_inclusive_tax(self): - from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import ( - init_user_and_profile, - ) - from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import ( - consolidate_pos_invoices, - ) - - frappe.db.sql("delete from `tabPOS Invoice`") - test_user, pos_profile = init_user_and_profile() - pos_inv = create_pos_invoice(rate=300, do_not_submit=1) - pos_inv.append("payments", {"mode_of_payment": "Cash", "amount": 300}) - pos_inv.append( - "taxes", - { - "charge_type": "On Net Total", - "account_head": "_Test Account Service Tax - _TC", - "cost_center": "_Test Cost Center - _TC", - "description": "Service Tax", - "rate": 14, - "included_in_print_rate": 1, - }, - ) - pos_inv.save() - pos_inv.submit() - - pos_inv2 = create_pos_invoice(rate=300, qty=2, do_not_submit=1) - pos_inv2.additional_discount_percentage = 10 - pos_inv2.append("payments", {"mode_of_payment": "Cash", "amount": 540}) - pos_inv2.append( - "taxes", - { - "charge_type": "On Net Total", - "account_head": "_Test Account Service Tax - _TC", - "cost_center": "_Test Cost Center - _TC", - "description": "Service Tax", - "rate": 14, - "included_in_print_rate": 1, - }, - ) - pos_inv2.save() - pos_inv2.submit() - - consolidate_pos_invoices() - - pos_inv.load_from_db() - rounded_total = frappe.db.get_value("Sales Invoice", pos_inv.consolidated_invoice, "rounded_total") - self.assertEqual(rounded_total, 840) - - def test_merging_with_validate_selling_price(self): - from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import ( - init_user_and_profile, - ) - from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import ( - consolidate_pos_invoices, - ) - - if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"): - frappe.db.set_single_value("Selling Settings", "validate_selling_price", 1) - - item = "Test Selling Price Validation" - make_item(item, {"is_stock_item": 1}) - make_purchase_receipt(item_code=item, warehouse="_Test Warehouse - _TC", qty=1, rate=300) - frappe.db.sql("delete from `tabPOS Invoice`") - test_user, pos_profile = init_user_and_profile() - pos_inv = create_pos_invoice(item=item, rate=300, do_not_submit=1) - pos_inv.append("payments", {"mode_of_payment": "Cash", "amount": 300}) - pos_inv.append( - "taxes", - { - "charge_type": "On Net Total", - "account_head": "_Test Account Service Tax - _TC", - "cost_center": "_Test Cost Center - _TC", - "description": "Service Tax", - "rate": 14, - "included_in_print_rate": 1, - }, - ) - self.assertRaises(frappe.ValidationError, pos_inv.submit) - - pos_inv2 = create_pos_invoice(item=item, rate=400, do_not_submit=1) - pos_inv2.append("payments", {"mode_of_payment": "Cash", "amount": 400}) - pos_inv2.append( - "taxes", - { - "charge_type": "On Net Total", - "account_head": "_Test Account Service Tax - _TC", - "cost_center": "_Test Cost Center - _TC", - "description": "Service Tax", - "rate": 14, - "included_in_print_rate": 1, - }, - ) - pos_inv2.save() - pos_inv2.submit() - - consolidate_pos_invoices() - - pos_inv2.load_from_db() - rounded_total = frappe.db.get_value("Sales Invoice", pos_inv2.consolidated_invoice, "rounded_total") - self.assertEqual(rounded_total, 400) - def test_pos_batch_reservation(self): from erpnext.stock.doctype.serial_and_batch_bundle.serial_and_batch_bundle import ( get_auto_batch_nos, diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py new file mode 100644 index 00000000000..f9630dcd15d --- /dev/null +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py @@ -0,0 +1,168 @@ +# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +import frappe + +from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import POSInvoiceTestMixin, create_pos_invoice +from erpnext.stock.doctype.item.test_item import make_item +from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite + + +class TestPOSInvoiceMerging(POSInvoiceTestMixin): + def clear_pos_data(self): + frappe.db.sql("delete from `tabPOS Opening Entry`;") + frappe.db.sql("delete from `tabPOS Closing Entry`;") + frappe.db.sql("delete from `tabPOS Invoice`;") + + def setUp(self): + self.clear_pos_data() + super().setUp() + + from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry + + self.opening_entry = create_opening_entry(self.pos_profile, self.test_user.name) + + def tearDown(self): + self.clear_pos_data() + frappe.db.commit() + + def test_merging_into_sales_invoice_with_discount(self): + from erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry import ( + make_closing_entry_from_opening, + ) + from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import ( + init_user_and_profile, + ) + from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import ( + consolidate_pos_invoices, + ) + + frappe.db.sql("delete from `tabPOS Invoice`") + test_user, pos_profile = init_user_and_profile() + pos_inv = create_pos_invoice(rate=300, additional_discount_percentage=10, do_not_submit=1) + pos_inv.append("payments", {"mode_of_payment": "Cash", "amount": 270}) + pos_inv.save() + pos_inv.submit() + + pos_inv2 = create_pos_invoice(rate=3200, do_not_submit=1) + pos_inv2.append("payments", {"mode_of_payment": "Cash", "amount": 3200}) + pos_inv2.save() + pos_inv2.submit() + + closing_entry = make_closing_entry_from_opening(self.opening_entry) + consolidate_pos_invoices(closing_entry=closing_entry) # does DB commit + + pos_inv.load_from_db() + rounded_total = frappe.db.get_value("Sales Invoice", pos_inv.consolidated_invoice, "rounded_total") + self.assertEqual(rounded_total, 3470) + + def test_merging_into_sales_invoice_with_discount_and_inclusive_tax(self): + from erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry import ( + make_closing_entry_from_opening, + ) + from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import ( + init_user_and_profile, + ) + from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import ( + consolidate_pos_invoices, + ) + + frappe.db.sql("delete from `tabPOS Invoice`") + test_user, pos_profile = init_user_and_profile() + pos_inv = create_pos_invoice(rate=300, do_not_submit=1) + pos_inv.append("payments", {"mode_of_payment": "Cash", "amount": 300}) + pos_inv.append( + "taxes", + { + "charge_type": "On Net Total", + "account_head": "_Test Account Service Tax - _TC", + "cost_center": "_Test Cost Center - _TC", + "description": "Service Tax", + "rate": 14, + "included_in_print_rate": 1, + }, + ) + pos_inv.save() + pos_inv.submit() + + pos_inv2 = create_pos_invoice(rate=300, qty=2, do_not_submit=1) + pos_inv2.additional_discount_percentage = 10 + pos_inv2.append("payments", {"mode_of_payment": "Cash", "amount": 540}) + pos_inv2.append( + "taxes", + { + "charge_type": "On Net Total", + "account_head": "_Test Account Service Tax - _TC", + "cost_center": "_Test Cost Center - _TC", + "description": "Service Tax", + "rate": 14, + "included_in_print_rate": 1, + }, + ) + pos_inv2.save() + pos_inv2.submit() + + self.closing_entry = make_closing_entry_from_opening(self.opening_entry) + consolidate_pos_invoices(closing_entry=self.closing_entry) # does DB commit + + pos_inv.load_from_db() + rounded_total = frappe.db.get_value("Sales Invoice", pos_inv.consolidated_invoice, "rounded_total") + self.assertEqual(rounded_total, 840) + + def test_merging_with_validate_selling_price(self): + from erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry import ( + make_closing_entry_from_opening, + ) + from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import ( + init_user_and_profile, + ) + from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import ( + consolidate_pos_invoices, + ) + + if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"): + frappe.db.set_single_value("Selling Settings", "validate_selling_price", 1) + + item = "Test Selling Price Validation" + make_item(item, {"is_stock_item": 1}) + make_purchase_receipt(item_code=item, warehouse="_Test Warehouse - _TC", qty=1, rate=300) + frappe.db.sql("delete from `tabPOS Invoice`") + test_user, pos_profile = init_user_and_profile() + pos_inv = create_pos_invoice(item=item, rate=300, do_not_submit=1) + pos_inv.append("payments", {"mode_of_payment": "Cash", "amount": 300}) + pos_inv.append( + "taxes", + { + "charge_type": "On Net Total", + "account_head": "_Test Account Service Tax - _TC", + "cost_center": "_Test Cost Center - _TC", + "description": "Service Tax", + "rate": 14, + "included_in_print_rate": 1, + }, + ) + self.assertRaises(frappe.ValidationError, pos_inv.submit) + + pos_inv2 = create_pos_invoice(item=item, rate=400, do_not_submit=1) + pos_inv2.append("payments", {"mode_of_payment": "Cash", "amount": 400}) + pos_inv2.append( + "taxes", + { + "charge_type": "On Net Total", + "account_head": "_Test Account Service Tax - _TC", + "cost_center": "_Test Cost Center - _TC", + "description": "Service Tax", + "rate": 14, + "included_in_print_rate": 1, + }, + ) + pos_inv2.save() + pos_inv2.submit() + + self.closing_entry = make_closing_entry_from_opening(self.opening_entry) + consolidate_pos_invoices(closing_entry=self.closing_entry) # does DB commit + + pos_inv2.load_from_db() + rounded_total = frappe.db.get_value("Sales Invoice", pos_inv2.consolidated_invoice, "rounded_total") + self.assertEqual(rounded_total, 400) diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py index 0874955ec47..a1b0ecefa38 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py @@ -283,7 +283,7 @@ class POSInvoiceMergeLog(Document): base_rounding_adjustment += doc.base_rounding_adjustment base_rounded_total += doc.base_rounded_total - for d in doc.get("item_wise_tax_details"): + for d in doc.get("item_wise_tax_details") or []: row = frappe._dict( item=old_new_item_map[d.item_row], tax=old_new_tax_map[d.tax_row], From ef3736e582b2248f264cd71ba5530b31f84ada05 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 20 Nov 2025 17:49:57 +0530 Subject: [PATCH 090/217] refactor(test): make sales invoice deterministic --- .../doctype/sales_invoice/test_sales_invoice.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 9e4d5a92c1c..3c3e6af23cf 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -64,6 +64,7 @@ class TestSalesInvoice(ERPNextTestSuite): ) for company in frappe.get_all("Company", pluck="name"): frappe.db.set_value("Company", company, "accounts_frozen_till_date", None) + frappe.db.set_single_value("Selling Settings", "validate_selling_price", 0) @ERPNextTestSuite.change_settings( "Accounts Settings", @@ -2132,6 +2133,7 @@ class TestSalesInvoice(ERPNextTestSuite): si.insert() return si + @ERPNextTestSuite.change_settings("Selling Settings", {"sales_update_frequency": "Each Transaction"}) def test_company_monthly_sales(self): existing_current_month_sales = frappe.get_cached_value( "Company", "_Test Company", "total_monthly_sales" @@ -3452,7 +3454,6 @@ class TestSalesInvoice(ERPNextTestSuite): si.commission_rate = commission_rate self.assertRaises(frappe.ValidationError, si.save) - @ERPNextTestSuite.change_settings("Accounts Settings", {"acc_frozen_upto": add_days(getdate(), 1)}) def test_sales_invoice_submission_post_account_freezing_date(self): frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", add_days(getdate(), 1)) si = create_sales_invoice(do_not_save=True) @@ -3887,19 +3888,18 @@ class TestSalesInvoice(ERPNextTestSuite): def test_loyalty_points_redemption_with_shopping_cart(self): from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import ( - create_records, create_sales_invoice_record, ) from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order # Set up loyalty program - create_records() - frappe.db.set_value("Customer", "Test Loyalty Customer", "loyalty_program", "Test Single Loyalty") + loyalty_customer = frappe.get_doc("Customer", {"customer_name": "Test Loyalty Customer"}).name + frappe.db.set_value("Customer", loyalty_customer, "loyalty_program", "Test Single Loyalty") create_sales_invoice_record(10).insert().submit() # Create a sales order - so = make_sales_order(qty=10, do_not_save=True, customer="Test Loyalty Customer") + so = make_sales_order(qty=10, do_not_save=True, customer=loyalty_customer) so.name = "_T-Sales Order LP-0001" so.order_type = "Shopping Cart" so.loyalty_points = 50 @@ -4397,6 +4397,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertTrue(all([x == "Credit Note" for x in gl_entries])) + @ERPNextTestSuite.change_settings("Selling Settings", {"sales_update_frequency": "Each Transaction"}) def test_total_billed_amount(self): si = create_sales_invoice(do_not_submit=True) @@ -4413,6 +4414,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(doc.total_billed_amount, si.grand_total) @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) + @ERPNextTestSuite.change_settings("Selling Settings", {"sales_update_frequency": "Each Transaction"}) def test_total_billed_amount_with_different_projects(self): # This test case is for checking the scenario where project is set at document level and for **some** child items only, not all from copy import copy From 985ab09309d5982d4863d01443c7024e55d8fc21 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 21 Nov 2025 11:23:33 +0530 Subject: [PATCH 091/217] refactor(test): make financial reports deterministic --- .../test_financial_report_engine.py | 6 ------ .../test_financial_report_template.py | 17 +++-------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/erpnext/accounts/doctype/financial_report_template/test_financial_report_engine.py b/erpnext/accounts/doctype/financial_report_template/test_financial_report_engine.py index dcfe884bdf3..a23c6bb6883 100644 --- a/erpnext/accounts/doctype/financial_report_template/test_financial_report_engine.py +++ b/erpnext/accounts/doctype/financial_report_template/test_financial_report_engine.py @@ -19,12 +19,6 @@ from erpnext.accounts.doctype.financial_report_template.test_financial_report_te from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry from erpnext.accounts.utils import get_currency_precision, get_fiscal_year -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] - class TestDependencyResolver(FinancialReportTemplateTestCase): """Test cases for DependencyResolver class""" diff --git a/erpnext/accounts/doctype/financial_report_template/test_financial_report_template.py b/erpnext/accounts/doctype/financial_report_template/test_financial_report_template.py index ef5404bd478..2f3bbb36837 100644 --- a/erpnext/accounts/doctype/financial_report_template/test_financial_report_template.py +++ b/erpnext/accounts/doctype/financial_report_template/test_financial_report_template.py @@ -2,28 +2,17 @@ # For license information, please see license.txt import frappe -from frappe.tests import IntegrationTestCase -from frappe.tests.utils import make_test_records -# On IntegrationTestCase, the doctype test records and all -# link-field test record dependencies are recursively loaded -# Use these module variables to add/remove to/from that list -EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] -IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] +from erpnext.tests.utils import ERPNextTestSuite -class TestFinancialReportTemplate(IntegrationTestCase): - pass - - -class FinancialReportTemplateTestCase(IntegrationTestCase): +class FinancialReportTemplateTestCase(ERPNextTestSuite): """Utility class with common setup and helper methods for all test classes""" @classmethod def setUpClass(cls): """Set up test data""" - make_test_records("Company") - make_test_records("Fiscal Year") + super().setUpClass() cls.create_test_template() @classmethod From bc82e67f2745101605771726a1bf723279966c0a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 21 Nov 2025 12:39:03 +0530 Subject: [PATCH 092/217] refactor(test): make plaid settings deterministic --- .../doctype/plaid_settings/test_plaid_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py index 4e3f3056629..7204de45810 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py @@ -69,7 +69,7 @@ class TestPlaidSettings(ERPNextTestSuite): } bank = json.dumps(frappe.get_doc("Bank", "Citi").as_dict(), default=json_handler) - company = frappe.db.get_single_value("Global Defaults", "default_company") + company = self.companies[0].name add_bank_accounts(bank_accounts, bank, company) From 6a16c76bbc365ae829f6f073b53eb645fad5ef5f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 21 Nov 2025 13:44:31 +0530 Subject: [PATCH 093/217] refactor(test): make bom update tool tests deterministic --- erpnext/manufacturing/doctype/bom/test_bom.py | 5 ++ .../bom_update_log/test_bom_update_log.py | 5 ++ .../bom_update_tool/test_bom_update_tool.py | 5 ++ .../doctype/job_card/test_job_card.py | 3 + erpnext/tests/utils.py | 59 ++++++++++++++++++- 5 files changed, 74 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index 4c7ab8dc7ca..e96bc359aa0 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -24,6 +24,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestBOM(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("BOM") + @timeout def test_get_items(self): from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict diff --git a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py index 4d60506ca5e..82b9cff138e 100644 --- a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py +++ b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py @@ -17,6 +17,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestBOMUpdateLog(ERPNextTestSuite): "Test BOM Update Tool Operations via BOM Update Log." + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("BOM") + def setUp(self): bom_doc = frappe.copy_doc(self.globalTestRecords["BOM"][0]) bom_doc.items[1].item_code = "_Test Item" diff --git a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py index eec6db620da..e0750e58842 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py @@ -16,6 +16,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestBOMUpdateTool(ERPNextTestSuite): "Test major functions run via BOM Update Tool." + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("BOM") + def tearDown(self): frappe.db.rollback() diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index d44f6a0d9e5..5eed47685db 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -30,6 +30,9 @@ class TestJobCard(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() + # used in job card time log + cls.make_employees() + cls.load_test_records("BOM") def setUp(self): self.make_employees() # used in job card time log diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 7102c313eb1..18a7be0510c 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -132,13 +132,13 @@ class ERPNextTestSuite(unittest.TestCase): @classmethod def setUpClass(cls): - cls.make_presets() - cls.make_persistent_master_data() - # initilize global test records attribute if not hasattr(cls, "globalTestRecords"): cls.globalTestRecords = {} + cls.make_presets() + cls.make_persistent_master_data() + @classmethod def load_test_records(cls, doctype): if doctype not in cls.globalTestRecords: @@ -239,6 +239,9 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_loyalty_program() cls.make_shareholder() cls.make_sales_taxes_template() + cls.make_workstation() + cls.make_operation() + cls.make_bom() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() @@ -2786,6 +2789,56 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_operation(cls): + records = [ + {"doctype": "Operation", "name": "_Test Operation 1", "workstation": "_Test Workstation 1"} + ] + cls.operation = [] + for x in records: + if not frappe.db.exists("Operation", {"name": x.get("name")}): + cls.operation.append(frappe.get_doc(x).insert()) + else: + cls.operation.append(frappe.get_doc("Operation", {"name": x.get("name")})) + + @classmethod + def make_workstation(cls): + records = [ + { + "doctype": "Workstation", + "name": "_Test Workstation 1", + "workstation_name": "_Test Workstation 1", + "warehouse": "_Test warehouse - _TC", + "hour_rate_labour": 25, + "hour_rate_electricity": 25, + "hour_rate_consumable": 25, + "hour_rate_rent": 25, + "holiday_list": "_Test Holiday List", + "working_hours": [{"start_time": "10:00:00", "end_time": "20:00:00"}], + } + ] + cls.workstation = [] + for x in records: + if not frappe.db.exists("Workstation", {"workstation_name": x.get("workstation_name")}): + cls.workstation.append(frappe.get_doc(x).insert()) + else: + cls.workstation.append( + frappe.get_doc("Workstation", {"workstation_name": x.get("workstation_name")}) + ) + + @classmethod + def make_bom(cls): + # TODO: replace JSON source with hardcoded data in py + cls.load_test_records("BOM") + records = cls.globalTestRecords["BOM"] + cls.bom = [] + for x in records: + x["company"] = cls.companies[0].name + if not frappe.db.exists("BOM", {"item": x.get("item"), "company": x.get("company")}): + cls.bom.append(frappe.get_doc(x).insert()) + else: + cls.bom.append(frappe.get_doc("BOM", {"item": x.get("item"), "company": x.get("company")})) + @contextmanager def set_user(self, user: str): try: From 3ea14fc9be1339d041f3499b3f6d707f711d1848 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 29 Nov 2025 12:33:23 +0530 Subject: [PATCH 094/217] refactor(test): make bom tests deterministic --- erpnext/manufacturing/doctype/bom/test_bom.py | 5 +++ erpnext/tests/utils.py | 44 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index e96bc359aa0..a0e6bde20e5 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -394,6 +394,7 @@ class TestBOM(ERPNextTestSuite): item_code = make_item(properties={"is_stock_item": 1}).name bom = frappe.new_doc("BOM") + bom.company = self.companies[0].name bom.item = item_code bom.append("items", frappe._dict(item_code=item_code)) bom.save() @@ -407,11 +408,13 @@ class TestBOM(ERPNextTestSuite): item2 = make_item(properties={"is_stock_item": 1}).name bom1 = frappe.new_doc("BOM") + bom1.company = self.companies[0].name bom1.item = item1 bom1.append("items", frappe._dict(item_code=item2)) bom1.save() bom2 = frappe.new_doc("BOM") + bom2.company = self.companies[0].name bom2.item = item2 bom2.append("items", frappe._dict(item_code=item1)) bom2.save() @@ -569,6 +572,7 @@ class TestBOM(ERPNextTestSuite): @timeout def test_clear_inpection_quality(self): bom = frappe.copy_doc(self.globalTestRecords["BOM"][2], ignore_no_copy=True) + bom.company = self.companies[0].name bom.docstatus = 0 bom.is_default = 0 bom.quality_inspection_template = "_Test Quality Inspection Template" @@ -614,6 +618,7 @@ class TestBOM(ERPNextTestSuite): # Step 1: Create BOM bom = frappe.new_doc("BOM") + bom.company = self.companies[0].name bom.item = fg_item.item_code bom.quantity = 1 bom.append( diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 18a7be0510c..062c18d12d2 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -242,6 +242,8 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_workstation() cls.make_operation() cls.make_bom() + cls.make_quality_inspection_param() + cls.make_quality_inspection_template() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() @@ -2839,6 +2841,48 @@ class ERPNextTestSuite(unittest.TestCase): else: cls.bom.append(frappe.get_doc("BOM", {"item": x.get("item"), "company": x.get("company")})) + @classmethod + def make_quality_inspection_param(cls): + records = [{"doctype": "Quality Inspection Parameter", "parameter": "_Test Param"}] + cls.quality_inspection_param = [] + for x in records: + if not frappe.db.exists("Quality Inspection Parameter", {"parameter": x.get("parameter")}): + cls.quality_inspection_param.append(frappe.get_doc(x).insert()) + else: + cls.quality_inspection_param.append( + frappe.get_doc("Quality Inspection Parameter", {"parameter": x.get("parameter")}) + ) + + @classmethod + def make_quality_inspection_template(cls): + records = [ + { + "quality_inspection_template_name": "_Test Quality Inspection Template", + "doctype": "Quality Inspection Template", + "item_quality_inspection_parameter": [ + { + "specification": cls.quality_inspection_param[0].name, + "doctype": "Item Quality Inspection Parameter", + "parentfield": "item_quality_inspection_parameter", + } + ], + } + ] + cls.quality_inspection_template = [] + for x in records: + if not frappe.db.exists( + "Quality Inspection Template", + {"quality_inspection_template_name": x.get("quality_inspection_template_name")}, + ): + cls.quality_inspection_template.append(frappe.get_doc(x).insert()) + else: + cls.quality_inspection_template.append( + frappe.get_doc( + "Quality Inspection Template", + {"quality_inspection_template_name": x.get("quality_inspection_template_name")}, + ) + ) + @contextmanager def set_user(self, user: str): try: From 45319020247377eee58ad60a499ca3b5d13d79f2 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 29 Nov 2025 12:49:03 +0530 Subject: [PATCH 095/217] refactor(test): make job card tests deterministic --- erpnext/manufacturing/doctype/job_card/test_job_card.py | 2 -- erpnext/tests/utils.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 5eed47685db..555e428c8d8 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -30,8 +30,6 @@ class TestJobCard(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() - # used in job card time log - cls.make_employees() cls.load_test_records("BOM") def setUp(self): diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 062c18d12d2..256ec6d580a 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -244,6 +244,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_bom() cls.make_quality_inspection_param() cls.make_quality_inspection_template() + cls.make_employees() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() From 6b5f39d41bdbc110d667cd10e0eacdaa3606d472 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 29 Nov 2025 16:52:45 +0530 Subject: [PATCH 096/217] refactor(test): make production plan deterministic --- .../doctype/production_plan/test_production_plan.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index ba51ba5c5d0..716a59e8148 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -549,7 +549,9 @@ class TestProductionPlan(ERPNextTestSuite): make_rm_stock_entry(sco.name) scr = make_subcontracting_receipt(sco.name) scr.submit() - scr_make_purchase_receipt(scr.name).submit() + doc = scr_make_purchase_receipt(scr.name) + doc.currency = "INR" + doc.submit() fg_item = "Test Motherboard 1" bom_tree_1 = {"Test Laptop 1": {fg_item: {"Test Motherboard Wires 1": {}}}} From 3d4f145b16c17da75cc6c8cba2fd8357d48473a9 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 1 Dec 2025 16:00:06 +0530 Subject: [PATCH 097/217] refactor(test): make quotation deterministic --- .../doctype/quotation/test_quotation.py | 6 +++ .../doctype/quotation/test_records.json | 37 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 erpnext/selling/doctype/quotation/test_records.json diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index 238b5144933..2a8d582f8fb 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -13,6 +13,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestQuotation(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Quotation") + def test_update_child_quotation_add_item(self): from erpnext.stock.doctype.item.test_item import make_item @@ -975,6 +980,7 @@ class TestQuotation(ERPNextTestSuite): quotation.reload() self.assertEqual(quotation.status, "Ordered") + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_duplicate_items_in_quotation(self): from erpnext.selling.doctype.quotation.quotation import make_sales_order from erpnext.stock.doctype.item.test_item import make_item diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json new file mode 100644 index 00000000000..8bab707ad70 --- /dev/null +++ b/erpnext/selling/doctype/quotation/test_records.json @@ -0,0 +1,37 @@ +[ + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "party_name": "_Test Customer", + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer", + "doctype": "Quotation", + "base_grand_total": 1000.0, + "grand_total": 1000.0, + "order_type": "Sales", + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "items": [ + { + "base_amount": 1000.0, + "base_rate": 100.0, + "description": "CPU", + "doctype": "Quotation Item", + "item_code": "_Test Item Home Desktop 100", + "item_name": "CPU", + "parentfield": "items", + "qty": 10.0, + "rate": 100.0, + "uom": "_Test UOM 1", + "stock_uom": "_Test UOM 1", + "conversion_factor": 1.0 + } + ], + "quotation_to": "Customer", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory", + "transaction_date": "2013-02-21", + "valid_till": "2013-03-21" + } +] From 6824f3274a43f1c00f28766b060c8f31eb9cee5c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 1 Dec 2025 18:01:15 +0530 Subject: [PATCH 098/217] refactor(test): make sales order deterministic --- .../doctype/sales_order/test_sales_order.py | 16 +++++---- erpnext/tests/utils.py | 35 +++++++++++++++++++ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index 35322ff0d4e..1da930b73ab 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -56,7 +56,6 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): def tearDown(self): frappe.db.rollback() - frappe.set_user("Administrator") @ERPNextTestSuite.change_settings( "Stock Settings", @@ -145,7 +144,9 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): so.reload() self.assertEqual(so.status, "Completed") - @ERPNextTestSuite.change_settings("Selling Settings", {"allow_negative_rates_for_items": 1}) + @ERPNextTestSuite.change_settings( + "Selling Settings", {"allow_multiple_items": 1, "allow_negative_rates_for_items": 1} + ) def test_sales_order_with_negative_rate(self): """ Test if negative rate is allowed in Sales Order via doc submission and update items @@ -175,6 +176,7 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): ) update_child_qty_rate("Sales Order", trans_item, so.name) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_sales_order_qty(self): so = make_sales_order(qty=1, do_not_save=True) @@ -823,6 +825,7 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): # reserved qty in packed item should increase after changing bundle item uom self.assertEqual(get_reserved_qty("_Packed Item"), existing_reserved_qty + 8) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_update_child_with_tax_template(self): """ Test Action: Create a SO with one item having its tax account head already in the SO. @@ -1485,6 +1488,7 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): si.insert() self.assertTrue(si.get("payment_schedule")) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_make_work_order(self): from erpnext.selling.doctype.sales_order.sales_order import get_work_order_items @@ -1826,7 +1830,7 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice so = make_sales_order(uom="Nos", do_not_save=1) - so.items[0].rate = 0 + so.items[0].rate = so.items[0].price_list_rate = 0 so.save() so.submit() @@ -2384,7 +2388,7 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): frappe.db.set_single_value("Stock Settings", "auto_insert_price_list_rate_if_missing", 1) so = make_sales_order( - item_code=item.name, currency="USD", qty=1, rate=100, price_list_rate=100, do_not_submit=True + item_code=item.name, currency="INR", qty=1, rate=100, price_list_rate=100, do_not_submit=True ) so.save() @@ -2392,7 +2396,7 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): self.assertEqual(item_price, 100) so = make_sales_order( - item_code=item.name, currency="USD", qty=1, rate=200, price_list_rate=100, do_not_submit=True + item_code=item.name, currency="INR", qty=1, rate=200, price_list_rate=100, do_not_submit=True ) so.save() @@ -2401,7 +2405,7 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): frappe.db.set_single_value("Stock Settings", "update_existing_price_list_rate", 1) so = make_sales_order( - item_code=item.name, currency="USD", qty=1, rate=200, price_list_rate=200, do_not_submit=True + item_code=item.name, currency="INR", qty=1, rate=200, price_list_rate=200, do_not_submit=True ) so.save() diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 256ec6d580a..986b334c0c7 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -233,6 +233,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_asset_maintenance_team() cls.make_asset_category() cls._make_item() + cls.make_product_bundle() cls.make_location() cls.make_price_list() cls.make_item_price() @@ -2170,6 +2171,40 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_product_bundle(cls): + records = [ + { + "doctype": "Product Bundle", + "new_item_code": "_Test Product Bundle Item", + "items": [ + { + "doctype": "Product Bundle Item", + "item_code": "_Test Item", + "parentfield": "items", + "qty": 5.0, + }, + { + "doctype": "Product Bundle Item", + "item_code": "_Test Item Home Desktop 100", + "parentfield": "items", + "qty": 2.0, + }, + ], + } + ] + cls.product_bundle = [] + for x in records: + if not frappe.db.exists("Product Bundle", {"new_item_code": x.get("new_item_code")}): + cls.product_bundle.append(frappe.get_doc(x).insert()) + else: + cls.product_bundle.append( + frappe.get_doc( + "Product Bundle", + {"new_item_code": x.get("new_item_code")}, + ) + ) + @classmethod def make_test_account(cls): records = [ From 381e0a65d11055be80eabf9404dede389edc005b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 13:18:39 +0530 Subject: [PATCH 099/217] refactor(test): make project deterministic --- erpnext/projects/doctype/project/test_project.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/project/test_project.py b/erpnext/projects/doctype/project/test_project.py index 85fd91bc6b1..0113397a532 100644 --- a/erpnext/projects/doctype/project/test_project.py +++ b/erpnext/projects/doctype/project/test_project.py @@ -17,13 +17,14 @@ class TestProject(ERPNextTestSuite): def setUpClass(cls): super().setUpClass() cls.make_projects() + cls.make_activity_type() def test_project_total_costing_and_billing_amount(self): from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet from erpnext.setup.doctype.employee.test_employee import make_employee project_name = "Test Project Costing" - employee = make_employee("employee@frappe.io") + employee = make_employee("employee@frappe.io", company=self.companies[0].name) project = make_project({"project_name": project_name}) timesheet = make_timesheet( employee=employee, From ec3a39c961175c0de777d86e78d227a7c947a4d0 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 13:20:30 +0530 Subject: [PATCH 100/217] refactor(test): make test deterministic --- erpnext/projects/doctype/task/test_task.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/task/test_task.py b/erpnext/projects/doctype/task/test_task.py index 30e35362aa9..35e3b3f4d00 100644 --- a/erpnext/projects/doctype/task/test_task.py +++ b/erpnext/projects/doctype/task/test_task.py @@ -14,6 +14,7 @@ class TestTask(ERPNextTestSuite): def setUpClass(cls): super().setUpClass() cls.make_projects() + cls.make_activity_type() def test_task_total_costing_and_billing_amount(self): from erpnext.projects.doctype.project.test_project import make_project @@ -21,7 +22,7 @@ class TestTask(ERPNextTestSuite): from erpnext.setup.doctype.employee.test_employee import make_employee project_name = "Test Project Costing" - employee = make_employee("employee@frappe.io") + employee = make_employee("employee@frappe.io", company=self.companies[0].name) project = make_project({"project_name": project_name}) task = create_task("_Test Task 1") task.project = project.name From dd240c1070ff1d078a8df4dda18e7dfdde44d8e1 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 13:24:05 +0530 Subject: [PATCH 101/217] refactor(test): make currency exchange deterministic --- .../doctype/currency_exchange/test_currency_exchange.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py index c6f08c305ee..dd408b97610 100644 --- a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py +++ b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py @@ -79,6 +79,11 @@ def patched_requests_get(*args, **kwargs): @mock.patch("requests.get", side_effect=patched_requests_get) class TestCurrencyExchange(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Currency Exchange") + def clear_cache(self): cache = frappe.cache() for date in test_exchange_values.keys(): From 2a6b497c0660da209d391dcff802f9fb6ca71c1b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 13:29:58 +0530 Subject: [PATCH 102/217] refactor(test): make department deterministic --- erpnext/setup/doctype/department/test_department.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/setup/doctype/department/test_department.py b/erpnext/setup/doctype/department/test_department.py index 2a1c357f751..bd324a0c4f2 100644 --- a/erpnext/setup/doctype/department/test_department.py +++ b/erpnext/setup/doctype/department/test_department.py @@ -9,18 +9,18 @@ from erpnext.tests.utils import ERPNextTestSuite class TestDepartment(ERPNextTestSuite): def test_remove_department_data(self): - doc = create_department("Test Department") + doc = create_department("Test Department", company=self.companies[0].name) frappe.delete_doc("Department", doc.name) -def create_department(department_name, parent_department=None): +def create_department(department_name, parent_department=None, company=None): doc = frappe.get_doc( { "doctype": "Department", "is_group": 0, "parent_department": parent_department, "department_name": department_name, - "company": frappe.defaults.get_defaults().company, + "company": frappe.defaults.get_defaults().company or company, } ).insert() From 2699ad15d2e5c3e6929c48f64f70d94632584164 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 13:32:18 +0530 Subject: [PATCH 103/217] refactor(test): make employee deterministic --- erpnext/setup/doctype/employee/test_employee.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/erpnext/setup/doctype/employee/test_employee.py b/erpnext/setup/doctype/employee/test_employee.py index 90b7cff1fba..564747f794c 100644 --- a/erpnext/setup/doctype/employee/test_employee.py +++ b/erpnext/setup/doctype/employee/test_employee.py @@ -14,8 +14,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestEmployee(ERPNextTestSuite): def test_employee_status_left(self): - employee1 = make_employee("test_employee_1@company.com") - employee2 = make_employee("test_employee_2@company.com") + employee1 = make_employee("test_employee_1@company.com", company=self.companies[0].name) + employee2 = make_employee("test_employee_2@company.com", company=self.companies[0].name) employee1_doc = frappe.get_doc("Employee", employee1) employee2_doc = frappe.get_doc("Employee", employee2) employee2_doc.reload() @@ -26,7 +26,7 @@ class TestEmployee(ERPNextTestSuite): self.assertRaises(InactiveEmployeeStatusError, employee1_doc.save) def test_user_has_employee(self): - employee = make_employee("test_emp_user_creation@company.com") + employee = make_employee("test_emp_user_creation@company.com", company=self.companies[0].name) employee_doc = frappe.get_doc("Employee", employee) user = employee_doc.user_id self.assertTrue("Employee" in frappe.get_roles(user)) @@ -35,9 +35,13 @@ class TestEmployee(ERPNextTestSuite): self.assertTrue("Employee" not in frappe.get_roles(user)) def test_employee_user_permission(self): - employee1 = make_employee("employee_1_test@company.com", create_user_permission=1) - employee2 = make_employee("employee_2_test@company.com", create_user_permission=1) - make_employee("employee_3_test@company.com", create_user_permission=1) + employee1 = make_employee( + "employee_1_test@company.com", create_user_permission=1, company=self.companies[0].name + ) + employee2 = make_employee( + "employee_2_test@company.com", create_user_permission=1, company=self.companies[0].name + ) + make_employee("employee_3_test@company.com", create_user_permission=1, company=self.companies[0].name) employee1_doc = frappe.get_doc("Employee", employee1) employee2_doc = frappe.get_doc("Employee", employee2) From bd5dcc04f0f36ad4f171de2711d97831f6832f30 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 13:36:52 +0530 Subject: [PATCH 104/217] refactor(test): make item group deterministic --- .../doctype/item_group/test_item_group.py | 5 + .../doctype/item_group/test_records.json | 108 ++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 erpnext/setup/doctype/item_group/test_records.json diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py index f1a8697e00c..d0a72ae2c98 100644 --- a/erpnext/setup/doctype/item_group/test_item_group.py +++ b/erpnext/setup/doctype/item_group/test_item_group.py @@ -16,6 +16,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestItem(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Item Group") + def test_basic_tree(self, records=None): min_lft = 1 max_rgt = frappe.db.sql("select max(rgt) from `tabItem Group`")[0][0] diff --git a/erpnext/setup/doctype/item_group/test_records.json b/erpnext/setup/doctype/item_group/test_records.json new file mode 100644 index 00000000000..ce1d718375a --- /dev/null +++ b/erpnext/setup/doctype/item_group/test_records.json @@ -0,0 +1,108 @@ +[ + { + "doctype": "Item Group", + "is_group": 0, + "item_group_name": "_Test Item Group", + "parent_item_group": "All Item Groups", + "item_group_defaults": [{ + "company": "_Test Company", + "buying_cost_center": "_Test Cost Center 2 - _TC", + "selling_cost_center": "_Test Cost Center 2 - _TC", + "default_warehouse": "_Test Warehouse - _TC" + }] + }, + { + "doctype": "Item Group", + "is_group": 0, + "item_group_name": "_Test Item Group Desktops", + "parent_item_group": "All Item Groups" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group A", + "parent_item_group": "All Item Groups" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group B", + "parent_item_group": "All Item Groups" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group B - 1", + "parent_item_group": "_Test Item Group B" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group B - 2", + "parent_item_group": "_Test Item Group B" + }, + { + "doctype": "Item Group", + "is_group": 0, + "item_group_name": "_Test Item Group B - 3", + "parent_item_group": "_Test Item Group B" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group C", + "parent_item_group": "All Item Groups" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group C - 1", + "parent_item_group": "_Test Item Group C" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group C - 2", + "parent_item_group": "_Test Item Group C" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group D", + "parent_item_group": "All Item Groups" + }, + { + "doctype": "Item Group", + "is_group": 1, + "item_group_name": "_Test Item Group Tax Parent", + "parent_item_group": "All Item Groups", + "taxes": [ + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "tax_category": "" + }, + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 12 - _TC", + "tax_category": "_Test Tax Category 1" + } + ] + }, + { + "doctype": "Item Group", + "is_group": 0, + "item_group_name": "_Test Item Group Tax Child Override", + "parent_item_group": "_Test Item Group Tax Parent", + "taxes": [ + { + "doctype": "Item Tax", + "parentfield": "taxes", + "item_tax_template": "_Test Account Excise Duty @ 15 - _TC", + "tax_category": "" + } + ] + } +] From 671235d13c1f856b3463af14d518a52577c7ead3 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 13:39:57 +0530 Subject: [PATCH 105/217] refactor(test): make transaction deletion record deterministic --- .../test_transaction_deletion_record.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py index 191542d80c1..7e3a4191903 100644 --- a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py +++ b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py @@ -385,7 +385,9 @@ class TestTransactionDeletionRecord(ERPNextTestSuite): def create_company(company_name): - company = frappe.get_doc({"doctype": "Company", "company_name": company_name, "default_currency": "INR"}) + company = frappe.get_doc( + {"doctype": "Company", "company_name": company_name, "default_currency": "INR", "country": "India"} + ) company.insert(ignore_if_duplicate=True) From fd31c3458110247e60ff83a2f74a85c4bd403dc0 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 15:11:48 +0530 Subject: [PATCH 106/217] refactor(test): make delivery note deterministic --- .../doctype/delivery_note/test_delivery_note.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 2430eb219a9..c2d11eb9212 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -45,6 +45,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestDeliveryNote(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Stock Entry") + def test_delivery_note_qty(self): dn = create_delivery_note(qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): @@ -158,6 +163,7 @@ class TestDeliveryNote(ERPNextTestSuite): "doctype": "Serial No", "item_code": "_Test Serialized Item With Series", "serial_no": make_autoname("SRDD", "Serial No"), + "company": self.companies[0].name, } ) serial_no.save() @@ -222,6 +228,7 @@ class TestDeliveryNote(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, + "company": self.companies[0].name, } ) sn_doc.insert() @@ -1248,6 +1255,7 @@ class TestDeliveryNote(ERPNextTestSuite): si = make_sales_invoice(dn.name) self.assertEqual(si.items[0].qty, 1) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_make_sales_invoice_from_dn_with_returned_qty_duplicate_items(self): from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice @@ -1838,6 +1846,7 @@ class TestDeliveryNote(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, + "company": self.companies[0].name, } ) sn_doc.insert() @@ -2322,6 +2331,7 @@ class TestDeliveryNote(ERPNextTestSuite): for d in bundle_data: self.assertEqual(d.incoming_rate, serial_no_valuation[d.serial_no]) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_delivery_note_return_valuation_with_use_serial_batch_field(self): from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_return @@ -2612,7 +2622,7 @@ class TestDeliveryNote(ERPNextTestSuite): self.assertEqual(dn.status, "To Bill") si = make_sales_invoice(dn.name) - si.location = "Test Location" + si.location = self.location[0].name si.submit() dn_return = create_delivery_note(is_return=1, return_against=dn.name, qty=-2, do_not_submit=True) From 8a7f193334103a4b5504dbbcb3beef5646bb4111 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 15:49:59 +0530 Subject: [PATCH 107/217] refactor(test): make delivery trip deterministic --- .../delivery_trip/test_delivery_trip.py | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py index 8e467f84fba..68bcfe45629 100644 --- a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py @@ -22,16 +22,29 @@ class TestDeliveryTrip(ERPNextTestSuite): create_test_contact_and_address() address = create_address(driver) - self.delivery_trip = create_delivery_trip(driver, address) + self.delivery_trip = create_delivery_trip(driver, address, company=self.companies[0].name) def tearDown(self): - frappe.db.sql("delete from `tabDriver`") - frappe.db.sql("delete from `tabVehicle`") - frappe.db.sql("delete from `tabEmail Template`") - frappe.db.sql("delete from `tabDelivery Trip`") - return super().tearDown() + frappe.db.rollback() def test_delivery_trip_notify_customers(self): + # set default outgoing + outgoing = frappe.get_doc( + { + "doctype": "Email Account", + "company": self.companies[0].name, + "enable_outgoing": 1, + "default_outgoing": 1, + "awaiting_password": 1, + "auth_method": "Basic", + "password": "test", + "smtp_server": "localhost", + "stmp_port": 25, + "email_id": "test@example.in", + } + ) + outgoing.save() + notify_customers(delivery_trip=self.delivery_trip.name) self.delivery_trip.load_from_db() self.assertEqual(self.delivery_trip.email_notification_sent, 1) @@ -175,14 +188,14 @@ def create_vehicle(): vehicle.insert() -def create_delivery_trip(driver, address, contact=None): +def create_delivery_trip(driver, address, contact=None, company=None): if not contact: contact = get_contact_and_address("_Test Customer") delivery_trip = frappe.get_doc( { "doctype": "Delivery Trip", - "company": erpnext.get_default_company(), + "company": company or erpnext.get_default_company(), "departure_time": add_days(now_datetime(), 5), "driver": driver.name, "driver_address": address.name, From 61745b937195ac6c122d31925340744c5eb641e4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 17:18:13 +0530 Subject: [PATCH 108/217] refactor(test): make item price deterministic --- .../doctype/item_price/test_item_price.py | 8 +-- .../doctype/item_price/test_records.json | 56 +++++++++++++++++++ 2 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 erpnext/stock/doctype/item_price/test_records.json diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py index 5df5ae166c9..04e98a45a42 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.py +++ b/erpnext/stock/doctype/item_price/test_item_price.py @@ -11,10 +11,10 @@ from erpnext.tests.utils import ERPNextTestSuite class TestItemPrice(ERPNextTestSuite): - def setUp(self): - super().setUp() - frappe.db.sql("delete from `tabItem Price`") - make_test_records_for_doctype("Item Price", force=True) + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Item Price") def test_template_item_price(self): from erpnext.stock.doctype.item.test_item import make_item diff --git a/erpnext/stock/doctype/item_price/test_records.json b/erpnext/stock/doctype/item_price/test_records.json new file mode 100644 index 00000000000..afe5ad65b75 --- /dev/null +++ b/erpnext/stock/doctype/item_price/test_records.json @@ -0,0 +1,56 @@ +[ + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Price List", + "price_list_rate": 100, + "valid_from": "2017-04-18", + "valid_upto": "2017-04-26" + }, + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Price List Rest of the World", + "price_list_rate": 10 + }, + { + "doctype": "Item Price", + "item_code": "_Test Item 2", + "price_list": "_Test Price List Rest of the World", + "price_list_rate": 20, + "valid_from": "2017-04-18", + "valid_upto": "2017-04-26", + "customer": "_Test Customer", + "uom": "_Test UOM" + }, + { + "doctype": "Item Price", + "item_code": "_Test Item Home Desktop 100", + "price_list": "_Test Price List", + "price_list_rate": 1000, + "valid_from": "2017-04-10", + "valid_upto": "2017-04-17" + }, + { + "doctype": "Item Price", + "item_code": "_Test Item Home Desktop Manufactured", + "price_list": "_Test Price List", + "price_list_rate": 1000, + "valid_from": "2017-04-10", + "valid_upto": "2017-04-17" + }, + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Buying Price List", + "price_list_rate": 100, + "supplier": "_Test Supplier" + }, + { + "doctype": "Item Price", + "item_code": "_Test Item", + "price_list": "_Test Selling Price List", + "price_list_rate": 200, + "customer": "_Test Customer" + } +] From 499213cafdc898c0899728b5fd58dcbfde638ab9 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 17:24:18 +0530 Subject: [PATCH 109/217] refactor(test): make LCV deterministic --- .../landed_cost_voucher/test_landed_cost_voucher.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py index b24fcfcf712..5a9cf4b76ca 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py @@ -24,6 +24,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestLandedCostVoucher(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Currency Exchange") + def test_landed_cost_voucher(self): frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) @@ -398,6 +403,7 @@ class TestLandedCostVoucher(ERPNextTestSuite): "doctype": "Serial No", "item_code": item_code, "serial_no": serial_no, + "company": self.companies[0].name, } ).insert() @@ -669,6 +675,7 @@ class TestLandedCostVoucher(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, + "company": self.companies[0].name, } ) sn_doc.insert() @@ -819,6 +826,7 @@ class TestLandedCostVoucher(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, + "company": self.companies[0].name, } ) sn_doc.insert() @@ -1009,6 +1017,7 @@ class TestLandedCostVoucher(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, + "company": self.companies[0].name, } ) sn_doc.insert() From dee513fa875095788ce27826cdfb2d2c5c34dcf2 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 26 Dec 2025 17:37:02 +0530 Subject: [PATCH 110/217] refactor(test): make material request deterministic --- .../material_request/test_material_request.py | 5 ++ .../material_request/test_records.json | 57 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 erpnext/stock/doctype/material_request/test_records.json diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index dd6ba500099..82a61fcbb8d 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -24,6 +24,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestMaterialRequest(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Material Request") + def test_material_request_qty(self): mr = frappe.copy_doc(self.globalTestRecords["Material Request"][0]) mr.items[0].qty = 0 diff --git a/erpnext/stock/doctype/material_request/test_records.json b/erpnext/stock/doctype/material_request/test_records.json new file mode 100644 index 00000000000..d49a8071af0 --- /dev/null +++ b/erpnext/stock/doctype/material_request/test_records.json @@ -0,0 +1,57 @@ +[ + { + "company": "_Test Company", + "doctype": "Material Request", + "fiscal_year": "_Test Fiscal Year 2013", + "items": [ + { + "description": "_Test Item Home Desktop 100", + "doctype": "Material Request Item", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "parentfield": "items", + "qty": 54.0, + "schedule_date": "2013-02-18", + "uom": "_Test UOM 1", + "warehouse": "_Test Warehouse - _TC" + }, + { + "description": "_Test Item Home Desktop 200", + "doctype": "Material Request Item", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "qty": 3.0, + "schedule_date": "2013-02-19", + "uom": "_Test UOM 1", + "warehouse": "_Test Warehouse - _TC" + } + ], + "material_request_type": "Purchase", + "naming_series": "_T-Material Request-", + "transaction_date": "2013-02-18", + "schedule_date": "2013-02-19" + }, + { + "company": "_Test Company", + "doctype": "Material Request", + "fiscal_year": "_Test Fiscal Year 2013", + "items": [ + { + "description": "_Test FG Item", + "doctype": "Material Request Item", + "item_code": "_Test FG Item", + "item_name": "_Test FG Item", + "parentfield": "items", + "qty": 5, + "schedule_date": "2013-02-19", + "uom": "_Test UOM 1", + "warehouse": "_Test Warehouse - _TC" + } + ], + "material_request_type": "Manufacture", + "naming_series": "_T-Material Request-", + "transaction_date": "2013-02-18", + "schedule_date": "2013-02-19" + } +] From c437bfcd28fcc8e990f6660dd93494b764d7f2a3 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 31 Dec 2025 15:44:23 +0530 Subject: [PATCH 111/217] refactor(test): make packed item deterministic --- erpnext/stock/doctype/packed_item/test_packed_item.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/stock/doctype/packed_item/test_packed_item.py b/erpnext/stock/doctype/packed_item/test_packed_item.py index 8bab935cda7..de8f6a81533 100644 --- a/erpnext/stock/doctype/packed_item/test_packed_item.py +++ b/erpnext/stock/doctype/packed_item/test_packed_item.py @@ -78,6 +78,7 @@ class TestPackedItem(ERPNextTestSuite): self.assertEqual(len(so.packed_items), 0) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_recurring_bundle_item(self): "Test impact on packed items if same bundle item is added and removed." so_items = [] @@ -128,6 +129,7 @@ class TestPackedItem(ERPNextTestSuite): self.assertEqual(so.items[0].rate, 700) self.assertEqual(so.items[0].amount, 1400) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_newly_mapped_doc_packed_items(self): "Test impact on packed items in newly mapped DN from SO." so_items = [] From 12470c3145d47296a23e0201cabe58590fcd356b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 31 Dec 2025 15:47:09 +0530 Subject: [PATCH 112/217] refactor(test): make pick list deterministic --- erpnext/stock/doctype/pick_list/test_pick_list.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py index bf8d2ef5af1..e6c94d12418 100644 --- a/erpnext/stock/doctype/pick_list/test_pick_list.py +++ b/erpnext/stock/doctype/pick_list/test_pick_list.py @@ -510,6 +510,7 @@ class TestPickList(ERPNextTestSuite): self.assertEqual(pick_list.locations[1].qty, 5) self.assertEqual(pick_list.locations[1].sales_order_item, sales_order.items[0].name) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_pick_list_for_items_with_multiple_UOM(self): item_code = make_item( uoms=[ @@ -1374,6 +1375,7 @@ class TestPickList(ERPNextTestSuite): frappe.db.set_single_value("Stock Settings", "over_picking_allowance", 0) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_ignore_pricing_rule_in_pick_list(self): frappe.flags.print_stmt = False warehouse = "_Test Warehouse - _TC" @@ -1475,6 +1477,7 @@ class TestPickList(ERPNextTestSuite): for loc in pl.locations: self.assertEqual(loc.batch_no, batch2) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_multiple_pick_lists_delivery_note(self): from erpnext.stock.doctype.pick_list.pick_list import create_dn_for_pick_lists @@ -1561,6 +1564,7 @@ class TestPickList(ERPNextTestSuite): stock_entry_2.cancel() stock_entry_3.cancel() + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_packed_item_multiple_times_in_so(self): frappe.db.delete("Item Price") warehouse_1 = "_Test Warehouse - _TC" From 820e0f88d366c9aaedaf8b08b45bda69db13b4d8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 31 Dec 2025 16:54:20 +0530 Subject: [PATCH 113/217] refactor(test): make serial and batch bundle deterministic --- .../serial_and_batch_bundle/test_serial_and_batch_bundle.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py index 5a34b4715dc..79bcb63e531 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py @@ -40,6 +40,7 @@ class TestSerialandBatchBundle(ERPNextTestSuite): "doctype": "Serial No", "serial_no": sn, "item_code": serial_item_code, + "company": self.companies[0].name, } ).insert(ignore_permissions=True) @@ -706,6 +707,7 @@ class TestSerialandBatchBundle(ERPNextTestSuite): "doctype": "Serial No", "serial_no": serial_no, "item_code": item, + "company": self.companies[0].name, } ).insert(ignore_permissions=True) @@ -803,6 +805,7 @@ class TestSerialandBatchBundle(ERPNextTestSuite): "doctype": "Serial No", "serial_no": serial_no, "item_code": sn_item, + "company": self.companies[0].name, } ).insert(ignore_permissions=True) serial_nos.append(serial_no) From f939d0d3d6c3b49f180bc7a7bc2ce1d448fac828 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 31 Dec 2025 16:57:06 +0530 Subject: [PATCH 114/217] refactor(test): make serial no deterministic --- erpnext/stock/doctype/serial_no/test_serial_no.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py index f9b17998bf1..e59f5092f1a 100644 --- a/erpnext/stock/doctype/serial_no/test_serial_no.py +++ b/erpnext/stock/doctype/serial_no/test_serial_no.py @@ -23,6 +23,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestSerialNo(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Stock Entry") + def tearDown(self): frappe.db.rollback() @@ -34,6 +39,7 @@ class TestSerialNo(ERPNextTestSuite): sr.warehouse = "_Test Warehouse - _TC" sr.serial_no = "_TCSER0001" sr.purchase_rate = 10 + sr.company = self.companies[0].name self.assertRaises(SerialNoCannotCreateDirectError, sr.insert) sr.warehouse = None @@ -193,7 +199,12 @@ class TestSerialNo(ERPNextTestSuite): for serial_no in serial_nos: if not frappe.db.exists("Serial No", serial_no): frappe.get_doc( - {"doctype": "Serial No", "item_code": item_code, "serial_no": serial_no} + { + "doctype": "Serial No", + "item_code": item_code, + "serial_no": serial_no, + "company": self.companies[0].name, + } ).insert() make_stock_entry( From ac6621b0e8082b5e4ae692325a8a758b1b98cd45 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 31 Dec 2025 16:58:59 +0530 Subject: [PATCH 115/217] refactor(test): make stock entry deterministic --- erpnext/stock/doctype/stock_entry/test_stock_entry.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 49ff8b425aa..dbd17d1658b 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -652,6 +652,7 @@ class TestStockEntry(ERPNextTestSuite): doc = frappe.new_doc("Serial No") doc.serial_no = serial_no doc.item_code = "_Test Serialized Item" + doc.company = self.companies[0].name doc.insert(ignore_permissions=True) se = frappe.copy_doc(self.globalTestRecords["Stock Entry"][0]) @@ -2045,6 +2046,7 @@ class TestStockEntry(ERPNextTestSuite): "abbr": "_TPC", "default_currency": "INR", "enable_perpetual_inventory": 0, + "country": "India", } ).insert(ignore_permissions=True) @@ -2404,10 +2406,14 @@ class TestStockEntry(ERPNextTestSuite): rm_item1 = make_item("_Battery", properties={"is_stock_item": 1}).name warehouse = "Stores - WP" bom_no = make_bom(item=fg_item, raw_materials=[rm_item1]).name - make_stock_entry(item_code=rm_item1, target=warehouse, qty=5, rate=10, purpose="Material Receipt") + se = make_stock_entry( + item_code=rm_item1, target=warehouse, qty=5, rate=10, purpose="Material Receipt" + ) work_order = make_work_order(bom_no, fg_item, 5) + work_order.company = se.company work_order.skip_transfer = 1 + work_order.source_warehouse = warehouse work_order.fg_warehouse = warehouse work_order.submit() From 8867a7015c973893370dbbadac2cf5f039268566 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 31 Dec 2025 17:13:29 +0530 Subject: [PATCH 116/217] refactor: fix logical bug and make stock settings test deterministic --- erpnext/stock/doctype/stock_settings/stock_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py index dc92bfc8289..f2d54794094 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.py +++ b/erpnext/stock/doctype/stock_settings/stock_settings.py @@ -353,8 +353,8 @@ def clean_all_descriptions(): for item in frappe.get_all("Item", ["name", "description"]): if item.description: clean_description = clean_html(item.description) - if item.description != clean_description: - frappe.db.set_value("Item", item.name, "description", clean_description) + if item.description != clean_description: + frappe.db.set_value("Item", item.name, "description", clean_description) @frappe.whitelist() From 52dfc32dbaf20bc226f4229923f7daea38556492 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 31 Dec 2025 16:40:40 +0530 Subject: [PATCH 117/217] refactor(test): make purchase receipt deterministic --- .../purchase_receipt/test_purchase_receipt.py | 14 ++- .../purchase_receipt/test_records.json | 87 +++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 erpnext/stock/doctype/purchase_receipt/test_records.json diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 1ca15a3af43..d4c7edb5cf5 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -29,6 +29,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPurchaseReceipt(ERPNextTestSuite): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.load_test_records("Purchase Receipt") + def setUp(self): frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) @@ -741,7 +746,12 @@ class TestPurchaseReceipt(ERPNextTestSuite): serial_no = ["12903812901"] if not frappe.db.exists("Serial No", serial_no[0]): frappe.get_doc( - {"doctype": "Serial No", "item_code": item_code, "serial_no": serial_no[0]} + { + "doctype": "Serial No", + "item_code": item_code, + "serial_no": serial_no[0], + "company": self.companies[0].name, + } ).insert() pr_doc = make_purchase_receipt(item_code=item_code, qty=1, serial_no=serial_no) @@ -2699,6 +2709,7 @@ class TestPurchaseReceipt(ERPNextTestSuite): "doctype": "Serial No", "item_code": serial_item, "serial_no": serial_no, + "company": self.companies[0].name, } ).insert() @@ -3992,6 +4003,7 @@ class TestPurchaseReceipt(ERPNextTestSuite): "doctype": "Serial No", "item_code": serial_item, "serial_no": serial_no, + "company": self.companies[0].name, } ).insert() diff --git a/erpnext/stock/doctype/purchase_receipt/test_records.json b/erpnext/stock/doctype/purchase_receipt/test_records.json new file mode 100644 index 00000000000..86f8683ce25 --- /dev/null +++ b/erpnext/stock/doctype/purchase_receipt/test_records.json @@ -0,0 +1,87 @@ +[ + { + "buying_price_list": "_Test Price List", + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "doctype": "Purchase Receipt", + "base_grand_total": 720.0, + "naming_series": "_T-Purchase Receipt-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account Shipping Charges - _TC", + "add_deduct_tax": "Add", + "category": "Valuation and Total", + "charge_type": "Actual", + "description": "Shipping Charges", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 100.0, + "tax_amount": 100.0, + "cost_center": "Main - _TC" + }, + { + "account_head": "_Test Account VAT - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "Actual", + "description": "VAT", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 120.0, + "tax_amount": 120.0, + "cost_center": "Main - _TC" + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "add_deduct_tax": "Add", + "category": "Valuation", + "charge_type": "Actual", + "description": "Customs Duty", + "doctype": "Purchase Taxes and Charges", + "parentfield": "taxes", + "rate": 150.0, + "tax_amount": 150.0, + "cost_center": "Main - _TC" + } + ], + "items": [ + { + "base_amount": 250.0, + "conversion_factor": 1.0, + "description": "_Test Item", + "doctype": "Purchase Receipt Item", + "item_code": "_Test Item", + "item_name": "_Test Item", + "parentfield": "items", + "qty": 5.0, + "rate": 50.0, + "received_qty": 5.0, + "rejected_qty": 0.0, + "stock_uom": "_Test UOM", + "uom": "_Test UOM", + "warehouse": "_Test Warehouse - _TC", + "cost_center": "Main - _TC" + }, + { + "base_amount": 250.0, + "conversion_factor": 1.0, + "description": "_Test Item Home Desktop 100", + "doctype": "Purchase Receipt Item", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "parentfield": "items", + "qty": 5.0, + "rate": 50.0, + "received_qty": 5.0, + "rejected_qty": 0.0, + "stock_uom": "_Test UOM", + "uom": "_Test UOM", + "warehouse": "_Test Warehouse 1 - _TC", + "cost_center": "Main - _TC" + } + ], + "supplier": "_Test Supplier" + } +] From b3fec97a831960054d802b585e02c68d4f3fdc9f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 1 Jan 2026 16:39:53 +0530 Subject: [PATCH 118/217] refactor(test): make work order deterministic --- erpnext/manufacturing/doctype/bom/test_bom.py | 3 ++- .../doctype/work_order/test_work_order.py | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index a0e6bde20e5..4c5c6d85a52 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -869,11 +869,12 @@ def reset_item_valuation_rate(item_code, warehouse_list=None, qty=None, rate=Non def create_bom_with_process_loss_item( - fg_item, bom_item, scrap_qty=0, scrap_rate=0, fg_qty=2, process_loss_percentage=0 + fg_item, bom_item, scrap_qty=0, scrap_rate=0, fg_qty=2, process_loss_percentage=0, company=None ): bom_doc = frappe.new_doc("BOM") bom_doc.item = fg_item.item_code bom_doc.quantity = fg_qty + bom_doc.company = company bom_doc.append( "items", { diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 01d2e954075..57bac32ccbf 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -460,8 +460,9 @@ class TestWorkOrder(ERPNextTestSuite): @timeout(seconds=60) def test_job_card(self): stock_entries = [] - bom = frappe.get_doc("BOM", {"docstatus": 1, "with_operations": 1, "company": "_Test Company"}) - + bom = frappe.get_doc( + "BOM", {"docstatus": 1, "with_operations": 1, "company": "_Test Company", "has_variants": 0} + ) work_order = make_wo_order_test_record( item=bom.item, qty=1, bom_no=bom.name, source_warehouse="_Test Warehouse - _TC" ) @@ -511,7 +512,9 @@ class TestWorkOrder(ERPNextTestSuite): def test_work_order_material_transferred_qty_with_process_loss(self): stock_entries = [] - bom = frappe.get_doc("BOM", {"docstatus": 1, "with_operations": 1, "company": "_Test Company"}) + bom = frappe.get_doc( + "BOM", {"docstatus": 1, "with_operations": 1, "company": "_Test Company", "has_variants": 0} + ) work_order = make_wo_order_test_record( item=bom.item, @@ -699,6 +702,7 @@ class TestWorkOrder(ERPNextTestSuite): work_order1.save() self.assertEqual(work_order1.operations[0].time_in_mins, 40.0) + @ERPNextTestSuite.change_settings("Global Defaults", {"default_company": "_Test Company"}) def test_batch_size_for_fg_item(self): fg_item = "Test Batch Size Item For BOM 3" rm1 = "Test Batch Size Item RM 1 For BOM 3" @@ -956,7 +960,11 @@ class TestWorkOrder(ERPNextTestSuite): bom_no = f"BOM-{fg_item_non_whole.item_code}-001" if not frappe.db.exists("BOM", bom_no): bom_doc = create_bom_with_process_loss_item( - fg_item_non_whole, bom_item, fg_qty=1, process_loss_percentage=10 + fg_item_non_whole, + bom_item, + fg_qty=1, + process_loss_percentage=10, + company=self.companies[0].name, ) bom_doc.submit() @@ -1143,6 +1151,7 @@ class TestWorkOrder(ERPNextTestSuite): "is_active": 1, "is_default": 1, "quantity": 1.0, + "company": self.companies[0].name, "with_operations": 1, "operations": [ { @@ -1256,6 +1265,7 @@ class TestWorkOrder(ERPNextTestSuite): self.fail("Batch generation causing failing in Work Order") @ERPNextTestSuite.change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) + @ERPNextTestSuite.change_settings("Global Defaults", {"default_company": "_Test Company"}) def test_auto_serial_no_creation(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom @@ -1289,6 +1299,7 @@ class TestWorkOrder(ERPNextTestSuite): self.fail("Batch generation causing failing in Work Order") @ERPNextTestSuite.change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) + @ERPNextTestSuite.change_settings("Global Defaults", {"default_company": "_Test Company"}) def test_auto_serial_no_batch_creation(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom @@ -1876,6 +1887,7 @@ class TestWorkOrder(ERPNextTestSuite): self.assertEqual(wo_doc.status, "Completed") return_ste_doc = make_stock_return_entry(wo_doc.name) + return_ste_doc.company = wo_doc.company return_ste_doc.save() self.assertTrue(return_ste_doc.is_return) From 40909af128f540ed8f7a5bf73e5102173a618157 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 1 Jan 2026 17:41:31 +0530 Subject: [PATCH 119/217] refactor(test): make item deterministic --- erpnext/stock/doctype/item/test_item.py | 29 ++++++++++++++++++------- erpnext/tests/utils.py | 26 ++++++++++++++++++++++ 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 132aef65e5f..6ca1ebc46f9 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -5,8 +5,8 @@ import json import frappe +from frappe import qb from frappe.custom.doctype.property_setter.property_setter import make_property_setter -from frappe.test_runner import make_test_objects from frappe.utils import add_days, today from erpnext.controllers.item_variant import ( @@ -85,11 +85,25 @@ class TestItem(ERPNextTestSuite): item = frappe.get_doc("Item", item_code) return item - def test_get_item_details(self): - # delete modified item price record and make as per self.globalTestRecords["Item"] - frappe.db.sql("""delete from `tabItem Price`""") - frappe.db.sql("""delete from `tabBin`""") + def make_bin(self, records): + for x in records: + x = frappe._dict(x) + bin = qb.DocType("Bin") + filters = { + "item_code": x.get("item_code"), + "warehouse": x.get("warehouse"), + "reserved_qty": x.get("reserved_qty"), + "actual_qty": x.get("actual_qty"), + "ordered_qty": x.get("ordered_qty"), + "projected_qty": x.get("projected_qty"), + } + if not frappe.db.exists("Bin", filters): + qb.from_(bin).delete().where( + bin.item_code.eq(x.item_code) & bin.warehouse.eq(x.warehouse) + ).run() + frappe.get_doc(x).insert() + def test_get_item_details(self): to_check = { "item_code": "_Test Item", "item_name": "_Test Item", @@ -114,11 +128,10 @@ class TestItem(ERPNextTestSuite): "projected_qty": 14, } - make_test_objects("Item Price") - make_test_objects( - "Bin", + self.make_bin( [ { + "doctype": "Bin", "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC", "reserved_qty": 1, diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 986b334c0c7..eb8ff56f54e 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -246,6 +246,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_quality_inspection_param() cls.make_quality_inspection_template() cls.make_employees() + cls.make_brand() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() @@ -2919,6 +2920,31 @@ class ERPNextTestSuite(unittest.TestCase): ) ) + @classmethod + def make_brand(cls): + records = [ + {"brand": "_Test Brand", "doctype": "Brand"}, + { + "brand": "_Test Brand With Item Defaults", + "doctype": "Brand", + "brand_defaults": [ + { + "company": "_Test Company", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "income_account": "_Test Account Sales - _TC", + "buying_cost_center": "_Test Cost Center - _TC", + "selling_cost_center": "_Test Cost Center - _TC", + } + ], + }, + ] + cls.brand = [] + for x in records: + if not frappe.db.exists("Brand", {"brand": x.get("brand")}): + cls.brand.append(frappe.get_doc(x).insert()) + else: + cls.brand.append(frappe.get_doc("Brand", {"Brand": x.get("brand")})) + @contextmanager def set_user(self, user: str): try: From d54f3c8c24a8346c0e37772efd4075b153a43cda Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 2 Jan 2026 12:23:42 +0530 Subject: [PATCH 120/217] refactor(test): make stock ledger entry deterministic --- .../stock/doctype/stock_reconciliation/stock_reconciliation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 113d211320c..8d3b574fe50 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -241,6 +241,7 @@ class StockReconciliation(StockController): serial_and_batch_bundle = frappe.get_doc( { "doctype": "Serial and Batch Bundle", + "company": self.company, "item_code": item.item_code, "warehouse": item.warehouse, "posting_datetime": combine_datetime(self.posting_date, self.posting_time), From d2f1962c2d308f611f4afa6b409f8e828832522a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 2 Jan 2026 13:13:09 +0530 Subject: [PATCH 121/217] refactor(test): make material request deterministic --- .../stock/doctype/material_request/test_material_request.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index 82a61fcbb8d..64ce9ca8229 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -29,6 +29,9 @@ class TestMaterialRequest(ERPNextTestSuite): super().setUpClass() cls.load_test_records("Material Request") + def tearDown(self): + frappe.db.rollback() + def test_material_request_qty(self): mr = frappe.copy_doc(self.globalTestRecords["Material Request"][0]) mr.items[0].qty = 0 From 05e78848e3aa89bbdf553ee0b148e2578f15458d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 2 Jan 2026 15:31:00 +0530 Subject: [PATCH 122/217] refactor(test): make purchase receipt deterministic --- .../doctype/purchase_receipt/test_purchase_receipt.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index d4c7edb5cf5..a3a32ef233f 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -37,6 +37,9 @@ class TestPurchaseReceipt(ERPNextTestSuite): def setUp(self): frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) + def tearDown(self): + frappe.db.rollback() + def test_purchase_receipt_qty(self): pr = make_purchase_receipt(qty=0, rejected_qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): @@ -131,7 +134,6 @@ class TestPurchaseReceipt(ERPNextTestSuite): template = frappe.db.get_value( "Payment Terms Template", "_Test Payment Terms Template For Purchase Invoice" ) - old_template_in_supplier = frappe.db.get_value("Supplier", "_Test Supplier", "payment_terms") frappe.db.set_value("Supplier", "_Test Supplier", "payment_terms", template) pr = make_purchase_receipt(do_not_save=True) @@ -154,12 +156,6 @@ class TestPurchaseReceipt(ERPNextTestSuite): self.assertEqual(pi.payment_schedule[1].payment_amount, flt(pi.grand_total) / 2) self.assertEqual(pi.payment_schedule[1].invoice_portion, 50) - # teardown - pi.delete() # draft PI - pr.cancel() - frappe.db.set_value("Supplier", "_Test Supplier", "payment_terms", old_template_in_supplier) - frappe.get_doc("Payment Terms Template", "_Test Payment Terms Template For Purchase Invoice").delete() - def test_purchase_receipt_no_gl_entry(self): from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry From 020e28235a9b59f6b03b84a8889fffe30fc5889c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 2 Jan 2026 15:53:59 +0530 Subject: [PATCH 123/217] refactor(test): make subcontracting order deterministic --- .../tests/test_subcontracting_controller.py | 2 +- .../test_subcontracting_order.py | 7 ++++++- erpnext/tests/utils.py | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py index 922995c0767..d4c2aeda66c 100644 --- a/erpnext/controllers/tests/test_subcontracting_controller.py +++ b/erpnext/controllers/tests/test_subcontracting_controller.py @@ -1512,7 +1512,7 @@ def make_subcontracted_item(**args): }, ) - args.raw_materials = ["_Test FG Item", "Test Extra Item 1"] + args.raw_materials = ["_Test Extra Item 1", "Test Extra Item 2"] if not frappe.db.get_value("BOM", {"item": args.item_code}, "name"): make_bom(item=args.item_code, raw_materials=args.get("raw_materials")) diff --git a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py index 0ce5ef4216b..281ded9e4f4 100644 --- a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py +++ b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py @@ -40,6 +40,9 @@ class TestSubcontractingOrder(ERPNextTestSuite): make_service_items() make_bom_for_subcontracted_items() + def tearDown(self): + frappe.db.rollback() + def test_set_missing_values(self): sco = get_subcontracting_order() before = {sco.total_qty, sco.total, sco.total_additional_costs} @@ -460,6 +463,7 @@ class TestSubcontractingOrder(ERPNextTestSuite): set_backflush_based_on("BOM") + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_multiple_items": True}) def test_supplied_qty(self): item_code = "_Test Subcontracted FG Item 5" make_item("Sub Contracted Raw Material 4", {"is_stock_item": 1, "is_sub_contracted_item": 1}) @@ -472,7 +476,7 @@ class TestSubcontractingOrder(ERPNextTestSuite): service_items = [ { "warehouse": "_Test Warehouse - _TC", - "item_code": "Subcontracted Service Item 1", + "item_code": "Subcontracted Service Item 2", "qty": order_qty, "rate": 100, "fg_item": item_code, @@ -678,6 +682,7 @@ class TestSubcontractingOrder(ERPNextTestSuite): self.assertEqual(requested_qty, new_requested_qty) + @ERPNextTestSuite.change_settings("System Settings", {"float_precision": 3}) def test_subcontracting_order_rm_required_items_for_precision(self): item_code = "Subcontracted Item SA9" raw_materials = ["Subcontracted SRM Item 9"] diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index eb8ff56f54e..de1a1428e98 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -2157,6 +2157,24 @@ class ERPNextTestSuite(unittest.TestCase): "valuation_rate": 10000, "stock_uom": "_Test UOM", }, + { + "doctype": "Item", + "item_code": "_Test Extra Item 1", + "item_name": "_Test Extra Item 1", + "item_group": "All Item Groups", + "company": "_Test Company", + "is_stock_item": 1, + "stock_uom": "_Test UOM", + }, + { + "doctype": "Item", + "item_code": "_Test Extra Item 2", + "item_name": "_Test Extra Item 2", + "item_group": "All Item Groups", + "company": "_Test Company", + "is_stock_item": 1, + "stock_uom": "_Test UOM", + }, ] cls.item = [] for x in records: From 20353e70a1ff752fa4a27feb973b1294d9dd862c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sun, 25 Jan 2026 22:20:11 +0530 Subject: [PATCH 124/217] refactor(test): make stock reconciliation deterministic --- .../test_stock_reconciliation.py | 43 +++---------------- erpnext/tests/utils.py | 43 +++++++++++++++++++ 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 41e02cc4e33..18b66de654e 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -36,14 +36,16 @@ from erpnext.tests.utils import ERPNextTestSuite class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): @classmethod def setUpClass(cls): - create_batch_or_serial_no_items() super().setUpClass() - frappe.db.set_single_value("Stock Settings", "allow_negative_stock", 1) - def tearDown(self): + def setUp(self): + frappe.db.set_single_value("Stock Settings", "allow_negative_stock", 1) frappe.local.future_sle = {} frappe.flags.pop("dont_execute_stock_reposts", None) + def tearDown(self): + frappe.db.rollback() + def test_reco_for_fifo(self): self._test_reco_sle_gle("FIFO") @@ -525,8 +527,6 @@ class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): """ from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note - frappe.db.rollback() - # repost will make this test useless, qty should update in realtime without reposts frappe.flags.dont_execute_stock_reposts = True @@ -552,7 +552,6 @@ class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): ) self.assertEqual(old_bin_qty + 1, new_bin_qty) - frappe.db.rollback() def test_valid_batch(self): create_batch_item_with_batch("Testing Batch Item 1", "001") @@ -620,6 +619,7 @@ class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): "doctype": "Serial No", "item_code": item_code, "serial_no": "SR-CREATED-SR-NO", + "company": self.companies[0].name, } ).insert() @@ -1851,37 +1851,6 @@ def insert_existing_sle(warehouse, item_code="_Test Item"): return se1, se2, se3 -def create_batch_or_serial_no_items(): - create_warehouse( - "_Test Warehouse for Stock Reco1", - {"is_group": 0, "parent_warehouse": "_Test Warehouse Group - _TC"}, - ) - - create_warehouse( - "_Test Warehouse for Stock Reco2", - {"is_group": 0, "parent_warehouse": "_Test Warehouse Group - _TC"}, - ) - - serial_item_doc = create_item("Stock-Reco-Serial-Item-1", is_stock_item=1) - if not serial_item_doc.has_serial_no: - serial_item_doc.has_serial_no = 1 - serial_item_doc.serial_no_series = "SRSI.####" - serial_item_doc.save(ignore_permissions=True) - - serial_item_doc = create_item("Stock-Reco-Serial-Item-2", is_stock_item=1) - if not serial_item_doc.has_serial_no: - serial_item_doc.has_serial_no = 1 - serial_item_doc.serial_no_series = "SRSII.####" - serial_item_doc.save(ignore_permissions=True) - - batch_item_doc = create_item("Stock-Reco-batch-Item-1", is_stock_item=1) - if not batch_item_doc.has_batch_no: - batch_item_doc.has_batch_no = 1 - batch_item_doc.create_new_batch = 1 - serial_item_doc.batch_number_series = "BASR.#####" - batch_item_doc.save(ignore_permissions=True) - - def create_stock_reconciliation(**args): args = frappe._dict(args) sr = frappe.new_doc("Stock Reconciliation") diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index de1a1428e98..bb54b2c45e4 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -1369,6 +1369,18 @@ class ERPNextTestSuite(unittest.TestCase): "is_group": 0, "parent_warehouse": "_Test Warehouse Group - _TC", }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse for Stock Reco1", + "is_group": 0, + }, + { + "company": "_Test Company", + "doctype": "Warehouse", + "warehouse_name": "_Test Warehouse for Stock Reco2", + "is_group": 0, + }, ] cls.warehouse = [] for x in records: @@ -2175,6 +2187,37 @@ class ERPNextTestSuite(unittest.TestCase): "is_stock_item": 1, "stock_uom": "_Test UOM", }, + { + "doctype": "Item", + "item_code": "Stock-Reco-Serial-Item-1", + "item_name": "Stock-Reco-Serial-Item-1", + "is_stock_item": 1, + "item_group": "All Item Groups", + "stock_uom": "Nos", + "has_serial_no": 1, + "serial_no_series": "SRSI.#####", + }, + { + "doctype": "Item", + "item_code": "Stock-Reco-Serial-Item-2", + "item_name": "Stock-Reco-Serial-Item-2", + "is_stock_item": 1, + "item_group": "All Item Groups", + "stock_uom": "Nos", + "has_serial_no": 1, + "serial_no_series": "SRSII.#####", + }, + { + "doctype": "Item", + "item_code": "Stock-Reco-batch-Item-1", + "item_name": "Stock-Reco-batch-Item-1", + "is_stock_item": 1, + "item_group": "All Item Groups", + "stock_uom": "Nos", + "has_batch_no": 1, + "batch_number_series": "BASR.#####", + "create_new_batch": 1, + }, ] cls.item = [] for x in records: From 4b9ae6b0cda6eadb10ee1c26a674f3b779cbca28 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 3 Jan 2026 17:30:32 +0530 Subject: [PATCH 125/217] refactor(test): make purchase receipt deterministic --- .../purchase_receipt/test_purchase_receipt.py | 30 ++++++++---------- .../serial_and_batch_bundle.py | 2 +- erpnext/tests/utils.py | 31 +++++++++++++++++++ 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index a3a32ef233f..c982279b36e 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -35,7 +35,7 @@ class TestPurchaseReceipt(ERPNextTestSuite): cls.load_test_records("Purchase Receipt") def setUp(self): - frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) + frappe.local.future_sle = {} def tearDown(self): frappe.db.rollback() @@ -2665,12 +2665,12 @@ class TestPurchaseReceipt(ERPNextTestSuite): gl_entries = get_gl_entries("Purchase Receipt", pr.name, skip_cancelled=True, as_dict=False) warehouse_account = get_warehouse_account_map("_Test Company") expected_gle = ( - ("Stock Received But Not Billed - _TC", 0, 10000, "Main - _TC"), - ("Freight and Forwarding Charges - _TC", 0, 2000, "Main - _TC"), - ("Expenses Included In Valuation - _TC", 0, 2000, "Main - _TC"), - (warehouse_account[pr.items[0].warehouse]["account"], 14000, 0, "Main - _TC"), + ("Stock Received But Not Billed - _TC", 0.0, 10000.0, "Main - _TC"), + ("Freight and Forwarding Charges - _TC", 0.0, 2000.0, "Main - _TC"), + ("Expenses Included In Valuation - _TC", 0.0, 2000.0, "Main - _TC"), + (warehouse_account[pr.items[0].warehouse]["account"], 14000.0, 0.0, "Main - _TC"), ) - self.assertSequenceEqual(expected_gle, gl_entries) + self.assertCountEqual(expected_gle, gl_entries) frappe.local.enable_perpetual_inventory["_Test Company"] = old_perpetual_inventory def test_purchase_receipt_with_use_serial_batch_field_for_rejected_qty(self): @@ -4179,8 +4179,6 @@ class TestPurchaseReceipt(ERPNextTestSuite): make_purchase_return, ) - frappe.flags.through_repost_item_valuation = False - sn_item_code = make_item( "Test Serial No for Validation", {"has_serial_no": 1, "serial_no_series": "SN-TSNFVAL-.#####"} ).name @@ -4213,8 +4211,6 @@ class TestPurchaseReceipt(ERPNextTestSuite): make_purchase_return, ) - frappe.flags.through_repost_item_valuation = False - batch_item_code = make_item( "Test Batch No for Validation", {"has_batch_no": 1, "batch_number_series": "BT-TSNFVAL-.#####", "create_new_batch": 1}, @@ -4860,8 +4856,14 @@ class TestPurchaseReceipt(ERPNextTestSuite): self.assertRaises(NegativeStockError, pr.cancel) @ERPNextTestSuite.change_settings( - "Buying Settings", {"set_landed_cost_based_on_purchase_invoice_rate": 1, "maintain_same_rate": 0} + "Buying Settings", + { + "set_landed_cost_based_on_purchase_invoice_rate": 1, + "maintain_same_rate": 0, + "allow_multiple_items": 1, + }, ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"over_billing_allowance": 100}) def test_set_lcv_from_pi_created_against_po(self): from erpnext.buying.doctype.purchase_order.purchase_order import ( make_purchase_invoice as make_pi_against_po, @@ -4871,10 +4873,6 @@ class TestPurchaseReceipt(ERPNextTestSuite): ) from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order - original_value = frappe.db.get_single_value("Accounts Settings", "over_billing_allowance") - - frappe.db.set_single_value("Accounts Settings", "over_billing_allowance", 100) - item_code = create_item("Test Item for LCV from PI against PO").name po = create_purchase_order(item_code=item_code, qty=10, rate=400) @@ -4899,8 +4897,6 @@ class TestPurchaseReceipt(ERPNextTestSuite): amt_diff = 5000 * (row.qty / 10) - row.amount self.assertEqual(row.amount_difference_with_purchase_invoice, amt_diff) - frappe.db.set_single_value("Accounts Settings", "over_billing_allowance", original_value) - def test_purchase_return_with_and_without_return_against_rejected_qty(self): from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( make_purchase_return as _make_purchase_return, diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index aa7f276ddc1..5ca0bef74fc 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -443,7 +443,7 @@ class SerialandBatchBundle(Document): self.set_incoming_rate_for_inward_transaction(row, save, prev_sle=prev_sle) def validate_returned_serial_batch_no(self, return_against, row, original_inv_details): - if frappe.flags.through_repost_item_valuation: + if frappe.flags.through_repost_item_valuation and not frappe.in_test: return if row.serial_no and row.serial_no not in original_inv_details["serial_nos"]: diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index bb54b2c45e4..09dc1ca5d56 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -1186,6 +1186,15 @@ class ERPNextTestSuite(unittest.TestCase): "supplier_group": "_Test Supplier Group", "tax_category": "_Test Tax Category 1", }, + { + "doctype": "Supplier", + "supplier_name": "_Test Internal Supplier 2", + "supplier_group": "_Test Supplier Group", + "is_internal_supplier": 1, + "territory": "_Test Territory", + "represents_company": cls.companies[6].name, + "companies": [{"company": cls.companies[6].name}], + }, ] cls.suppliers = [] for x in records: @@ -2218,6 +2227,18 @@ class ERPNextTestSuite(unittest.TestCase): "batch_number_series": "BASR.#####", "create_new_batch": 1, }, + { + "doctype": "Item", + "item_code": "Test Asset Item", + "item_name": "Test Asset Item", + "is_stock_item": 0, + "item_group": "All Item Groups", + "stock_uom": "Box", + "is_fixed_asset": 1, + "auto_create_assets": 1, + "asset_category": cls.asset_category[0].name, + "asset_naming_series": "ABC.###", + }, ] cls.item = [] for x in records: @@ -2405,6 +2426,16 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Customer", "territory": "_Test Territory", }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test Internal Customer 2", + "customer_type": "Individual", + "doctype": "Customer", + "is_internal_customer": 1, + "territory": "_Test Territory", + "represents_company": cls.companies[6].name, + "companies": [{"company": cls.companies[6].name}], + }, ] cls.customer = [] for x in records: From 83d1f53eb1492f73961c7ca0226df742be819e71 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 26 Jan 2026 21:06:07 +0530 Subject: [PATCH 126/217] refactor(test): make subcontracting receipt deterministic --- .../subcontracting_receipt/test_subcontracting_receipt.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py index 6447db4ade4..53466f7405d 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py @@ -207,7 +207,7 @@ class TestSubcontractingReceipt(ERPNextTestSuite): # stock raw materials in a warehouse before transfer make_stock_entry( - target="_Test Warehouse - _TC", item_code="Test Extra Item 1", qty=10, basic_rate=100 + target="_Test Warehouse - _TC", item_code="_Test Extra Item 1", qty=10, basic_rate=100 ) make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test FG Item", qty=1, basic_rate=100) make_stock_entry(target="_Test Warehouse - _TC", item_code="Test Extra Item 2", qty=1, basic_rate=100) @@ -503,7 +503,7 @@ class TestSubcontractingReceipt(ERPNextTestSuite): service_items = [ { "warehouse": warehouse, - "item_code": "Subcontracted Service Item 7", + "item_code": "Subcontracted Service Item 6", "qty": 10, "rate": 0, "fg_item": "Subcontracted Item SA7", @@ -617,6 +617,7 @@ class TestSubcontractingReceipt(ERPNextTestSuite): for item in scr.supplied_items: self.assertFalse(item.available_qty_for_consumption) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_multiple_items": True}) def test_supplied_items_consumed_qty_for_similar_finished_goods(self): """ Test that supplied raw material consumption is calculated correctly @@ -1289,6 +1290,7 @@ class TestSubcontractingReceipt(ERPNextTestSuite): serial_batch_bundle = frappe.get_doc( { "doctype": "Serial and Batch Bundle", + "company": sco.company, "item_code": fg_item, "warehouse": sco.items[0].warehouse, "has_batch_no": 1, From a110b2035001bfdeb91de651e60b870d8dc9fc51 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 28 Jan 2026 17:04:18 +0530 Subject: [PATCH 127/217] refactor(test): make party specific item deterministic --- .../test_party_specific_item.py | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py index 6aaf02572b8..e1e4aca0b28 100644 --- a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py +++ b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py @@ -17,36 +17,37 @@ def create_party_specific_item(**args): class TestPartySpecificItem(ERPNextTestSuite): - def setUp(self): - self.customer = frappe.get_last_doc("Customer") - self.supplier = frappe.get_last_doc("Supplier") - self.item = frappe.get_last_doc("Item") - def test_item_query_for_customer(self): + customer = self.customer[0].name + item = self.item[0].name + create_party_specific_item( party_type="Customer", - party=self.customer.name, + party=customer, restrict_based_on="Item", - based_on_value=self.item.name, + based_on_value=item, ) - filters = {"is_sales_item": 1, "customer": self.customer.name} + filters = {"is_sales_item": 1, "customer": customer} items = item_query( doctype="Item", txt="", searchfield="name", start=0, page_len=20, filters=filters, as_dict=False ) - self.assertTrue(self.item.name in flatten(items)) + self.assertTrue(item in flatten(items)) def test_item_query_for_supplier(self): + supplier = self.suppliers[0].name + item = self.item_group[0].name + create_party_specific_item( party_type="Supplier", - party=self.supplier.name, + party=supplier, restrict_based_on="Item Group", - based_on_value=self.item.item_group, + based_on_value=item, ) - filters = {"supplier": self.supplier.name, "is_purchase_item": 1} + filters = {"supplier": supplier, "is_purchase_item": 1} items = item_query( doctype="Item", txt="", searchfield="name", start=0, page_len=20, filters=filters, as_dict=False ) - self.assertTrue(self.item.item_group in flatten(items)) + self.assertTrue(item in flatten(items)) def flatten(lst): From b8c68be0cb45100bb239fdead3d1359d07039d6f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 28 Jan 2026 17:14:58 +0530 Subject: [PATCH 128/217] refactor(test): make irs supplier test deterministic --- .../united_states/test_united_states.py | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/erpnext/regional/united_states/test_united_states.py b/erpnext/regional/united_states/test_united_states.py index ba282d3657a..e6626da8dcf 100644 --- a/erpnext/regional/united_states/test_united_states.py +++ b/erpnext/regional/united_states/test_united_states.py @@ -11,19 +11,12 @@ from erpnext.tests.utils import ERPNextTestSuite class TestUnitedStates(ERPNextTestSuite): def test_irs_1099_custom_field(self): if not frappe.db.exists("Supplier", "_US 1099 Test Supplier"): - doc = frappe.new_doc("Supplier") - doc.supplier_name = "_US 1099 Test Supplier" - doc.supplier_group = "Services" - doc.supplier_type = "Company" - doc.country = "United States" - doc.tax_id = "04-1234567" - doc.irs_1099 = 1 - doc.save() - frappe.db.commit() + make_irs_1099_supplier() supplier = frappe.get_doc("Supplier", "_US 1099 Test Supplier") self.assertEqual(supplier.irs_1099, 1) def test_irs_1099_report(self): + make_irs_1099_supplier() make_payment_entry_to_irs_1099_supplier() filters = frappe._dict({"fiscal_year": "_Test Fiscal Year 2016", "company": "_Test Company 1"}) columns, data = execute_1099_report(filters) @@ -36,11 +29,19 @@ class TestUnitedStates(ERPNextTestSuite): self.assertEqual(data[0], expected_row) -def make_payment_entry_to_irs_1099_supplier(): - frappe.db.sql("delete from `tabGL Entry` where party='_US 1099 Test Supplier'") - frappe.db.sql("delete from `tabGL Entry` where against='_US 1099 Test Supplier'") - frappe.db.sql("delete from `tabPayment Entry` where party='_US 1099 Test Supplier'") +def make_irs_1099_supplier(): + doc = frappe.new_doc("Supplier") + doc.supplier_name = "_US 1099 Test Supplier" + doc.supplier_group = "Services" + doc.supplier_type = "Company" + doc.country = "United States" + doc.tax_id = "04-1234567" + doc.irs_1099 = 1 + doc.save() + return doc + +def make_payment_entry_to_irs_1099_supplier(): pe = frappe.new_doc("Payment Entry") pe.payment_type = "Pay" pe.company = "_Test Company 1" From fad451d6c26571db7ed088a50d500c8f174a2d39 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 28 Jan 2026 15:54:52 +0530 Subject: [PATCH 129/217] refactor(test): rollback on tearDown --- erpnext/tests/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 09dc1ca5d56..96222afa405 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -139,6 +139,9 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_presets() cls.make_persistent_master_data() + def tearDown(self): + frappe.db.rollback() + @classmethod def load_test_records(cls, doctype): if doctype not in cls.globalTestRecords: From 3c45a0ca442446164a81c1325fc93c0878628684 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 28 Jan 2026 15:52:07 +0530 Subject: [PATCH 130/217] refactor(test): remove explicit commit and dead code --- .../test_stock_ledger_entry.py | 76 ------------------- 1 file changed, 76 deletions(-) diff --git a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py index 8c8e3fee920..c17201564e1 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py @@ -1591,79 +1591,3 @@ def get_unique_suffix(): # Used to isolate valuation sensitive # tests to prevent future tests from failing. return str(uuid4())[:8].upper() - - @classmethod - def setUpClass(cls) -> None: - super().setUpClass() - cls.gle_autoname = frappe.get_meta("GL Entry").autoname - cls.sle_autoname = frappe.get_meta("Stock Ledger Entry").autoname - - def setUp(self) -> None: - self.item = make_item().name - self.warehouse = "Stores - TCP1" - self.company = "_Test Company with perpetual inventory" - - def tearDown(self) -> None: - make_property_setter( - doctype="GL Entry", - for_doctype=True, - property="autoname", - value=self.gle_autoname, - property_type="Data", - fieldname=None, - ) - make_property_setter( - doctype="Stock Ledger Entry", - for_doctype=True, - property="autoname", - value=self.sle_autoname, - property_type="Data", - fieldname=None, - ) - - # since deferred naming autocommits, commit all changes to avoid flake - frappe.db.commit() # nosemgrep - - @staticmethod - def get_gle_sles(se): - filters = {"voucher_type": se.doctype, "voucher_no": se.name} - gle = set(frappe.get_list("GL Entry", filters, pluck="name")) - sle = set(frappe.get_list("Stock Ledger Entry", filters, pluck="name")) - return gle, sle - - def test_deferred_naming(self): - se = make_stock_entry( - item_code=self.item, to_warehouse=self.warehouse, qty=10, rate=100, company=self.company - ) - - gle, sle = self.get_gle_sles(se) - rename_gle_sle_docs() - renamed_gle, renamed_sle = self.get_gle_sles(se) - - self.assertFalse(gle & renamed_gle, msg="GLEs not renamed") - self.assertFalse(sle & renamed_sle, msg="SLEs not renamed") - se.cancel() - - def test_hash_naming(self): - # disable naming series - for doctype in ("GL Entry", "Stock Ledger Entry"): - make_property_setter( - doctype=doctype, - for_doctype=True, - property="autoname", - value="hash", - property_type="Data", - fieldname=None, - ) - - se = make_stock_entry( - item_code=self.item, to_warehouse=self.warehouse, qty=10, rate=100, company=self.company - ) - - gle, sle = self.get_gle_sles(se) - rename_gle_sle_docs() - renamed_gle, renamed_sle = self.get_gle_sles(se) - - self.assertEqual(gle, renamed_gle, msg="GLEs are renamed while using hash naming") - self.assertEqual(sle, renamed_sle, msg="SLEs are renamed while using hash naming") - se.cancel() From 09b8ee869aa86e6f5db0493c601b8357cd4983ea Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 10:18:37 +0530 Subject: [PATCH 131/217] refactor(test): make bank clearance deterministic --- erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py index 2774cc55685..61f7466679f 100644 --- a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py +++ b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py @@ -29,6 +29,7 @@ class TestBankClearance(ERPNextTestSuite): create_item("_Test Item") create_cost_center(cost_center_name="_Test Cost Center", company="_Test Company") + def setUp(self): make_bank_account() add_transactions() From b5b28f2e89c3e1d25321a78f8932d81448d817bf Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 10:33:43 +0530 Subject: [PATCH 132/217] refactor(test): make auto match party deterministic --- .../doctype/bank_transaction/test_auto_match_party.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py b/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py index da8239ac6ac..bb1e436c5f7 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py +++ b/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py @@ -12,19 +12,11 @@ IBAN_2 = "DE02500105170137075030" class TestAutoMatchParty(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): create_bank_account() frappe.db.set_single_value("Accounts Settings", "enable_party_matching", 1) frappe.db.set_single_value("Accounts Settings", "enable_fuzzy_matching", 1) - @classmethod - def tearDownClass(cls): - frappe.db.set_single_value("Accounts Settings", "enable_party_matching", 0) - frappe.db.set_single_value("Accounts Settings", "enable_fuzzy_matching", 0) - super().tearDownClass() - def test_match_by_account_number(self): create_supplier_for_match(account_no=IBAN_1[11:]) doc = create_bank_transaction( From 21acafae7914e0c537938ab42b531bb7a3ec6f66 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 10:57:54 +0530 Subject: [PATCH 133/217] refactor(test): make budget deterministic --- erpnext/accounts/doctype/budget/test_budget.py | 6 ------ erpnext/tests/utils.py | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py index ba9b4c04e08..9632981b1c1 100644 --- a/erpnext/accounts/doctype/budget/test_budget.py +++ b/erpnext/accounts/doctype/budget/test_budget.py @@ -19,12 +19,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestBudget(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.make_monthly_distribution() - cls.make_projects() - def setUp(self): frappe.db.set_single_value("Accounts Settings", "use_legacy_budget_controller", False) self.company = "_Test Company" diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 96222afa405..0d15226842a 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -250,6 +250,8 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_quality_inspection_template() cls.make_employees() cls.make_brand() + cls.make_monthly_distribution() + cls.make_projects() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() From a0d928871d3b8da9b711b5063727f929785de754 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 11:48:51 +0530 Subject: [PATCH 134/217] refactor(test): make dunning deterministic --- .../accounts/doctype/dunning/test_dunning.py | 15 ------ erpnext/tests/utils.py | 48 +++++++++++++++++++ 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/erpnext/accounts/doctype/dunning/test_dunning.py b/erpnext/accounts/doctype/dunning/test_dunning.py index f6bfa1453da..6eaf1d8798e 100644 --- a/erpnext/accounts/doctype/dunning/test_dunning.py +++ b/erpnext/accounts/doctype/dunning/test_dunning.py @@ -8,9 +8,6 @@ from frappe.utils import add_days, nowdate, today from erpnext import get_default_cost_center from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry -from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import ( - unlink_payment_on_cancel_of_invoice, -) from erpnext.accounts.doctype.sales_invoice.sales_invoice import ( create_dunning as create_dunning_from_sales_invoice, ) @@ -21,18 +18,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestDunning(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - create_dunning_type("First Notice", fee=0.0, interest=0.0, is_default=1) - create_dunning_type("Second Notice", fee=10.0, interest=10.0, is_default=0) - unlink_payment_on_cancel_of_invoice() - - @classmethod - def tearDownClass(cls): - unlink_payment_on_cancel_of_invoice(0) - super().tearDownClass() - def test_dunning_without_fees(self): dunning = create_dunning(overdue_days=20) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 0d15226842a..053e3c868af 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -252,6 +252,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_brand() cls.make_monthly_distribution() cls.make_projects() + cls.make_dunning_type() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() @@ -3042,6 +3043,53 @@ class ERPNextTestSuite(unittest.TestCase): else: cls.brand.append(frappe.get_doc("Brand", {"Brand": x.get("brand")})) + @classmethod + def make_dunning_type(cls): + records = [ + { + "doctype": "Dunning Type", + "dunning_type": "First Notice", + "company": cls.companies[0].name, + "is_default": 1, + "dunning_fee": 0, + "rate_of_interest": 0, + "income_account": "Sales - _TC", + "cost_center": "Main - _TC", + "dunning_letter_text": [ + { + "language": "en", + "body_text": "We have still not received payment for our invoice", + "closing_text": "We kindly request that you pay the outstanding amount immediately, including interest and late fees.", + }, + ], + }, + { + "doctype": "Dunning Type", + "dunning_type": "Second Notice", + "company": cls.companies[0].name, + "is_default": 0, + "dunning_fee": 10, + "rate_of_interest": 10, + "income_account": "Sales - _TC", + "cost_center": "Main - _TC", + "dunning_letter_text": [ + { + "language": "en", + "body_text": "We have still not received payment for our invoice", + "closing_text": "We kindly request that you pay the outstanding amount immediately, including interest and late fees.", + }, + ], + }, + ] + cls.dunning_type = [] + for x in records: + if not frappe.db.exists("Dunning Type", {"dunning_type": x.get("dunning_type")}): + cls.dunning_type.append(frappe.get_doc(x).insert()) + else: + cls.dunning_type.append( + frappe.get_doc("Dunning Type", {"dunning_type": x.get("dunning_type")}) + ) + @contextmanager def set_user(self, user: str): try: From 9cd52c245b634ce97546c7ae56881a4622d498be Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 28 Jan 2026 17:50:44 +0530 Subject: [PATCH 135/217] refactor(test): make loyalty point entry deterministic --- .../test_loyalty_point_entry.py | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py index c8f739f42a5..090c905c013 100644 --- a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py +++ b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py @@ -10,22 +10,13 @@ from erpnext.tests.utils import ERPNextTestSuite class TestLoyaltyPointEntry(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): # Create test records - cls.loyalty_program_name = "Test Single Loyalty" - cls.customer_name = "Test Loyalty Customer" - customer = frappe.get_doc("Customer", cls.customer_name) - customer.db_set("loyalty_program", cls.loyalty_program_name) - - @classmethod - def tearDownClass(cls): - # Delete all Loyalty Point Entries - frappe.db.sql("DELETE FROM `tabLoyalty Point Entry` WHERE customer = %s", cls.customer_name) - frappe.db.sql("DELETE FROM `tabSales Invoice` WHERE customer = %s", cls.customer_name) - frappe.db.commit() - # cls.customer.delete() + self.loyalty_program_name = "Test Single Loyalty" + self.customer_name = "Test Loyalty Customer" + customer = frappe.get_doc("Customer", self.customer_name) + customer.loyalty_program = self.loyalty_program_name + customer.save() def create_test_invoice(self, redeem=None): if redeem: @@ -67,9 +58,10 @@ class TestLoyaltyPointEntry(ERPNextTestSuite): self.assertEqual(entry.discretionary_reason, "Customer Appreciation") def test_redeem_loyalty_points(self): - self.create_test_invoice(redeem=10) + self.create_test_invoice() + self.create_test_invoice(redeem=7) doc = frappe.get_last_doc("Loyalty Point Entry") - self.assertEqual(doc.loyalty_points, -10) + self.assertEqual(doc.loyalty_points, -7) # Check balance balance = frappe.db.sql( @@ -81,4 +73,4 @@ class TestLoyaltyPointEntry(ERPNextTestSuite): (self.customer_name,), )[0][0] - self.assertEqual(balance, 75) # 85 added, 10 redeemed + self.assertEqual(balance, 3) # 10 added, 7 redeemed From 6737ccac956f579e4d44477c786aa040752935e0 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 12:58:27 +0530 Subject: [PATCH 136/217] refactor(test): make asset deterministic --- .../sales_invoice/test_sales_invoice.py | 5 +- erpnext/assets/doctype/asset/test_asset.py | 32 +--------- .../test_asset_capitalization.py | 2 - .../test_asset_depreciation_schedule.py | 6 +- .../asset_movement/test_asset_movement.py | 3 +- .../doctype/asset_repair/test_asset_repair.py | 2 - .../test_asset_value_adjustment.py | 2 - erpnext/tests/utils.py | 64 ++++++++++++++++++- 8 files changed, 67 insertions(+), 49 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 3c3e6af23cf..e8f367d14be 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -22,7 +22,7 @@ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import ( from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_inter_company_transaction from erpnext.accounts.utils import PaymentEntryUnlinkError from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries -from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data +from erpnext.assets.doctype.asset.test_asset import create_asset from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_schedule import ( get_depr_schedule, ) @@ -1626,7 +1626,6 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertRaises(frappe.ValidationError, cr_note.save) def test_gle_made_when_asset_is_returned(self): - create_asset_data() asset = create_asset(item_code="Macbook Pro") si = create_sales_invoice(item_code="Macbook Pro", asset=asset.name, qty=1, rate=90000) @@ -3118,7 +3117,6 @@ class TestSalesInvoice(ERPNextTestSuite): Tests if an Asset set to depreciate yearly on June 30, that gets sold on Sept 30, creates an additional depreciation entry on its date of sale. """ - create_asset_data() asset = create_asset(item_code="Macbook Pro", calculate_depreciation=1, submit=1) post_depreciation_entries(getdate("2021-09-30")) @@ -3144,7 +3142,6 @@ class TestSalesInvoice(ERPNextTestSuite): Tests if an Asset set to depreciate yearly on Dec 31, that gets sold on Dec 31 after two years, created an additional depreciation entry on its date of sale. """ - create_asset_data() asset = create_asset( item_code="Macbook Pro", calculate_depreciation=1, diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 87af87a30a4..95f6fdfbd54 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -40,18 +40,10 @@ from erpnext.tests.utils import ERPNextTestSuite class AssetSetup(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): set_depreciation_settings_in_company() - create_asset_data() enable_cwip_accounting("Computers") make_purchase_receipt(item_code="Macbook Pro", qty=1, rate=100000.0, location="Test Location") - frappe.db.sql("delete from `tabTax Rule`") - - @classmethod - def tearDownClass(cls): - frappe.db.rollback() class TestAsset(AssetSetup): @@ -1906,31 +1898,9 @@ def get_gl_entries(doctype, docname): ) -def create_asset_data(): - if not frappe.db.exists("Asset Category", "Computers"): - create_asset_category() - - if not frappe.db.exists("Item", "Macbook Pro"): - create_fixed_asset_item() - - if not frappe.db.exists("Location", "Test Location"): - frappe.get_doc({"doctype": "Location", "location_name": "Test Location"}).insert() - - if not frappe.db.exists("Finance Book", "Test Finance Book 1"): - frappe.get_doc({"doctype": "Finance Book", "finance_book_name": "Test Finance Book 1"}).insert() - - if not frappe.db.exists("Finance Book", "Test Finance Book 2"): - frappe.get_doc({"doctype": "Finance Book", "finance_book_name": "Test Finance Book 2"}).insert() - - if not frappe.db.exists("Finance Book", "Test Finance Book 3"): - frappe.get_doc({"doctype": "Finance Book", "finance_book_name": "Test Finance Book 3"}).insert() - - def create_asset(**args): args = frappe._dict(args) - create_asset_data() - asset = frappe.get_doc( { "doctype": "Asset", diff --git a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py index 2e05f24e06e..f245ac4f0a2 100644 --- a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py @@ -8,7 +8,6 @@ from frappe.utils import cint, flt, now_datetime from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries from erpnext.assets.doctype.asset.test_asset import ( create_asset, - create_asset_data, create_fixed_asset_item, set_depreciation_settings_in_company, ) @@ -26,7 +25,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestAssetCapitalization(ERPNextTestSuite): def setUp(self): set_depreciation_settings_in_company() - create_asset_data() create_asset_capitalization_data() frappe.db.sql("delete from `tabTax Rule`") diff --git a/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py b/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py index c3184f5b224..449f6091d01 100644 --- a/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py +++ b/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py @@ -8,7 +8,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal from erpnext.assets.doctype.asset.depreciation import ( post_depreciation_entries, ) -from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data +from erpnext.assets.doctype.asset.test_asset import create_asset from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_schedule import ( get_asset_depr_schedule_doc, get_depr_schedule, @@ -21,9 +21,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestAssetDepreciationSchedule(ERPNextTestSuite): - def setUp(self): - create_asset_data() - def test_throw_error_if_another_asset_depr_schedule_exist(self): asset = create_asset(item_code="Macbook Pro", calculate_depreciation=1, submit=1) @@ -815,7 +812,6 @@ class TestAssetDepreciationSchedule(ERPNextTestSuite): def test_depreciation_on_return_of_sold_asset(self): from erpnext.controllers.sales_and_purchase_return import make_return_doc - create_asset_data() asset = create_asset(item_code="Macbook Pro", calculate_depreciation=1, submit=1) post_depreciation_entries(getdate("2021-09-30")) diff --git a/erpnext/assets/doctype/asset_movement/test_asset_movement.py b/erpnext/assets/doctype/asset_movement/test_asset_movement.py index 6e70c477d7c..88dd93a93cb 100644 --- a/erpnext/assets/doctype/asset_movement/test_asset_movement.py +++ b/erpnext/assets/doctype/asset_movement/test_asset_movement.py @@ -5,7 +5,7 @@ import unittest import frappe from frappe.utils import add_days, now -from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data +from erpnext.assets.doctype.asset.test_asset import create_asset from erpnext.setup.doctype.employee.test_employee import make_employee from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt from erpnext.tests.utils import ERPNextTestSuite @@ -16,7 +16,6 @@ class TestAssetMovement(ERPNextTestSuite): frappe.db.set_value( "Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC" ) - create_asset_data() make_location() def test_movement(self): diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py index 2d1137197c5..fbc27454890 100644 --- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py @@ -14,7 +14,6 @@ from erpnext.assets.doctype.asset.asset import ( ) from erpnext.assets.doctype.asset.test_asset import ( create_asset, - create_asset_data, set_depreciation_settings_in_company, ) from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_schedule import ( @@ -34,7 +33,6 @@ class TestAssetRepair(ERPNextTestSuite): super().setUpClass() cls.load_test_records("Stock Entry") set_depreciation_settings_in_company() - create_asset_data() create_item("_Test Stock Item") frappe.db.sql("delete from `tabTax Rule`") diff --git a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py index b732ddbf1a1..4fb9b0a67f6 100644 --- a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py +++ b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py @@ -7,7 +7,6 @@ from frappe.utils import add_days, cstr, get_last_day, getdate, nowdate from erpnext.assets.doctype.asset.asset import get_asset_value_after_depreciation from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries -from erpnext.assets.doctype.asset.test_asset import create_asset_data from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_schedule import ( get_asset_depr_schedule_doc, ) @@ -18,7 +17,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestAssetValueAdjustment(ERPNextTestSuite): def setUp(self): - create_asset_data() frappe.db.set_value( "Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC" ) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 053e3c868af..435026e2158 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -253,6 +253,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_monthly_distribution() cls.make_projects() cls.make_dunning_type() + cls.make_finance_book() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() @@ -2245,6 +2246,20 @@ class ERPNextTestSuite(unittest.TestCase): "asset_category": cls.asset_category[0].name, "asset_naming_series": "ABC.###", }, + { + "doctype": "Item", + "item_code": "Macbook Pro", + "item_name": "Macbook Pro", + "description": "Macbook Pro Retina Display", + "asset_category": "Computers", + "item_group": "All Item Groups", + "stock_uom": "Nos", + "is_stock_item": 0, + "is_fixed_asset": 1, + "auto_create_assets": 1, + "is_grouped_asset": 0, + "asset_naming_series": "ACC-ASS-.YYYY.-", + }, ] cls.item = [] for x in records: @@ -2716,7 +2731,29 @@ class ERPNextTestSuite(unittest.TestCase): "depreciation_expense_account": "_Test Depreciations - _TC", } ], - } + }, + { + "doctype": "Asset Category", + "asset_category_name": "Computers", + "total_number_of_depreciations": 3, + "frequency_of_depreciation": 3, + "enable_cwip_accounting": True, + "accounts": [ + { + "company_name": "_Test Company", + "fixed_asset_account": "_Test Fixed Asset - _TC", + "accumulated_depreciation_account": "_Test Accumulated Depreciations - _TC", + "depreciation_expense_account": "_Test Depreciations - _TC", + "capital_work_in_progress_account": "CWIP Account - _TC", + }, + { + "company_name": "_Test Company with perpetual inventory", + "fixed_asset_account": "_Test Fixed Asset - TCP1", + "accumulated_depreciation_account": "_Test Accumulated Depreciations - TCP1", + "depreciation_expense_account": "_Test Depreciations - TCP1", + }, + ], + }, ] cls.asset_category = [] for x in records: @@ -3090,6 +3127,31 @@ class ERPNextTestSuite(unittest.TestCase): frappe.get_doc("Dunning Type", {"dunning_type": x.get("dunning_type")}) ) + @classmethod + def make_finance_book(cls): + records = [ + { + "doctype": "Finance Book", + "finance_book_name": "Test Finance Book 1", + }, + { + "doctype": "Finance Book", + "finance_book_name": "Test Finance Book 2", + }, + { + "doctype": "Finance Book", + "finance_book_name": "Test Finance Book 3", + }, + ] + cls.finance_book = [] + for x in records: + if not frappe.db.exists("Finance Book", {"finance_book_name": x.get("finance_book_name")}): + cls.finance_book.append(frappe.get_doc(x).insert()) + else: + cls.finance_book.append( + frappe.get_doc("Finance Book", {"finance_book_name": x.get("finance_book_name")}) + ) + @contextmanager def set_user(self, user: str): try: From 55ba1fa9aafe2667ae7bcf5620f4fbbc4ac938ef Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 15:05:20 +0530 Subject: [PATCH 137/217] refactor(test): make asset repair deterministic --- erpnext/assets/doctype/asset_repair/test_asset_repair.py | 7 ++----- erpnext/tests/utils.py | 8 ++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py index fbc27454890..1f158e1ea8b 100644 --- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py @@ -28,13 +28,10 @@ from erpnext.tests.utils import ERPNextTestSuite class TestAssetRepair(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Stock Entry") + def setUp(self): + self.load_test_records("Stock Entry") set_depreciation_settings_in_company() create_item("_Test Stock Item") - frappe.db.sql("delete from `tabTax Rule`") def test_asset_status(self): date = nowdate() diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 435026e2158..fcfa64374f4 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -2260,6 +2260,14 @@ class ERPNextTestSuite(unittest.TestCase): "is_grouped_asset": 0, "asset_naming_series": "ACC-ASS-.YYYY.-", }, + { + "doctype": "Item", + "item_code": "_Test Stock Item", + "item_name": "Test Stock Item", + "is_stock_item": 1, + "item_group": "All Item Groups", + "stock_uom": "Nos", + }, ] cls.item = [] for x in records: From 678841c77e6c718c313d94fdb3f8ea75aab9026a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 15:14:25 +0530 Subject: [PATCH 138/217] refactor(test): make purchase order deterministic --- erpnext/buying/doctype/purchase_order/test_purchase_order.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index f2803dd2b95..fefa8717bd5 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -30,6 +30,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPurchaseOrder(ERPNextTestSuite): + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_multiple_items": 1}) def test_purchase_order_qty(self): po = create_purchase_order(qty=1, do_not_save=True) @@ -851,6 +852,7 @@ class TestPurchaseOrder(ERPNextTestSuite): self.assertEqual(po_doc.advance_paid, 0) self.assertEqual(po_doc.party_account_currency, "USD") + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_multiple_items": 1}) def test_schedule_date(self): po = create_purchase_order(do_not_submit=True) po.schedule_date = None From c91c169f409360d2b6a0454528486fb9967ac3df Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 15:16:08 +0530 Subject: [PATCH 139/217] refactor(test): make leads deterministic --- erpnext/crm/doctype/lead/test_lead.py | 5 ----- erpnext/tests/utils.py | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py index ac9f7a0fa08..0c37575a465 100644 --- a/erpnext/crm/doctype/lead/test_lead.py +++ b/erpnext/crm/doctype/lead/test_lead.py @@ -12,11 +12,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestLead(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.make_leads() - def test_make_customer(self): from erpnext.crm.doctype.lead.lead import make_customer diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index fcfa64374f4..96f662c7034 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -254,6 +254,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_projects() cls.make_dunning_type() cls.make_finance_book() + cls.make_leads() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() From 0d367fa25f97b38e13d37088caf25aea5419f9a8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 15:17:38 +0530 Subject: [PATCH 140/217] refactor(test): make maintenance schedule deterministic --- .../maintenance_schedule/test_maintenance_schedule.py | 7 ++----- erpnext/tests/utils.py | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py index aec5e34bbb7..52b503ef467 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py @@ -16,11 +16,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestMaintenanceSchedule(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Stock Entry") - cls.make_sales_person() + def setUp(self): + self.load_test_records("Stock Entry") @classmethod def make_sales_person(cls): diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 96f662c7034..8e8e38853a3 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -255,6 +255,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_dunning_type() cls.make_finance_book() cls.make_leads() + cls.make_sales_person() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() From dde67315451448fac2f9e3063243652a7651f552 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 15:30:29 +0530 Subject: [PATCH 141/217] refactor(test): make project deterministic --- erpnext/projects/doctype/project/test_project.py | 6 ------ erpnext/tests/utils.py | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/erpnext/projects/doctype/project/test_project.py b/erpnext/projects/doctype/project/test_project.py index 0113397a532..bea5c05e1d0 100644 --- a/erpnext/projects/doctype/project/test_project.py +++ b/erpnext/projects/doctype/project/test_project.py @@ -13,12 +13,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestProject(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.make_projects() - cls.make_activity_type() - def test_project_total_costing_and_billing_amount(self): from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet from erpnext.setup.doctype.employee.test_employee import make_employee diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 8e8e38853a3..223181c078a 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -256,6 +256,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_finance_book() cls.make_leads() cls.make_sales_person() + cls.make_activity_type() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() From f6ccef2935de5e6029af21f7ee29609e549b6ba6 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 15:33:57 +0530 Subject: [PATCH 142/217] refactor(test): make task deterministic --- erpnext/projects/doctype/task/test_task.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/erpnext/projects/doctype/task/test_task.py b/erpnext/projects/doctype/task/test_task.py index 35e3b3f4d00..066e5960b3f 100644 --- a/erpnext/projects/doctype/task/test_task.py +++ b/erpnext/projects/doctype/task/test_task.py @@ -10,12 +10,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestTask(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.make_projects() - cls.make_activity_type() - def test_task_total_costing_and_billing_amount(self): from erpnext.projects.doctype.project.test_project import make_project from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet From a5defce696ea2f172aec2a545a862c495bc9173f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 15:43:47 +0530 Subject: [PATCH 143/217] refactor(test): make timesheet deterministic --- .../doctype/timesheet/test_timesheet.py | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py index afbccea374f..31d84908376 100644 --- a/erpnext/projects/doctype/timesheet/test_timesheet.py +++ b/erpnext/projects/doctype/timesheet/test_timesheet.py @@ -15,15 +15,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestTimesheet(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.make_projects() - cls.make_activity_type() - - def setUp(self): - frappe.db.delete("Timesheet") - def test_timesheet_post_update(self): frappe.get_doc( { @@ -74,7 +65,7 @@ class TestTimesheet(ERPNextTestSuite): ) def test_timesheet_base_amount(self): - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) timesheet = make_timesheet(emp, simulate=True, is_billable=1) self.assertEqual(timesheet.time_logs[0].base_billing_rate, 50) @@ -83,7 +74,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(timesheet.time_logs[0].base_costing_amount, 40) def test_timesheet_billing_amount(self): - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) timesheet = make_timesheet(emp, simulate=True, is_billable=1) self.assertEqual(timesheet.total_hours, 2) @@ -93,7 +84,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(timesheet.total_billable_amount, 100) def test_timesheet_billing_amount_not_billable(self): - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) timesheet = make_timesheet(emp, simulate=True, is_billable=0) self.assertEqual(timesheet.total_hours, 2) @@ -121,7 +112,7 @@ class TestTimesheet(ERPNextTestSuite): @ERPNextTestSuite.change_settings("Projects Settings", {"fetch_timesheet_in_sales_invoice": 1}) def test_timesheet_billing_based_on_project(self): - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) project = frappe.get_value("Project", {"project_name": "_Test Project"}) timesheet = make_timesheet( @@ -137,7 +128,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(ts.time_logs[0].sales_invoice, sales_invoice.name) def test_timesheet_time_overlap(self): - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) settings = frappe.get_single("Projects Settings") initial_setting = settings.ignore_employee_time_overlap @@ -193,7 +184,7 @@ class TestTimesheet(ERPNextTestSuite): settings.save() def test_timesheet_not_overlapping_with_continuous_timelogs(self): - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) update_activity_type("_Test Activity Type") timesheet = frappe.new_doc("Timesheet") @@ -222,7 +213,7 @@ class TestTimesheet(ERPNextTestSuite): timesheet.save() # should not throw an error def test_to_time(self): - emp = make_employee("test_employee_6@salary.com") + emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) from_time = now_datetime() timesheet = frappe.new_doc("Timesheet") From 9bf9068df7656f848d101c2d2a630ce6bd1f026f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 16:36:56 +0530 Subject: [PATCH 144/217] refactor(test): make item group deterministic --- erpnext/setup/doctype/item_group/test_item_group.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py index d0a72ae2c98..fc08390b351 100644 --- a/erpnext/setup/doctype/item_group/test_item_group.py +++ b/erpnext/setup/doctype/item_group/test_item_group.py @@ -16,10 +16,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestItem(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Item Group") + def setUp(self): + self.load_test_records("Item Group") def test_basic_tree(self, records=None): min_lft = 1 From 3afd39ce038aecc21f07c3c56385814c292a020b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 19:45:48 +0530 Subject: [PATCH 145/217] refactor(test): make sales invoice deterministic --- erpnext/tests/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 223181c078a..542ecdc7588 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -1273,6 +1273,7 @@ class ERPNextTestSuite(unittest.TestCase): @classmethod def make_location(cls): records = [ + {"doctype": "Location", "location_name": "Test Location"}, {"doctype": "Location", "location_name": "Test Location Area", "is_group": 1, "is_container": 1}, { "doctype": "Location", From b23570c1b3bc6f0f719511ed47a41567d9dd6f96 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 30 Jan 2026 11:15:23 +0530 Subject: [PATCH 146/217] refactor(test): remove redundant create_asset_category --- .../doctype/purchase_invoice/test_purchase_invoice.py | 5 ----- erpnext/stock/doctype/item/test_item.py | 4 ++-- .../doctype/landed_cost_voucher/test_landed_cost_voucher.py | 5 +---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 5c11172c4b5..1c51daccd60 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -2454,11 +2454,6 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): self.assertEqual(row.rejected_serial_no, serial_nos[2]) def test_make_pr_and_pi_from_po(self): - from erpnext.assets.doctype.asset.test_asset import create_asset_category - - if not frappe.db.exists("Asset Category", "Computers"): - create_asset_category() - item = create_item( item_code="_Test_Item", is_stock_item=0, is_fixed_asset=1, asset_category="Computers" ) diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 6ca1ebc46f9..d2b0f59ae97 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -169,9 +169,9 @@ class TestItem(ERPNextTestSuite): self.assertEqual(value, details.get(key), key) def test_get_asset_item_details(self): - from erpnext.assets.doctype.asset.test_asset import create_asset_category, create_fixed_asset_item + from erpnext.assets.doctype.asset.test_asset import create_fixed_asset_item - create_asset_category(0) + frappe.db.set_value("Asset Category", "Computers", "enable_cwip_accounting", 0) create_fixed_asset_item() details = get_item_details( diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py index 5a9cf4b76ca..0645957a22a 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py @@ -10,7 +10,7 @@ from frappe.utils import add_days, add_to_date, flt, now, nowtime, today from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.utils import update_gl_entries_after -from erpnext.assets.doctype.asset.test_asset import create_asset_category, create_fixed_asset_item +from erpnext.assets.doctype.asset.test_asset import create_fixed_asset_item from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import ( get_gl_entries, @@ -604,9 +604,6 @@ class TestLandedCostVoucher(ERPNextTestSuite): "Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC" ) - if not frappe.db.exists("Asset Category", "Computers"): - create_asset_category() - if not frappe.db.exists("Item", "Macbook Pro"): create_fixed_asset_item() From cbc2eb33a57375c1f229d76372d95956969acba1 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 30 Jan 2026 11:25:47 +0530 Subject: [PATCH 147/217] chore: typo --- erpnext/setup/doctype/item_group/test_item_group.py | 2 +- erpnext/stock/doctype/item/test_item.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py index fc08390b351..dd9f216b5b5 100644 --- a/erpnext/setup/doctype/item_group/test_item_group.py +++ b/erpnext/setup/doctype/item_group/test_item_group.py @@ -15,7 +15,7 @@ from frappe.utils.nestedset import ( from erpnext.tests.utils import ERPNextTestSuite -class TestItem(ERPNextTestSuite): +class TestItemGroup(ERPNextTestSuite): def setUp(self): self.load_test_records("Item Group") diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index d2b0f59ae97..4ac38780c69 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -887,7 +887,7 @@ class TestItem(ERPNextTestSuite): item.reload() self.assertEqual(item.is_stock_item, 1) - def test_serach_fields_for_item(self): + def test_search_fields_for_item(self): from erpnext.controllers.queries import item_query make_property_setter("Item", None, "search_fields", "item_name", "Data", for_doctype="Doctype") From dc5fa0f5e1de643515bdc230c3c8a7cdb556e92e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 30 Jan 2026 11:28:17 +0530 Subject: [PATCH 148/217] refactor(test): make packed item deterministic --- .../stock/doctype/packed_item/test_packed_item.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/erpnext/stock/doctype/packed_item/test_packed_item.py b/erpnext/stock/doctype/packed_item/test_packed_item.py index de8f6a81533..e7b22d04033 100644 --- a/erpnext/stock/doctype/packed_item/test_packed_item.py +++ b/erpnext/stock/doctype/packed_item/test_packed_item.py @@ -43,15 +43,13 @@ def create_product_bundle( class TestPackedItem(ERPNextTestSuite): "Test impact on Packed Items table in various scenarios." - @classmethod - def setUpClass(cls) -> None: - super().setUpClass() - cls.warehouse = "_Test Warehouse - _TC" + def setUp(self) -> None: + self.warehouse = "_Test Warehouse - _TC" - cls.bundle, cls.bundle_items = create_product_bundle(warehouse=cls.warehouse) - cls.bundle2, cls.bundle2_items = create_product_bundle(warehouse=cls.warehouse) + self.bundle, self.bundle_items = create_product_bundle(warehouse=self.warehouse) + self.bundle2, self.bundle2_items = create_product_bundle(warehouse=self.warehouse) - cls.normal_item = make_item().name + self.normal_item = make_item().name def test_adding_bundle_item(self): "Test impact on packed items if bundle item row is added." From e24c4fcb15224626edf381f7d414aaef95417c0d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 30 Jan 2026 12:34:39 +0530 Subject: [PATCH 149/217] refactor(test): make item group deterministic 'Item Group C' follows 'Item Group B'. So `lft` will increase while `rgt` stays the same. --- erpnext/setup/doctype/item_group/test_item_group.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py index dd9f216b5b5..20884664704 100644 --- a/erpnext/setup/doctype/item_group/test_item_group.py +++ b/erpnext/setup/doctype/item_group/test_item_group.py @@ -106,7 +106,6 @@ class TestItemGroup(ERPNextTestSuite): old_lft, old_rgt = frappe.db.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"]) group_b_3 = frappe.get_doc("Item Group", "_Test Item Group B - 3") - lft, rgt = group_b_3.lft, group_b_3.rgt # child of right sibling is moved into it group_b_3.parent_item_group = "_Test Item Group C" @@ -116,10 +115,10 @@ class TestItemGroup(ERPNextTestSuite): new_lft, new_rgt = frappe.db.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"]) # lft should remain the same - self.assertEqual(old_lft - new_lft, 0) + self.assertEqual(old_lft - new_lft, 2) # rgt should increase - self.assertEqual(new_rgt - old_rgt, rgt - lft + 1) + self.assertEqual(new_rgt - old_rgt, 0) # move it back group_b_3 = frappe.get_doc("Item Group", "_Test Item Group B - 3") From b3507a569a8053735fa9296f9908fe90f804ce8a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Jan 2026 16:36:38 +0530 Subject: [PATCH 150/217] refactor(test): make inventory dimension deterministic fixed flaky test 'test_inventory_dimension' use '3' precision for test_opening_balnace --- .../test_inventory_dimension.py | 126 +----------------- .../stock_balance/test_stock_balance.py | 1 + erpnext/tests/utils.py | 121 +++++++++++++++++ 3 files changed, 126 insertions(+), 122 deletions(-) diff --git a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py index ca61b9344c0..cbf6059a812 100644 --- a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py +++ b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py @@ -24,7 +24,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestInventoryDimension(ERPNextTestSuite): def setUp(self): prepare_test_data() - create_store_dimension() def test_validate_inventory_dimension(self): # Can not be child doc @@ -557,144 +556,27 @@ def get_voucher_sl_entries(voucher_no, fields): ) -def create_store_dimension(): - if not frappe.db.exists("DocType", "Store"): - frappe.get_doc( - { - "doctype": "DocType", - "name": "Store", - "module": "Stock", - "custom": 1, - "naming_rule": "By fieldname", - "autoname": "field:store_name", - "fields": [{"label": "Store Name", "fieldname": "store_name", "fieldtype": "Data"}], - "permissions": [ - { - "role": "System Manager", - "permlevel": 0, - "read": 1, - "write": 1, - "create": 1, - "delete": 1, - } - ], - } - ).insert(ignore_permissions=True) - - for store in ["Store 1", "Store 2"]: - if not frappe.db.exists("Store", store): - frappe.get_doc({"doctype": "Store", "store_name": store}).insert(ignore_permissions=True) - - def prepare_test_data(): - if not frappe.db.exists("DocType", "Shelf"): - frappe.get_doc( - { - "doctype": "DocType", - "name": "Shelf", - "module": "Stock", - "custom": 1, - "naming_rule": "By fieldname", - "autoname": "field:shelf_name", - "fields": [{"label": "Shelf Name", "fieldname": "shelf_name", "fieldtype": "Data"}], - "permissions": [ - { - "role": "System Manager", - "permlevel": 0, - "read": 1, - "write": 1, - "create": 1, - "delete": 1, - } - ], - } - ).insert(ignore_permissions=True) - for shelf in ["Shelf 1", "Shelf 2"]: if not frappe.db.exists("Shelf", shelf): frappe.get_doc({"doctype": "Shelf", "shelf_name": shelf}).insert(ignore_permissions=True) create_warehouse("Shelf Warehouse") - if not frappe.db.exists("DocType", "Rack"): - frappe.get_doc( - { - "doctype": "DocType", - "name": "Rack", - "module": "Stock", - "custom": 1, - "naming_rule": "By fieldname", - "autoname": "field:rack_name", - "fields": [{"label": "Rack Name", "fieldname": "rack_name", "fieldtype": "Data"}], - "permissions": [ - { - "role": "System Manager", - "permlevel": 0, - "read": 1, - "write": 1, - "create": 1, - "delete": 1, - } - ], - } - ).insert(ignore_permissions=True) - for rack in ["Rack 1", "Rack 2"]: if not frappe.db.exists("Rack", rack): frappe.get_doc({"doctype": "Rack", "rack_name": rack}).insert(ignore_permissions=True) create_warehouse("Rack Warehouse") - if not frappe.db.exists("DocType", "Pallet"): - frappe.get_doc( - { - "doctype": "DocType", - "name": "Pallet", - "module": "Stock", - "custom": 1, - "naming_rule": "By fieldname", - "autoname": "field:pallet_name", - "fields": [{"label": "Pallet Name", "fieldname": "pallet_name", "fieldtype": "Data"}], - "permissions": [ - { - "role": "System Manager", - "permlevel": 0, - "read": 1, - "write": 1, - "create": 1, - "delete": 1, - } - ], - } - ).insert(ignore_permissions=True) - - if not frappe.db.exists("DocType", "Inv Site"): - frappe.get_doc( - { - "doctype": "DocType", - "name": "Inv Site", - "module": "Stock", - "custom": 1, - "naming_rule": "By fieldname", - "autoname": "field:site_name", - "fields": [{"label": "Site Name", "fieldname": "site_name", "fieldtype": "Data"}], - "permissions": [ - { - "role": "System Manager", - "permlevel": 0, - "read": 1, - "write": 1, - "create": 1, - "delete": 1, - } - ], - } - ).insert(ignore_permissions=True) - for site in ["Site 1", "Site 2"]: if not frappe.db.exists("Inv Site", site): frappe.get_doc({"doctype": "Inv Site", "site_name": site}).insert(ignore_permissions=True) + for store in ["Store 1", "Store 2"]: + if not frappe.db.exists("Store", store): + frappe.get_doc({"doctype": "Store", "store_name": store}).insert(ignore_permissions=True) + def create_inventory_dimension(**args): args = frappe._dict(args) diff --git a/erpnext/stock/report/stock_balance/test_stock_balance.py b/erpnext/stock/report/stock_balance/test_stock_balance.py index 1ab36a5c011..0759a5a1ad1 100644 --- a/erpnext/stock/report/stock_balance/test_stock_balance.py +++ b/erpnext/stock/report/stock_balance/test_stock_balance.py @@ -106,6 +106,7 @@ class TestStockBalance(ERPNextTestSuite): ) self.assertInvariants(rows) + @ERPNextTestSuite.change_settings("System Settings", {"float_precision": 3, "currency_precision": 3}) def test_opening_balance(self): self.generate_stock_ledger( self.item.name, diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 542ecdc7588..afd78dfa9de 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -263,6 +263,10 @@ class ERPNextTestSuite(unittest.TestCase): frappe.db.commit() + # custom doctype + # DDL commands have implicit commit + cls.make_custom_doctype() + @classmethod def update_system_settings(cls): system_settings = frappe.get_doc("System Settings") @@ -3164,6 +3168,123 @@ class ERPNextTestSuite(unittest.TestCase): frappe.get_doc("Finance Book", {"finance_book_name": x.get("finance_book_name")}) ) + @classmethod + def make_custom_doctype(cls): + if not frappe.db.exists("DocType", "Shelf"): + frappe.get_doc( + { + "doctype": "DocType", + "name": "Shelf", + "module": "Stock", + "custom": 1, + "naming_rule": "By fieldname", + "autoname": "field:shelf_name", + "fields": [{"label": "Shelf Name", "fieldname": "shelf_name", "fieldtype": "Data"}], + "permissions": [ + { + "role": "System Manager", + "permlevel": 0, + "read": 1, + "write": 1, + "create": 1, + "delete": 1, + } + ], + } + ).insert(ignore_permissions=True) + + if not frappe.db.exists("DocType", "Rack"): + frappe.get_doc( + { + "doctype": "DocType", + "name": "Rack", + "module": "Stock", + "custom": 1, + "naming_rule": "By fieldname", + "autoname": "field:rack_name", + "fields": [{"label": "Rack Name", "fieldname": "rack_name", "fieldtype": "Data"}], + "permissions": [ + { + "role": "System Manager", + "permlevel": 0, + "read": 1, + "write": 1, + "create": 1, + "delete": 1, + } + ], + } + ).insert(ignore_permissions=True) + + if not frappe.db.exists("DocType", "Pallet"): + frappe.get_doc( + { + "doctype": "DocType", + "name": "Pallet", + "module": "Stock", + "custom": 1, + "naming_rule": "By fieldname", + "autoname": "field:pallet_name", + "fields": [{"label": "Pallet Name", "fieldname": "pallet_name", "fieldtype": "Data"}], + "permissions": [ + { + "role": "System Manager", + "permlevel": 0, + "read": 1, + "write": 1, + "create": 1, + "delete": 1, + } + ], + } + ).insert(ignore_permissions=True) + + if not frappe.db.exists("DocType", "Inv Site"): + frappe.get_doc( + { + "doctype": "DocType", + "name": "Inv Site", + "module": "Stock", + "custom": 1, + "naming_rule": "By fieldname", + "autoname": "field:site_name", + "fields": [{"label": "Site Name", "fieldname": "site_name", "fieldtype": "Data"}], + "permissions": [ + { + "role": "System Manager", + "permlevel": 0, + "read": 1, + "write": 1, + "create": 1, + "delete": 1, + } + ], + } + ).insert(ignore_permissions=True) + + if not frappe.db.exists("DocType", "Store"): + frappe.get_doc( + { + "doctype": "DocType", + "name": "Store", + "module": "Stock", + "custom": 1, + "naming_rule": "By fieldname", + "autoname": "field:store_name", + "fields": [{"label": "Store Name", "fieldname": "store_name", "fieldtype": "Data"}], + "permissions": [ + { + "role": "System Manager", + "permlevel": 0, + "read": 1, + "write": 1, + "create": 1, + "delete": 1, + } + ], + } + ).insert(ignore_permissions=True) + @contextmanager def set_user(self, user: str): try: From 63908ad6dc5b99ab7e91313226aff2a6d48a5bdd Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 30 Jan 2026 14:31:29 +0530 Subject: [PATCH 151/217] refactor(test): remove redundant tearDown, tearDownClass and rollback --- .../test_accounting_dimension.py | 5 ----- .../test_accounting_dimension_filter.py | 11 ----------- .../accounting_period/test_accounting_period.py | 4 ---- .../accounts_settings/test_accounts_settings.py | 7 ------- .../test_advance_payment_ledger_entry.py | 3 --- .../test_bank_reconciliation_tool.py | 3 --- .../doctype/coupon_code/test_coupon_code.py | 3 --- .../test_exchange_rate_revaluation.py | 3 --- .../doctype/journal_entry/test_journal_entry.py | 1 - .../doctype/ledger_health/test_ledger_health.py | 3 --- .../doctype/ledger_merge/test_ledger_merge.py | 13 ------------- .../test_opening_invoice_creation_tool.py | 3 --- .../doctype/payment_entry/test_payment_entry.py | 3 --- .../test_payment_ledger_entry.py | 3 --- .../doctype/payment_order/test_payment_order.py | 3 --- .../test_payment_reconciliation.py | 3 --- .../doctype/payment_request/test_payment_request.py | 3 --- .../test_payment_terms_template.py | 3 --- .../pos_closing_entry/test_pos_closing_entry.py | 4 ---- .../doctype/pos_invoice/test_pos_invoice.py | 3 --- .../doctype/pos_invoice/test_pos_invoice_merge.py | 4 ---- .../test_pos_invoice_merge_log.py | 5 ----- .../pos_opening_entry/test_pos_opening_entry.py | 4 ---- .../doctype/pricing_rule/test_pricing_rule.py | 3 --- .../test_process_statement_of_accounts.py | 3 --- .../test_repost_accounting_ledger.py | 3 --- .../doctype/sales_invoice/test_sales_invoice.py | 3 --- .../doctype/subscription/test_subscription.py | 3 --- .../test_tax_withholding_category.py | 3 --- .../unreconcile_payment/test_unreconcile_payment.py | 3 --- .../accounts_payable/test_accounts_payable.py | 3 --- .../accounts_receivable/test_accounts_receivable.py | 3 --- .../test_accounts_receivable_summary.py | 3 --- .../test_customer_ledger_summary.py | 3 --- .../test_deferred_revenue_and_expense.py | 3 --- .../test_general_and_payment_ledger_comparison.py | 3 --- .../report/gross_profit/test_gross_profit.py | 3 --- .../test_item_wise_purchase_register.py | 3 --- .../test_item_wise_sales_register.py | 3 --- .../test_profit_and_loss_statement.py | 3 --- .../report/sales_register/test_sales_register.py | 3 --- .../test_supplier_ledger_summary.py | 3 --- .../test_tax_withholding_details.py | 3 --- .../report/trial_balance/test_trial_balance.py | 4 ---- erpnext/accounts/test/test_utils.py | 4 ---- .../test_asset_shift_allocation.py | 4 ---- .../test_requested_items_to_order_and_receive.py | 3 --- .../controllers/tests/test_accounts_controller.py | 3 --- erpnext/controllers/tests/test_qty_based_taxes.py | 9 --------- erpnext/controllers/tests/test_reactivity.py | 3 --- .../doctype/plaid_settings/test_plaid_settings.py | 13 ------------- .../test_maintenance_schedule.py | 4 ---- .../doctype/bom_update_log/test_bom_update_log.py | 3 --- .../doctype/bom_update_tool/test_bom_update_tool.py | 3 --- .../manufacturing/doctype/job_card/test_job_card.py | 3 --- .../doctype/production_plan/test_production_plan.py | 5 ----- .../doctype/work_order/test_work_order.py | 4 ---- erpnext/manufacturing/report/test_reports.py | 3 --- .../test_delayed_tasks_summary.py | 4 ---- .../vat_audit_report/test_vat_audit_report.py | 4 ---- erpnext/selling/doctype/customer/test_customer.py | 5 ----- .../selling/doctype/sales_order/test_sales_order.py | 3 --- .../test_payment_terms_status_for_sales_order.py | 3 --- ...s_partner_target_variance_based_on_item_group.py | 3 --- ...es_person_target_variance_based_on_item_group.py | 3 --- .../currency_exchange/test_currency_exchange.py | 4 ---- erpnext/setup/doctype/employee/test_employee.py | 3 --- .../test_transaction_deletion_record.py | 5 ----- erpnext/stock/doctype/bin/test_bin.py | 2 -- .../doctype/delivery_note/test_delivery_note.py | 7 ------- .../doctype/delivery_trip/test_delivery_trip.py | 3 --- erpnext/stock/doctype/item/test_item.py | 1 - erpnext/stock/doctype/item_price/test_item_price.py | 1 - .../material_request/test_material_request.py | 3 --- .../purchase_receipt/test_purchase_receipt.py | 3 --- .../test_repost_item_valuation.py | 3 --- erpnext/stock/doctype/serial_no/test_serial_no.py | 3 --- .../stock/doctype/stock_entry/test_stock_entry.py | 4 ---- .../stock_ledger_entry/test_stock_ledger_entry.py | 3 --- .../test_stock_reconciliation.py | 3 --- .../test_stock_reservation_entry.py | 4 ---- .../available_serial_no/test_available_serial_no.py | 3 --- .../report/reserved_stock/test_reserved_stock.py | 4 ---- .../report/stock_balance/test_stock_balance.py | 3 --- .../report/stock_ledger/test_stock_ledger_report.py | 3 --- erpnext/stock/tests/test_valuation.py | 10 ---------- .../test_subcontracting_order.py | 3 --- .../test_service_level_agreement.py | 4 ---- 88 files changed, 332 deletions(-) diff --git a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py index c16c8c28c32..81e639dc6b2 100644 --- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py @@ -78,11 +78,6 @@ class TestAccountingDimension(ERPNextTestSuite): si.save() self.assertRaises(frappe.ValidationError, si.submit) - def tearDown(self): - disable_dimension() - frappe.flags.accounting_dimensions_details = None - frappe.flags.dimension_filter_map = None - def create_dimension(): frappe.set_user("Administrator") diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py index 6ea3ebc7b2d..9bed10824bb 100644 --- a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py +++ b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py @@ -43,17 +43,6 @@ class TestAccountingDimensionFilter(ERPNextTestSuite): self.assertRaises(MandatoryAccountDimensionError, si.submit) self.invoice_list.append(si) - def tearDown(self): - disable_dimension_filter() - disable_dimension() - frappe.flags.accounting_dimensions_details = None - frappe.flags.dimension_filter_map = None - - for si in self.invoice_list: - si.load_from_db() - if si.docstatus == 1: - si.cancel() - def create_accounting_dimension_filter(): if not frappe.db.get_value("Accounting Dimension Filter", {"accounting_dimension": "Cost Center"}): diff --git a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py index 448b6cf7e2f..84df275f305 100644 --- a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py +++ b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py @@ -88,10 +88,6 @@ class TestAccountingPeriod(ERPNextTestSuite): doc.submit() # Should not raise self.assertEqual(doc.docstatus, 1) - def tearDown(self): - for d in frappe.get_all("Accounting Period"): - frappe.delete_doc("Accounting Period", d.name) - def create_accounting_period(**args): args = frappe._dict(args) diff --git a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py index 57b020a24dc..d57bd1cc009 100644 --- a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py @@ -6,13 +6,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestAccountsSettings(ERPNextTestSuite): - def tearDown(self): - # Just in case `save` method succeeds, we need to take things back to default so that other tests - # don't break - cur_settings = frappe.get_doc("Accounts Settings", "Accounts Settings") - cur_settings.allow_stale = 1 - cur_settings.save() - def test_stale_days(self): cur_settings = frappe.get_doc("Accounts Settings", "Accounts Settings") cur_settings.allow_stale = 0 diff --git a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py index 08cd7c9504c..53047b61718 100644 --- a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py +++ b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py @@ -28,9 +28,6 @@ class TestAdvancePaymentLedgerEntry(AccountsTestMixin, ERPNextTestSuite): self.create_item() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_sales_order(self, qty=1, rate=100, currency="INR", do_not_submit=False): """ Helper method diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py index 96ef76c934b..5354aa0c4dd 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py @@ -24,9 +24,6 @@ class TestBankReconciliationTool(AccountsTestMixin, ERPNextTestSuite): qb.from_(bank_dt).delete().where(bank_dt.name == "HDFC").run() self.create_bank_account() - def tearDown(self): - frappe.db.rollback() - def create_bank_account(self): bank = frappe.get_doc( { diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py index e7bcf115f1f..770c24cd740 100644 --- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py +++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py @@ -113,9 +113,6 @@ class TestCouponCode(ERPNextTestSuite): def setUp(self): test_create_test_data() - def tearDown(self): - frappe.set_user("Administrator") - def test_sales_order_with_coupon_code(self): frappe.db.set_value("Coupon Code", "SAVE30", "used", 0) diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py index e8f57730892..1310a8b482b 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py @@ -22,9 +22,6 @@ class TestExchangeRateRevaluation(AccountsTestMixin, ERPNextTestSuite): self.clear_old_entries() self.set_system_and_company_settings() - def tearDown(self): - frappe.db.rollback() - def set_system_and_company_settings(self): # set number and currency precision system_settings = frappe.get_doc("System Settings") diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index 69ff1049e47..53d6013e1e2 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -150,7 +150,6 @@ class TestJournalEntry(ERPNextTestSuite): if account_bal == stock_bal: self.assertRaises(StockAccountInvalidTransaction, jv.save) - frappe.db.rollback() else: jv.submit() jv.cancel() diff --git a/erpnext/accounts/doctype/ledger_health/test_ledger_health.py b/erpnext/accounts/doctype/ledger_health/test_ledger_health.py index d94ccb53afe..84fd3925ded 100644 --- a/erpnext/accounts/doctype/ledger_health/test_ledger_health.py +++ b/erpnext/accounts/doctype/ledger_health/test_ledger_health.py @@ -17,9 +17,6 @@ class TestLedgerHealth(AccountsTestMixin, ERPNextTestSuite): self.configure_monitoring_tool() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def configure_monitoring_tool(self): monitor_settings = frappe.get_doc("Ledger Health Monitor") monitor_settings.enable_health_monitor = True diff --git a/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py b/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py index df45ab646d6..28822dff52d 100644 --- a/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py +++ b/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py @@ -101,16 +101,3 @@ class TestLedgerMerge(ERPNextTestSuite): self.assertFalse(frappe.db.exists("Account", "Indirect Test Income - _TC")) self.assertTrue(frappe.db.exists("Account", "Administrative Test Income - _TC")) - - def tearDown(self): - for entry in frappe.db.get_all("Ledger Merge"): - frappe.delete_doc("Ledger Merge", entry.name) - - test_accounts = [ - "Indirect Test Expenses - _TC", - "Administrative Test Expenses - _TC", - "Indirect Test Income - _TC", - "Administrative Test Income - _TC", - ] - for account in test_accounts: - frappe.delete_doc_if_exists("Account", account) diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py index bfe0bd13e90..ffcebcf9d1b 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py @@ -147,9 +147,6 @@ class TestOpeningInvoiceCreationTool(ERPNextTestSuite): } self.check_expected_values(invoices, expected_value, invoice_type="Sales") - def tearDown(self): - disable_dimension() - def get_opening_invoice_creation_dict(**args): party = "Customer" if args.get("invoice_type", "Sales") == "Sales" else "Supplier" diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index dc7d1d21595..12f5276fbfb 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -27,9 +27,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPaymentEntry(ERPNextTestSuite): - def tearDown(self): - frappe.db.rollback() - def get_journals_for(self, voucher_type: str, voucher_no: str) -> list: journals = [] if voucher_type and voucher_no: diff --git a/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py b/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py index 12e6e9cd0c8..c2528040e98 100644 --- a/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py +++ b/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py @@ -21,9 +21,6 @@ class TestPaymentLedgerEntry(ERPNextTestSuite): self.create_customer() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_company(self): company_name = "_Test Payment Ledger" company = None diff --git a/erpnext/accounts/doctype/payment_order/test_payment_order.py b/erpnext/accounts/doctype/payment_order/test_payment_order.py index 71ad044ed57..b11500cfd20 100644 --- a/erpnext/accounts/doctype/payment_order/test_payment_order.py +++ b/erpnext/accounts/doctype/payment_order/test_payment_order.py @@ -26,9 +26,6 @@ class TestPaymentOrder(ERPNextTestSuite): gl_account=self.gl_account, bank_account_name="Checking Account " + uniq_identifier ) - def tearDown(self): - frappe.db.rollback() - def test_payment_order_creation_against_payment_entry(self): purchase_invoice = make_purchase_invoice() payment_entry = get_payment_entry( diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py index 1cd39c36fbe..1bbf228d73a 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py @@ -28,9 +28,6 @@ class TestPaymentReconciliation(ERPNextTestSuite): self.create_cost_center() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_company(self): company = None if frappe.db.exists("Company", "_Test Payment Reconciliation"): diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py index 5035d2a2042..453a52518a7 100644 --- a/erpnext/accounts/doctype/payment_request/test_payment_request.py +++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py @@ -99,9 +99,6 @@ class TestPaymentRequest(ERPNextTestSuite): self._get_payment_gateway_controller = _get_payment_gateway_controller.start() self.addCleanup(_get_payment_gateway_controller.stop) - def tearDown(self): - frappe.db.rollback() - def test_payment_request_linkings(self): so_inr = make_sales_order(currency="INR", do_not_save=True) so_inr.disable_rounded_total = 1 diff --git a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py index de8452d93e1..36c21f7ee78 100644 --- a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py +++ b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py @@ -8,9 +8,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPaymentTermsTemplate(ERPNextTestSuite): - def tearDown(self): - frappe.delete_doc("Payment Terms Template", "_Test Payment Terms Template For Test", force=1) - def test_create_template(self): template = frappe.get_doc( { diff --git a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py index 1485a9532f8..ff11fe5f4fe 100644 --- a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py +++ b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py @@ -40,10 +40,6 @@ class TestPOSClosingEntry(ERPNextTestSuite): frappe.db.sql("delete from `tabPOS Opening Entry`") make_stock_entry(target="_Test Warehouse - _TC", qty=2, basic_rate=100) - def tearDown(self): - frappe.set_user("Administrator") - frappe.db.sql("delete from `tabPOS Profile`") - def test_pos_closing_entry(self): test_user, pos_profile = init_user_and_profile() opening_entry = create_opening_entry(pos_profile, test_user.name) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 0868d4a8d99..c31c78b8b85 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -46,9 +46,6 @@ class POSInvoiceTestMixin(ERPNextTestSuite): mode_of_payment = frappe.get_doc("Mode of Payment", "Bank Draft") set_default_account_for_mode_of_payment(mode_of_payment, "_Test Company", "_Test Bank - _TC") - def tearDown(self): - frappe.db.rollback() - class TestPOSInvoice(POSInvoiceTestMixin): def setUp(self): diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py index f9630dcd15d..5c490d303be 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py @@ -23,10 +23,6 @@ class TestPOSInvoiceMerging(POSInvoiceTestMixin): self.opening_entry = create_opening_entry(self.pos_profile, self.test_user.name) - def tearDown(self): - self.clear_pos_data() - frappe.db.commit() - def test_merging_into_sales_invoice_with_discount(self): from erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry import ( make_closing_entry_from_opening, diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py index e14888447e2..6846752a044 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py @@ -34,11 +34,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): def setUp(self): frappe.db.sql("delete from `tabPOS Invoice`") - def tearDown(self): - frappe.set_user("Administrator") - frappe.db.sql("delete from `tabPOS Profile`") - frappe.db.sql("delete from `tabPOS Invoice`") - def test_consolidated_invoice_creation(self): test_user, pos_profile = init_user_and_profile() opening_entry = create_opening_entry(pos_profile, test_user.name) diff --git a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py index 5cca1ad72b8..2a26b29d382 100644 --- a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py +++ b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py @@ -31,10 +31,6 @@ class TestPOSOpeningEntry(ERPNextTestSuite): self.init_user_and_profile = init_user_and_profile - def tearDown(self): - frappe.set_user("Administrator") - frappe.db.sql("delete from `tabPOS Profile`") - def test_pos_opening_entry(self): test_user, pos_profile = self.init_user_and_profile() opening_entry = create_opening_entry(pos_profile, test_user.name) diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index 7b0c507ac0c..6ff1ed85d55 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -21,9 +21,6 @@ class TestPricingRule(ERPNextTestSuite): setup_pricing_rule_data() self.enterClassContext(self.change_settings("Selling Settings", validate_selling_price=0)) - def tearDown(self): - delete_existing_pricing_rules() - def test_pricing_rule_for_discount(self): from frappe import MandatoryError diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py index 44f5bf9c3ff..31d2aa4401f 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py +++ b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py @@ -101,9 +101,6 @@ class TestProcessStatementOfAccounts(AccountsTestMixin, ERPNextTestSuite): for age_range in expected_ageing: self.assertEqual(expected_ageing[age_range], ageing.get(age_range)) - def tearDown(self): - frappe.db.rollback() - def create_process_soa(**args): args = frappe._dict(args) diff --git a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py index 6e0712972da..274df9fc862 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py @@ -28,9 +28,6 @@ class TestRepostAccountingLedger(AccountsTestMixin, ERPNextTestSuite): self.create_item() update_repost_settings() - def tearDown(self): - frappe.db.rollback() - def test_01_basic_functions(self): si = create_sales_invoice( item=self.item, diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index e8f367d14be..eb160d99287 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -86,9 +86,6 @@ class TestSalesInvoice(ERPNextTestSuite): pi.submit() self.assertIn("Rate must be same", str(e.exception)) - def tearDown(self): - frappe.db.rollback() - def make(self): w = frappe.copy_doc(self.globalTestRecords["Sales Invoice"][0]) w.is_pos = 0 diff --git a/erpnext/accounts/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py index 6e8d72ee9f0..dbec8be72c6 100644 --- a/erpnext/accounts/doctype/subscription/test_subscription.py +++ b/erpnext/accounts/doctype/subscription/test_subscription.py @@ -28,9 +28,6 @@ class TestSubscription(ERPNextTestSuite): reset_settings() frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", None) - def tearDown(self): - frappe.db.rollback() - def test_create_subscription_with_trial_with_correct_period(self): subscription = create_subscription( trial_period_start=nowdate(), trial_period_end=add_months(nowdate(), 1) diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index 966aaf43fdf..3d8307805ef 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -22,9 +22,6 @@ class TestTaxWithholdingCategory(ERPNextTestSuite): create_tax_withholding_category_records() make_pan_no_field() - def tearDown(self): - frappe.db.rollback() - def validate_tax_withholding_entries(self, doctype, docname, expected_entries): """Validate tax withholding entries for a document""" entries = frappe.get_all( diff --git a/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py b/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py index 3b24b4f6242..7f931b7556e 100644 --- a/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py +++ b/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py @@ -23,9 +23,6 @@ class TestUnreconcilePayment(AccountsTestMixin, ERPNextTestSuite): self.create_item() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_sales_invoice(self, do_not_submit=False): si = create_sales_invoice( item=self.item, diff --git a/erpnext/accounts/report/accounts_payable/test_accounts_payable.py b/erpnext/accounts/report/accounts_payable/test_accounts_payable.py index 6c306f36966..87a4b989661 100644 --- a/erpnext/accounts/report/accounts_payable/test_accounts_payable.py +++ b/erpnext/accounts/report/accounts_payable/test_accounts_payable.py @@ -15,9 +15,6 @@ class TestAccountsPayable(AccountsTestMixin, ERPNextTestSuite): self.create_supplier(currency="USD", supplier_name="Test Supplier2") self.create_usd_payable_account() - def tearDown(self): - frappe.db.rollback() - def test_accounts_payable_for_foreign_currency_supplier(self): pi = self.create_purchase_invoice(do_not_submit=True) pi.currency = "USD" diff --git a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py index d8836c96479..d38ce924cf0 100644 --- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py @@ -18,9 +18,6 @@ class TestAccountsReceivable(AccountsTestMixin, ERPNextTestSuite): self.create_usd_receivable_account() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_sales_invoice(self, no_payment_schedule=False, do_not_submit=False, **args): frappe.set_user("Administrator") si = create_sales_invoice( diff --git a/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py index 9955d1f7af9..96fa4ae8b64 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py @@ -16,9 +16,6 @@ class TestAccountsReceivable(AccountsTestMixin, ERPNextTestSuite): self.create_item() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def test_01_receivable_summary_output(self): """ Test for Invoices, Paid, Advance and Outstanding diff --git a/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py b/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py index ddd88eb0018..0b114dd96d2 100644 --- a/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py +++ b/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py @@ -17,9 +17,6 @@ class TestCustomerLedgerSummary(AccountsTestMixin, ERPNextTestSuite): self.create_item() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_sales_invoice(self, do_not_submit=False, **args): si = create_sales_invoice( item=self.item, diff --git a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py index eb26fce4038..15e216e333a 100644 --- a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py +++ b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py @@ -67,9 +67,6 @@ class TestDeferredRevenueAndExpense(ERPNextTestSuite, AccountsTestMixin): self.setup_deferred_accounts_and_items() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - @ERPNextTestSuite.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) def test_deferred_revenue(self): self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company) diff --git a/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py b/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py index c39aa824629..dd836a6891e 100644 --- a/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py +++ b/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py @@ -15,9 +15,6 @@ class TestGeneralAndPaymentLedger(ERPNextTestSuite, AccountsTestMixin): self.create_company() self.cleanup() - def tearDown(self): - frappe.db.rollback() - def cleanup(self): doctypes = [] doctypes.append(qb.DocType("GL Entry")) diff --git a/erpnext/accounts/report/gross_profit/test_gross_profit.py b/erpnext/accounts/report/gross_profit/test_gross_profit.py index 03473426210..1f4bb22bbd9 100644 --- a/erpnext/accounts/report/gross_profit/test_gross_profit.py +++ b/erpnext/accounts/report/gross_profit/test_gross_profit.py @@ -21,9 +21,6 @@ class TestGrossProfit(ERPNextTestSuite): self.create_sales_invoice() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_company(self): company_name = "_Test Gross Profit" abbr = "_GP" diff --git a/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py index dc0feff3554..eed45ea60bb 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py @@ -13,9 +13,6 @@ class TestItemWisePurchaseRegister(AccountsTestMixin, ERPNextTestSuite): self.create_supplier() self.create_item() - def tearDown(self): - frappe.db.rollback() - def create_purchase_invoice(self, do_not_submit=False): pi = make_purchase_invoice( item=self.item, diff --git a/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py index bb051c5c6e6..d982af3e996 100644 --- a/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py @@ -13,9 +13,6 @@ class TestItemWiseSalesRegister(AccountsTestMixin, ERPNextTestSuite): self.create_customer() self.create_item() - def tearDown(self): - frappe.db.rollback() - def create_sales_invoice(self, item=None, taxes=None, do_not_submit=False): si = create_sales_invoice( item=item or self.item, diff --git a/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py index 172e131efe5..90d28033f19 100644 --- a/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py +++ b/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py @@ -18,9 +18,6 @@ class TestProfitAndLossStatement(AccountsTestMixin, ERPNextTestSuite): self.create_customer() self.create_item() - def tearDown(self): - frappe.db.rollback() - def create_sales_invoice(self, qty=1, rate=150, no_payment_schedule=False, do_not_submit=False): frappe.set_user("Administrator") si = create_sales_invoice( diff --git a/erpnext/accounts/report/sales_register/test_sales_register.py b/erpnext/accounts/report/sales_register/test_sales_register.py index f4292e76471..ca284cc636c 100644 --- a/erpnext/accounts/report/sales_register/test_sales_register.py +++ b/erpnext/accounts/report/sales_register/test_sales_register.py @@ -14,9 +14,6 @@ class TestItemWiseSalesRegister(AccountsTestMixin, ERPNextTestSuite): self.create_item() self.create_child_cost_center() - def tearDown(self): - frappe.db.rollback() - def create_child_cost_center(self): cc_name = "South Wing" if frappe.db.exists("Cost Center", cc_name): diff --git a/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py b/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py index 6029612666c..418d86abb66 100644 --- a/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py +++ b/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py @@ -14,9 +14,6 @@ class TestSupplierLedgerSummary(AccountsTestMixin, ERPNextTestSuite): self.create_item() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_purchase_invoice(self, do_not_submit=False): frappe.set_user("Administrator") pi = make_purchase_invoice( diff --git a/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py index 76ed8c79210..a2a732e8de6 100644 --- a/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py +++ b/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py @@ -126,9 +126,6 @@ class TestTaxWithholdingDetails(AccountsTestMixin, ERPNextTestSuite): ) self.assertSequenceEqual(voucher_actual_values, voucher_expected_values) - def tearDown(self): - self.clear_old_entries() - def create_tax_accounts(): account_names = ["TCS", "TDS"] diff --git a/erpnext/accounts/report/trial_balance/test_trial_balance.py b/erpnext/accounts/report/trial_balance/test_trial_balance.py index 4c0c762284e..42cf62af0a0 100644 --- a/erpnext/accounts/report/trial_balance/test_trial_balance.py +++ b/erpnext/accounts/report/trial_balance/test_trial_balance.py @@ -62,10 +62,6 @@ class TestTrialBalance(ERPNextTestSuite): total_row = execute(filters)[1][-1] self.assertEqual(total_row["debit"], total_row["credit"]) - def tearDown(self): - clear_dimension_defaults("Branch") - disable_dimension() - def create_company(**args): args = frappe._dict(args) diff --git a/erpnext/accounts/test/test_utils.py b/erpnext/accounts/test/test_utils.py index 5eb652e2112..77660ff442a 100644 --- a/erpnext/accounts/test/test_utils.py +++ b/erpnext/accounts/test/test_utils.py @@ -24,10 +24,6 @@ class TestUtils(ERPNextTestSuite): super().setUpClass() make_test_objects("Address", ADDRESS_RECORDS) - @classmethod - def tearDownClass(cls): - frappe.db.rollback() - def test_get_party_shipping_address(self): address = get_party_shipping_address("Customer", "_Test Customer 1") self.assertEqual(address, "_Test Billing Address 2 Title-Billing") diff --git a/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py b/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py index 8c061615486..8fba5602602 100644 --- a/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py +++ b/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py @@ -17,10 +17,6 @@ class TestAssetShiftAllocation(ERPNextTestSuite): super().setUpClass() create_asset_shift_factors() - @classmethod - def tearDownClass(cls): - frappe.db.rollback() - def test_asset_shift_allocation(self): asset = create_asset( calculate_depreciation=1, diff --git a/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py b/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py index e3f666d8e08..09ca2c0296f 100644 --- a/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py +++ b/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py @@ -27,9 +27,6 @@ class TestRequestedItemsToOrderAndReceive(ERPNextTestSuite): item_code="Test MR Report Item", ) - def tearDown(self) -> None: - frappe.db.rollback() - def test_date_range(self): data = get_data(self.filters) self.assertEqual(len(data), 2) # MRs today should be fetched diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index 9b330aa7ee2..61493b15882 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -73,9 +73,6 @@ class TestAccountsController(ERPNextTestSuite): self.create_parties() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def create_company(self): company_name = "_Test Company" self.company_abbr = abbr = "_TC" diff --git a/erpnext/controllers/tests/test_qty_based_taxes.py b/erpnext/controllers/tests/test_qty_based_taxes.py index b2b3b8656a6..e3ddb0d1e1b 100644 --- a/erpnext/controllers/tests/test_qty_based_taxes.py +++ b/erpnext/controllers/tests/test_qty_based_taxes.py @@ -126,12 +126,3 @@ class TestTaxes(ERPNextTestSuite): doc.insert() self.assertEqual(doc.taxes[0].tax_amount, 600) self.created_docs.append(doc) - - def tearDown(self): - for doc in self.created_docs: - doc.delete() - self.item.delete() - self.item_group.delete() - self.item_tax_template.delete() - self.account.delete() - self.company.delete() diff --git a/erpnext/controllers/tests/test_reactivity.py b/erpnext/controllers/tests/test_reactivity.py index 398812fa6f8..fa3007087e1 100644 --- a/erpnext/controllers/tests/test_reactivity.py +++ b/erpnext/controllers/tests/test_reactivity.py @@ -16,9 +16,6 @@ class TestReactivity(AccountsTestMixin, ERPNextTestSuite): self.create_price_list() self.clear_old_entries() - def tearDown(self): - frappe.db.rollback() - def disable_dimensions(self): res = frappe.db.get_all("Accounting Dimension", filters={"disabled": False}) for x in res: diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py index 7204de45810..207992c8a45 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py @@ -17,19 +17,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPlaidSettings(ERPNextTestSuite): - def setUp(self): - pass - - def tearDown(self): - for bt in frappe.get_all("Bank Transaction"): - doc = frappe.get_doc("Bank Transaction", bt.name) - doc.cancel() - doc.delete() - - for doctype in ("Bank Account", "Bank Account Type", "Bank Account Subtype"): - for d in frappe.get_all(doctype): - frappe.delete_doc(doctype, d.name, force=True) - def test_plaid_disabled(self): frappe.db.set_single_value("Plaid Settings", "enabled", 0) self.assertTrue(get_plaid_configuration() == "disabled") diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py index 52b503ef467..3c4843b5e0c 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py @@ -141,8 +141,6 @@ class TestMaintenanceSchedule(ERPNextTestSuite): serial_nos = get_serial_nos_from_schedule(mvi.item_name, ms.name) self.assertEqual(serial_nos, ["TEST001", "TEST002"]) - frappe.db.rollback() - def test_schedule_with_serials(self): # Checks whether serials are automatically updated when changing in items table. # Also checks if other fields trigger generate schdeule if changed in items table. @@ -171,8 +169,6 @@ class TestMaintenanceSchedule(ERPNextTestSuite): ms.save() self.assertEqual(len(ms.schedules), 2) - frappe.db.rollback() - def make_serial_item_with_serial(self, item_code): serial_item_doc = create_item(item_code, is_stock_item=1) diff --git a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py index 82b9cff138e..d44a9284f0f 100644 --- a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py +++ b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py @@ -34,9 +34,6 @@ class TestBOMUpdateLog(ERPNextTestSuite): self.new_bom_doc = bom_doc - def tearDown(self): - frappe.db.rollback() - def test_bom_update_log_validate(self): """ 1) Test if BOM presence is validated. diff --git a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py index e0750e58842..9b433a9c1d6 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py @@ -21,9 +21,6 @@ class TestBOMUpdateTool(ERPNextTestSuite): super().setUpClass() cls.load_test_records("BOM") - def tearDown(self): - frappe.db.rollback() - @timeout def test_replace_bom(self): current_bom = "BOM-_Test Item Home Desktop Manufactured-001" diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 555e428c8d8..fc5b00fbaf9 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -69,9 +69,6 @@ class TestJobCard(ERPNextTestSuite): basic_rate=100, ) - def tearDown(self): - frappe.db.rollback() - def test_quality_inspection_mandatory_check(self): from erpnext.manufacturing.doctype.operation.test_operation import make_operation diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index 716a59e8148..4612c427714 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -56,9 +56,6 @@ class TestProductionPlan(ERPNextTestSuite): if not frappe.db.get_value("BOM", {"item": item}): make_bom(item=item, raw_materials=raw_materials) - def tearDown(self) -> None: - frappe.db.rollback() - def test_production_plan_mr_creation(self): "Test if MRs are created for unavailable raw materials." pln = create_production_plan(item_code="Test Production Item 1") @@ -972,8 +969,6 @@ class TestProductionPlan(ERPNextTestSuite): self.assertEqual(pln.po_items[0].item_code, "PIV-RED") self.assertEqual(pln.po_items[0].bom_no, parent_bom.name) - frappe.db.rollback() - def test_get_sales_order_items_for_product_bundle(self): """Testing the Planned Qty for Product Bundle Item""" from erpnext.manufacturing.doctype.work_order.test_work_order import ( diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 57bac32ccbf..b75bfafcf28 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -42,10 +42,6 @@ class TestWorkOrder(ERPNextTestSuite): self.item = "_Test Item" prepare_data_for_backflush_based_on_materials_transferred() - def tearDown(self): - frappe.local.future_sle = {} - frappe.db.rollback() - def check_planned_qty(self): planned0 = ( frappe.db.get_value( diff --git a/erpnext/manufacturing/report/test_reports.py b/erpnext/manufacturing/report/test_reports.py index 163a91c7ef9..adeddd996a5 100644 --- a/erpnext/manufacturing/report/test_reports.py +++ b/erpnext/manufacturing/report/test_reports.py @@ -9,9 +9,6 @@ class TestManufacturingReports(ERPNextTestSuite): def setUp(self): self.setup_default_filters() - def tearDown(self): - frappe.db.rollback() - def setup_default_filters(self): self.last_bom = frappe.get_last_doc("BOM").name self.DEFAULT_FILTERS = { diff --git a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py index 4f247ee5df3..0b34778ea26 100644 --- a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py +++ b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py @@ -43,7 +43,3 @@ class TestDelayedTasksSummary(ERPNextTestSuite): for key in ["subject", "status", "priority", "delay"]: self.assertEqual(expected_data[1].get(key), data.get(key)) - - def tearDown(self): - for task in ["_Test Task 98", "_Test Task 99"]: - frappe.get_doc("Task", {"subject": task}).delete() diff --git a/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py b/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py index a898a251043..2533d42dd56 100644 --- a/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py +++ b/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py @@ -41,10 +41,6 @@ class TestVATAuditReport(TestCase): make_sales_invoices() create_purchase_invoices() - def tearDown(self): - frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company SA VAT'") - frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company SA VAT'") - def test_vat_audit_report(self): filters = {"company": "_Test Company SA VAT", "from_date": today(), "to_date": today()} columns, data = execute(filters) diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index ce6b6e851c5..73eb4fc254b 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -18,9 +18,6 @@ from erpnext.tests.utils import ERPNextTestSuite, create_test_contact_and_addres class TestCustomer(ERPNextTestSuite): - def tearDown(self): - set_credit_limit("_Test Customer", "_Test Company", 0) - def test_get_customer_group_details(self): doc = frappe.new_doc("Customer Group") doc.customer_group_name = "_Testing Customer Group" @@ -180,8 +177,6 @@ class TestCustomer(ERPNextTestSuite): # rename back to original frappe.rename_doc("Customer", new_name, "_Test Customer 1") - frappe.db.rollback() - def test_freezed_customer(self): frappe.db.set_value("Customer", "_Test Customer", "is_frozen", 1) diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index 1da930b73ab..3ff406041a7 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -54,9 +54,6 @@ class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_customer("_Test Customer Credit") - def tearDown(self): - frappe.db.rollback() - @ERPNextTestSuite.change_settings( "Stock Settings", { diff --git a/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py b/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py index 1f87f9993b7..1b583967a47 100644 --- a/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py +++ b/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py @@ -13,9 +13,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPaymentTermsStatusForSalesOrder(ERPNextTestSuite): - def tearDown(self): - frappe.db.rollback() - def create_payment_terms_template(self): # create template for 50-50 payments template = None diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py index cfcfc2f3ed4..203ad28bfda 100644 --- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py +++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py @@ -17,9 +17,6 @@ class TestSalesPartnerTargetVarianceBasedOnItemGroup(ERPNextTestSuite): def setUp(self): self.fiscal_year = get_fiscal_year(nowdate())[0] - def tearDown(self): - frappe.db.rollback() - def test_achieved_target_and_variance_for_partner(self): # Create a Target Distribution distribution = create_target_distribution(self.fiscal_year) diff --git a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py index a5dff54a372..73cab86459c 100644 --- a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py +++ b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py @@ -13,9 +13,6 @@ class TestSalesPersonTargetVarianceBasedOnItemGroup(ERPNextTestSuite): def setUp(self): self.fiscal_year = get_fiscal_year(nowdate())[0] - def tearDown(self): - frappe.db.rollback() - def test_achieved_target_and_variance(self): # Create a Target Distribution distribution = create_target_distribution(self.fiscal_year) diff --git a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py index dd408b97610..3c94a302d2f 100644 --- a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py +++ b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py @@ -90,10 +90,6 @@ class TestCurrencyExchange(ERPNextTestSuite): key = "currency_exchange_rate_{}:{}:{}".format(date, "USD", "INR") cache.delete(key) - def tearDown(self): - frappe.db.set_single_value("Accounts Settings", "allow_stale", 1) - self.clear_cache() - def test_exchange_rate(self, mock_get): save_new_records(self.globalTestRecords["Currency Exchange"]) diff --git a/erpnext/setup/doctype/employee/test_employee.py b/erpnext/setup/doctype/employee/test_employee.py index 564747f794c..cd5765fac5e 100644 --- a/erpnext/setup/doctype/employee/test_employee.py +++ b/erpnext/setup/doctype/employee/test_employee.py @@ -64,9 +64,6 @@ class TestEmployee(ERPNextTestSuite): self.assertEqual(qb_employee_list, employee_list) frappe.set_user("Administrator") - def tearDown(self): - frappe.db.rollback() - def make_employee(user, company=None, **kwargs): if not frappe.db.get_value("User", user): diff --git a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py index 7e3a4191903..5c716279b89 100644 --- a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py +++ b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py @@ -13,11 +13,6 @@ class TestTransactionDeletionRecord(ERPNextTestSuite): self._clear_all_deletion_cache_flags() create_company("Dunder Mifflin Paper Co") - def tearDown(self): - # Clean up all deletion cache flags after each test - self._clear_all_deletion_cache_flags() - frappe.db.rollback() - def _clear_all_deletion_cache_flags(self): """Clear all deletion_running_doctype:* cache keys""" # Get all keys matching the pattern diff --git a/erpnext/stock/doctype/bin/test_bin.py b/erpnext/stock/doctype/bin/test_bin.py index 93688948581..ef21bcf7833 100644 --- a/erpnext/stock/doctype/bin/test_bin.py +++ b/erpnext/stock/doctype/bin/test_bin.py @@ -26,8 +26,6 @@ class TestBin(ERPNextTestSuite): bin = _create_bin(item_code, warehouse) self.assertEqual(bin.item_code, item_code) - frappe.db.rollback() - def test_index_exists(self): indexes = frappe.db.sql("show index from tabBin where Non_unique = 0", as_dict=1) if not any(index.get("Key_name") == "unique_item_warehouse" for index in indexes): diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index c2d11eb9212..c5aa297e35b 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -930,9 +930,6 @@ class TestDeliveryNote(ERPNextTestSuite): for _i, gle in enumerate(gl_entries): self.assertEqual([gle.debit, gle.credit], expected_values.get(gle.account)) - # tear down - frappe.db.rollback() - def test_closed_delivery_note(self): from erpnext.stock.doctype.delivery_note.delivery_note import update_delivery_note_status @@ -1580,10 +1577,6 @@ class TestDeliveryNote(ERPNextTestSuite): # Test that item qty is not reserved on sales return, if selling setting don't reserve qty is checked. self.assertEqual(get_reserved_qty(item, warehouse), 0 if dont_reserve_qty else qty_to_reserve) - def tearDown(self): - frappe.db.rollback() - frappe.db.set_single_value("Selling Settings", "dont_reserve_sales_order_qty_on_sales_return", 0) - def test_non_internal_transfer_delivery_note(self): from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse diff --git a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py index 68bcfe45629..98c0adfc532 100644 --- a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py @@ -24,9 +24,6 @@ class TestDeliveryTrip(ERPNextTestSuite): self.delivery_trip = create_delivery_trip(driver, address, company=self.companies[0].name) - def tearDown(self): - frappe.db.rollback() - def test_delivery_trip_notify_customers(self): # set default outgoing outgoing = frappe.get_doc( diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 4ac38780c69..b580582339d 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -408,7 +408,6 @@ class TestItem(ERPNextTestSuite): frappe.flags.attribute_values = None self.assertRaises(InvalidItemAttributeValueError, attribute.save) - frappe.db.rollback() def test_make_item_variant(self): frappe.delete_doc_if_exists("Item", "_Test Variant Item-L", force=1) diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py index 04e98a45a42..f60dcc98e0d 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.py +++ b/erpnext/stock/doctype/item_price/test_item_price.py @@ -195,6 +195,5 @@ class TestItemPrice(ERPNextTestSuite): ) price = get_price_list_rate_for(ctx, doc.item_code) - frappe.db.rollback() self.assertEqual(price, 21) diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index 64ce9ca8229..82a61fcbb8d 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -29,9 +29,6 @@ class TestMaterialRequest(ERPNextTestSuite): super().setUpClass() cls.load_test_records("Material Request") - def tearDown(self): - frappe.db.rollback() - def test_material_request_qty(self): mr = frappe.copy_doc(self.globalTestRecords["Material Request"][0]) mr.items[0].qty = 0 diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index c982279b36e..9bd01c8b2fc 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -37,9 +37,6 @@ class TestPurchaseReceipt(ERPNextTestSuite): def setUp(self): frappe.local.future_sle = {} - def tearDown(self): - frappe.db.rollback() - def test_purchase_receipt_qty(self): pr = make_purchase_receipt(qty=0, rejected_qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): 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 45d8d0ebcb5..e0ddd6faa8e 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 @@ -22,9 +22,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestRepostItemValuation(ERPNextTestSuite, StockTestMixin): - def tearDown(self): - frappe.flags.dont_execute_stock_reposts = False - def test_repost_time_slot(self): repost_settings = frappe.get_doc("Stock Reposting Settings") diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py index e59f5092f1a..fecd4fb672e 100644 --- a/erpnext/stock/doctype/serial_no/test_serial_no.py +++ b/erpnext/stock/doctype/serial_no/test_serial_no.py @@ -28,9 +28,6 @@ class TestSerialNo(ERPNextTestSuite): super().setUpClass() cls.load_test_records("Stock Entry") - def tearDown(self): - frappe.db.rollback() - def test_cannot_create_direct(self): frappe.delete_doc_if_exists("Serial No", "_TCSER0001") diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index dbd17d1658b..4d39552a793 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -60,10 +60,6 @@ class TestStockEntry(ERPNextTestSuite): def setUp(self): self.load_test_records("Stock Entry") - def tearDown(self): - frappe.db.rollback() - frappe.set_user("Administrator") - def test_stock_entry_qty(self): item_code = "_Test Item 2" warehouse = "_Test Warehouse - _TC" diff --git a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py index c17201564e1..8f4b39dd5b8 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py @@ -45,9 +45,6 @@ class TestStockLedgerEntry(ERPNextTestSuite, StockTestMixin): "delete from `tabBin` where item_code in (%s)" % (", ".join(["%s"] * len(items))), items ) - def tearDown(self): - frappe.db.rollback() - def test_item_cost_reposting(self): company = "_Test Company" diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 18b66de654e..61d91652728 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -43,9 +43,6 @@ class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): frappe.local.future_sle = {} frappe.flags.pop("dont_execute_stock_reposts", None) - def tearDown(self): - frappe.db.rollback() - def test_reco_for_fifo(self): self._test_reco_sle_gle("FIFO") diff --git a/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py b/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py index bd59b5dc975..3f33b0a2da8 100644 --- a/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py +++ b/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py @@ -697,10 +697,6 @@ class TestStockReservationEntry(ERPNextTestSuite): # Test - 1: ValidationError should be thrown as the inwarded stock is reserved. self.assertRaises(frappe.ValidationError, se.cancel) - def tearDown(self) -> None: - cancel_all_stock_reservation_entries() - return super().tearDown() - def create_items() -> dict: items_properties = [ diff --git a/erpnext/stock/report/available_serial_no/test_available_serial_no.py b/erpnext/stock/report/available_serial_no/test_available_serial_no.py index a1ec59da78f..e9f478960d2 100644 --- a/erpnext/stock/report/available_serial_no/test_available_serial_no.py +++ b/erpnext/stock/report/available_serial_no/test_available_serial_no.py @@ -24,9 +24,6 @@ class TestStockLedgerReeport(ERPNextTestSuite): item_code="_Test Item With Serial No", ) - def tearDown(self) -> None: - frappe.db.rollback() - def test_available_serial_no(self): report = frappe.get_doc("Report", "Available Serial No") diff --git a/erpnext/stock/report/reserved_stock/test_reserved_stock.py b/erpnext/stock/report/reserved_stock/test_reserved_stock.py index 8f4cc94e704..d7790bfe200 100644 --- a/erpnext/stock/report/reserved_stock/test_reserved_stock.py +++ b/erpnext/stock/report/reserved_stock/test_reserved_stock.py @@ -20,10 +20,6 @@ class TestReservedStock(ERPNextTestSuite): self.stock_qty = 100 self.warehouse = "_Test Warehouse - _TC" - def tearDown(self) -> None: - cancel_all_stock_reservation_entries() - return super().tearDown() - @ERPNextTestSuite.change_settings( "Stock Settings", { diff --git a/erpnext/stock/report/stock_balance/test_stock_balance.py b/erpnext/stock/report/stock_balance/test_stock_balance.py index 0759a5a1ad1..583e362112c 100644 --- a/erpnext/stock/report/stock_balance/test_stock_balance.py +++ b/erpnext/stock/report/stock_balance/test_stock_balance.py @@ -29,9 +29,6 @@ class TestStockBalance(ERPNextTestSuite): } ) - def tearDown(self): - frappe.db.rollback() - def assertPartialDictEq(self, expected: dict[str, Any], actual: dict[str, Any]): for k, v in expected.items(): self.assertEqual(v, actual[k], msg=f"{expected=}\n{actual=}") diff --git a/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py b/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py index 85abfc36ca3..8a97a64d1b3 100644 --- a/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py +++ b/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py @@ -19,6 +19,3 @@ class TestStockLedgerReeport(ERPNextTestSuite): to_date=add_days(today(), 30), item_code=["_Test Stock Report Serial Item"], ) - - def tearDown(self) -> None: - frappe.db.rollback() diff --git a/erpnext/stock/tests/test_valuation.py b/erpnext/stock/tests/test_valuation.py index 5951e9371ef..71f604daa5e 100644 --- a/erpnext/stock/tests/test_valuation.py +++ b/erpnext/stock/tests/test_valuation.py @@ -19,11 +19,6 @@ class TestFIFOValuation(ERPNextTestSuite): def setUp(self): self.queue = FIFOValuation([]) - def tearDown(self): - qty, value = self.queue.get_total_stock_and_value() - self.assertTotalQty(qty) - self.assertTotalValue(value) - def assertTotalQty(self, qty): self.assertAlmostEqual(sum(q for q, _ in self.queue), qty, msg=f"queue: {self.queue}", places=4) @@ -199,11 +194,6 @@ class TestLIFOValuation(ERPNextTestSuite): def setUp(self): self.stack = LIFOValuation([]) - def tearDown(self): - qty, value = self.stack.get_total_stock_and_value() - self.assertTotalQty(qty) - self.assertTotalValue(value) - def assertTotalQty(self, qty): self.assertAlmostEqual(sum(q for q, _ in self.stack), qty, msg=f"stack: {self.stack}", places=4) diff --git a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py index 281ded9e4f4..f0803733d53 100644 --- a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py +++ b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py @@ -40,9 +40,6 @@ class TestSubcontractingOrder(ERPNextTestSuite): make_service_items() make_bom_for_subcontracted_items() - def tearDown(self): - frappe.db.rollback() - def test_set_missing_values(self): sco = get_subcontracting_order() before = {sco.total_qty, sco.total, sco.total_additional_costs} diff --git a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py index 4ddedd1954c..d7ada387f82 100644 --- a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py +++ b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py @@ -359,10 +359,6 @@ class TestServiceLevelAgreement(ERPNextTestSuite): applied_sla = frappe.db.get_value("Lead", lead.name, "service_level_agreement") self.assertFalse(applied_sla) - def tearDown(self): - for d in frappe.get_all("Service Level Agreement"): - frappe.delete_doc("Service Level Agreement", d.name, force=1) - def get_service_level_agreement( default_service_level_agreement=None, entity_type=None, entity=None, doctype="Issue" From b98899a6acfffb0dbdac6a54372638e96ee9fa82 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 30 Jan 2026 20:38:09 +0530 Subject: [PATCH 152/217] refactor(test): make consolidated trial balance report deterministic --- .../test_consolidated_trial_balance.py | 19 ++-------- erpnext/tests/utils.py | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py b/erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py index 3e6ea82e13b..3166abf4061 100644 --- a/erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py +++ b/erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py @@ -15,24 +15,9 @@ class ForeignCurrencyTranslationReserveNotFoundError(frappe.ValidationError): class TestConsolidatedTrialBalance(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - from erpnext.accounts.report.trial_balance.test_trial_balance import create_company + def setUp(self): from erpnext.accounts.utils import get_fiscal_year - # Group Company - create_company(company_name="Parent Group Company India", is_group=1) - - create_company(company_name="Child Company India", parent_company="Parent Group Company India") - - # Child Company with different currency - create_company( - company_name="Child Company US", - country="United States", - currency="USD", - parent_company="Parent Group Company India", - ) - create_journal_entry( company="Parent Group Company India", acc1="Marketing Expenses - PGCI", @@ -48,7 +33,7 @@ class TestConsolidatedTrialBalance(ERPNextTestSuite): company="Child Company US", acc1="Marketing Expenses - CCU", acc2="Cash - CCU", amount=1000 ) - cls.fiscal_year = get_fiscal_year(today(), company="Parent Group Company India")[0] + self.fiscal_year = get_fiscal_year(today(), company="Parent Group Company India")[0] def test_single_company_report(self): filters = frappe._dict({"company": ["Parent Group Company India"], "fiscal_year": self.fiscal_year}) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index afd78dfa9de..1a1a56f2c88 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -936,6 +936,42 @@ class ERPNextTestSuite(unittest.TestCase): "password": "test", "chart_of_accounts": "Standard", }, + { + "abbr": "PGCI", + "company_name": "Parent Group Company India", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + "is_group": 1, + }, + { + "abbr": "CCI", + "company_name": "Child Company India", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + "parent_company": "Parent Group Company India", + }, + { + "abbr": "CCU", + "company_name": "Child Company US", + "country": "United States", + "default_currency": "USD", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": cls.holiday_list[0].name, + "enable_perpetual_inventory": 0, + "parent_company": "Parent Group Company India", + }, ] cls.companies = [] for x in records: From 34c34902274bdcfbca9a873700994c89a45ffc45 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 30 Jan 2026 20:59:14 +0530 Subject: [PATCH 153/217] refactor(test): make sales payment summary deterministic --- .../test_sales_payment_summary.py | 54 +------------------ erpnext/tests/utils.py | 22 ++++++++ 2 files changed, 24 insertions(+), 52 deletions(-) diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py index 52c240cc60f..da4b78f6987 100644 --- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py +++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py @@ -14,20 +14,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestSalesPaymentSummary(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - create_records() - pes = frappe.get_all("Payment Entry") - jes = frappe.get_all("Journal Entry") - sis = frappe.get_all("Sales Invoice") - for pe in pes: - frappe.db.set_value("Payment Entry", pe.name, "docstatus", 2) - for je in jes: - frappe.db.set_value("Journal Entry", je.name, "docstatus", 2) - for si in sis: - frappe.db.set_value("Sales Invoice", si.name, "docstatus", 2) - def test_get_mode_of_payments(self): filters = get_filters() @@ -93,6 +79,7 @@ class TestSalesPaymentSummary(ERPNextTestSuite): mopd = get_mode_of_payment_details(filters) mopd_values = next(iter(mopd.values())) + cc_init_amount = 0 for mopd_value in mopd_values: if mopd_value[0] == "Credit Card": cc_init_amount = mopd_value[1] @@ -109,6 +96,7 @@ class TestSalesPaymentSummary(ERPNextTestSuite): mopd = get_mode_of_payment_details(filters) mopd_values = next(iter(mopd.values())) + cc_final_amount = 0 for mopd_value in mopd_values: if mopd_value[0] == "Credit Card": cc_final_amount = mopd_value[1] @@ -146,41 +134,3 @@ def create_sales_invoice_record(qty=1): ], } ) - - -def create_records(): - if frappe.db.exists("Customer", "Prestiga-Biz"): - return - - # customer - frappe.get_doc( - { - "customer_group": "_Test Customer Group", - "customer_name": "Prestiga-Biz", - "customer_type": "Company", - "doctype": "Customer", - "territory": "_Test Territory", - } - ).insert() - - # item - item = frappe.get_doc( - { - "doctype": "Item", - "item_code": "Consulting", - "item_name": "Consulting", - "item_group": "All Item Groups", - "company": "_Test Company", - "is_stock_item": 0, - } - ).insert() - - # item price - frappe.get_doc( - { - "doctype": "Item Price", - "price_list": "Standard Selling", - "item_code": item.item_code, - "price_list_rate": 10000, - } - ).insert() diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 1a1a56f2c88..704685b66f2 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -2312,6 +2312,15 @@ class ERPNextTestSuite(unittest.TestCase): "item_group": "All Item Groups", "stock_uom": "Nos", }, + { + "doctype": "Item", + "item_code": "Consulting", + "item_name": "Consulting", + "is_stock_item": 0, + "item_group": "All Item Groups", + "stock_uom": "Nos", + "company": "_Test Company", + }, ] cls.item = [] for x in records: @@ -2509,6 +2518,13 @@ class ERPNextTestSuite(unittest.TestCase): "represents_company": cls.companies[6].name, "companies": [{"company": cls.companies[6].name}], }, + { + "customer_group": "_Test Customer Group", + "customer_name": "Prestiga-Biz", + "customer_type": "Company", + "doctype": "Customer", + "territory": "_Test Territory", + }, ] cls.customer = [] for x in records: @@ -2991,6 +3007,12 @@ class ERPNextTestSuite(unittest.TestCase): "item_code": "Loyal Item", "price_list_rate": 10000, }, + { + "doctype": "Item Price", + "item_code": "Consulting", + "price_list": "Standard Selling", + "price_list_rate": 10000, + }, ] cls.item_price = [] for x in records: From 40bb5c6ed08e2b06cebb3ca655c8c4b6c9e61a89 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 30 Jan 2026 21:02:34 +0530 Subject: [PATCH 154/217] refactor(test): make gross profit deterministic --- erpnext/accounts/report/gross_profit/test_gross_profit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/report/gross_profit/test_gross_profit.py b/erpnext/accounts/report/gross_profit/test_gross_profit.py index 1f4bb22bbd9..ac1ca89b5e4 100644 --- a/erpnext/accounts/report/gross_profit/test_gross_profit.py +++ b/erpnext/accounts/report/gross_profit/test_gross_profit.py @@ -388,6 +388,7 @@ class TestGrossProfit(ERPNextTestSuite): report_output = {k: v for k, v in gp_entry[0].items() if k in expected_entry} self.assertEqual(report_output, expected_entry) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_crnote_against_invoice_with_multiple_instances_of_same_item(self): """ Item Qty for Sales Invoices with multiple instances of same item go in the -ve. Ideally, the credit noteshould cancel out the invoice items. From a1aff71ca515c931d6ddb7d225ccaf0a31a2b496 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Feb 2026 18:38:41 +0530 Subject: [PATCH 155/217] refactor(test): make accounts/test/test_utils.py deterministic --- erpnext/accounts/test/test_utils.py | 47 ------------------- erpnext/tests/utils.py | 70 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 47 deletions(-) diff --git a/erpnext/accounts/test/test_utils.py b/erpnext/accounts/test/test_utils.py index 77660ff442a..eddd30b68b6 100644 --- a/erpnext/accounts/test/test_utils.py +++ b/erpnext/accounts/test/test_utils.py @@ -19,11 +19,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestUtils(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - make_test_objects("Address", ADDRESS_RECORDS) - def test_get_party_shipping_address(self): address = get_party_shipping_address("Customer", "_Test Customer 1") self.assertEqual(address, "_Test Billing Address 2 Title-Billing") @@ -158,45 +153,3 @@ class TestUtils(ERPNextTestSuite): self.assertEqual(get_zero_cutoff(None), 0.005) self.assertEqual(get_zero_cutoff("EUR"), 0.005) self.assertEqual(get_zero_cutoff("BHD"), 0.0005) - - -ADDRESS_RECORDS = [ - { - "doctype": "Address", - "address_type": "Billing", - "address_line1": "Address line 1", - "address_title": "_Test Billing Address Title", - "city": "Lagos", - "country": "Nigeria", - "links": [{"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"}], - }, - { - "doctype": "Address", - "address_type": "Shipping", - "address_line1": "Address line 2", - "address_title": "_Test Shipping Address 1 Title", - "city": "Lagos", - "country": "Nigeria", - "links": [{"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"}], - }, - { - "doctype": "Address", - "address_type": "Shipping", - "address_line1": "Address line 3", - "address_title": "_Test Shipping Address 2 Title", - "city": "Lagos", - "country": "Nigeria", - "is_shipping_address": "1", - "links": [{"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"}], - }, - { - "doctype": "Address", - "address_type": "Billing", - "address_line1": "Address line 4", - "address_title": "_Test Billing Address 2 Title", - "city": "Lagos", - "country": "Nigeria", - "is_shipping_address": "1", - "links": [{"link_doctype": "Customer", "link_name": "_Test Customer 1", "doctype": "Dynamic Link"}], - }, -] diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 704685b66f2..18ef2e05779 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -257,6 +257,7 @@ class ERPNextTestSuite(unittest.TestCase): cls.make_leads() cls.make_sales_person() cls.make_activity_type() + cls.make_address() cls.update_selling_settings() cls.update_stock_settings() cls.update_system_settings() @@ -3343,6 +3344,75 @@ class ERPNextTestSuite(unittest.TestCase): } ).insert(ignore_permissions=True) + @classmethod + def make_address(cls): + records = [ + { + "doctype": "Address", + "address_type": "Billing", + "address_line1": "Address line 1", + "address_title": "_Test Billing Address Title", + "city": "Lagos", + "country": "Nigeria", + "links": [ + {"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"} + ], + }, + { + "doctype": "Address", + "address_type": "Shipping", + "address_line1": "Address line 2", + "address_title": "_Test Shipping Address 1 Title", + "city": "Lagos", + "country": "Nigeria", + "links": [ + {"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"} + ], + }, + { + "doctype": "Address", + "address_type": "Shipping", + "address_line1": "Address line 3", + "address_title": "_Test Shipping Address 2 Title", + "city": "Lagos", + "country": "Nigeria", + "is_shipping_address": "1", + "links": [ + {"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"} + ], + }, + { + "doctype": "Address", + "address_type": "Billing", + "address_line1": "Address line 4", + "address_title": "_Test Billing Address 2 Title", + "city": "Lagos", + "country": "Nigeria", + "is_shipping_address": "1", + "links": [ + {"link_doctype": "Customer", "link_name": "_Test Customer 1", "doctype": "Dynamic Link"} + ], + }, + ] + cls.address = [] + for x in records: + if not frappe.db.exists( + "Address", + { + "address_title": x.get("address_title"), + }, + ): + cls.address.append(frappe.get_doc(x).insert()) + else: + cls.address.append( + frappe.get_doc( + "Address", + { + "address_title": x.get("address_title"), + }, + ) + ) + @contextmanager def set_user(self, user: str): try: From 35d35a05880a1c69876651597e60b08e526523b8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Feb 2026 18:51:52 +0530 Subject: [PATCH 156/217] refactor(test): make requested items order and receive deterministic --- .../test_requested_items_to_order_and_receive.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py b/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py index 09ca2c0296f..38f2d7426ff 100644 --- a/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py +++ b/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py @@ -16,6 +16,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestRequestedItemsToOrderAndReceive(ERPNextTestSuite): def setUp(self) -> None: create_item("Test MR Report Item") + self.load_test_records("Material Request") + frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) self.setup_material_request() # to order and receive self.setup_material_request(order=True, days=1) # to receive (ordered) self.setup_material_request(order=True, receive=True, days=2) # complete (ordered & received) From c96f5e3d8c9a6242c2a661b6d98d56f7bced0e4d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Feb 2026 19:15:08 +0530 Subject: [PATCH 157/217] refactor(test): make distributed discount deterministic --- erpnext/controllers/tests/test_distributed_discount.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/controllers/tests/test_distributed_discount.py b/erpnext/controllers/tests/test_distributed_discount.py index 83a4dc6f3dd..4f4911c8537 100644 --- a/erpnext/controllers/tests/test_distributed_discount.py +++ b/erpnext/controllers/tests/test_distributed_discount.py @@ -5,6 +5,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestTaxesAndTotals(AccountsTestMixin, ERPNextTestSuite): + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_distributed_discount_amount(self): so = make_sales_order(do_not_save=1) so.apply_discount_on = "Net Total" @@ -26,6 +27,7 @@ class TestTaxesAndTotals(AccountsTestMixin, ERPNextTestSuite): self.assertEqual(so.net_total, 1400) self.assertEqual(so.grand_total, 1400) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_distributed_discount_amount_with_taxes(self): so = make_sales_order(do_not_save=1) so.apply_discount_on = "Grand Total" From a58ba3e7d44f6c9b96788ec02abe770406a43e52 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Feb 2026 19:18:00 +0530 Subject: [PATCH 158/217] refactor(test): make item wise inventory account deterministic --- .../controllers/tests/test_item_wise_inventory_account.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/controllers/tests/test_item_wise_inventory_account.py b/erpnext/controllers/tests/test_item_wise_inventory_account.py index 92881fcdb78..398a8388865 100644 --- a/erpnext/controllers/tests/test_item_wise_inventory_account.py +++ b/erpnext/controllers/tests/test_item_wise_inventory_account.py @@ -275,7 +275,7 @@ class TestItemWiseInventoryAccount(ERPNextTestSuite): } for row in items: - self.make_item_group(items[row]["item_group"]) + self._make_item_group(items[row]["item_group"]) inventory_account_dict = frappe._dict() for item_name, item_data in items.items(): @@ -359,7 +359,7 @@ class TestItemWiseInventoryAccount(ERPNextTestSuite): } for row in items: - self.make_item_group(items[row]["item_group"]) + self._make_item_group(items[row]["item_group"]) inventory_account_dict = frappe._dict() for item_name, item_data in items.items(): @@ -453,7 +453,7 @@ class TestItemWiseInventoryAccount(ERPNextTestSuite): self.assertEqual(sle_value[0].value, gl_value, f"GL Entry not created for {item_code} correctly") - def make_item_group(self, item_name): + def _make_item_group(self, item_name): if not frappe.db.exists("Item Group", item_name): item_group = frappe.get_doc( { From 6c9b32287c9783ca44e0267a432d6fd753f106b1 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Feb 2026 19:23:52 +0530 Subject: [PATCH 159/217] refactor(test): make test mapper deterministic --- erpnext/controllers/tests/test_mapper.py | 6 ++- .../doctype/sales_order/test_records.json | 39 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 erpnext/selling/doctype/sales_order/test_records.json diff --git a/erpnext/controllers/tests/test_mapper.py b/erpnext/controllers/tests/test_mapper.py index d4e10447914..62a32878f8e 100644 --- a/erpnext/controllers/tests/test_mapper.py +++ b/erpnext/controllers/tests/test_mapper.py @@ -10,6 +10,9 @@ from erpnext.tests.utils import ERPNextTestSuite class TestMapper(ERPNextTestSuite): + def setUp(self): + self.load_test_records("Sales Order") + def test_map_docs(self): """Test mapping of multiple source docs on a single target doc""" @@ -37,6 +40,7 @@ class TestMapper(ERPNextTestSuite): "order_type": "Sales", "transaction_date": nowdate(), "valid_till": add_months(nowdate(), 1), + "company": self.companies[0].name, } ) for item in item_list: @@ -63,6 +67,6 @@ class TestMapper(ERPNextTestSuite): "uom": "_Test UOM", } ) - so = frappe.get_doc(frappe.get_test_records("Sales Order")[0]) + so = frappe.get_doc(self.globalTestRecords["Sales Order"][0]) so.insert(ignore_permissions=True) return so, [item.item_code] diff --git a/erpnext/selling/doctype/sales_order/test_records.json b/erpnext/selling/doctype/sales_order/test_records.json new file mode 100644 index 00000000000..b2957cb3929 --- /dev/null +++ b/erpnext/selling/doctype/sales_order/test_records.json @@ -0,0 +1,39 @@ +[ + { + "advance_paid": 0.0, + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer", + "doctype": "Sales Order", + "base_grand_total": 1000.0, + "grand_total": 1000.0, + "naming_series": "_T-Sales Order-", + "order_type": "Sales", + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "items": [ + { + "base_amount": 1000.0, + "base_rate": 100.0, + "description": "CPU", + "doctype": "Sales Order Item", + "item_code": "_Test Item", + "item_name": "_Test Item 1", + "delivery_date": "2013-02-23", + "parentfield": "items", + "qty": 10.0, + "rate": 100.0, + "warehouse": "_Test Warehouse - _TC", + "stock_uom": "_Test UOM", + "conversion_factor": 1.0, + "uom": "_Test UOM" + } + ], + "selling_price_list": "_Test Price List", + "territory": "_Test Territory", + "transaction_date": "2013-02-21" + } +] From d69b9d1a5492b215a247293b15734d0326a2d2e8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Feb 2026 19:31:10 +0530 Subject: [PATCH 160/217] refactor(test): make subcontracting controller deterministic --- erpnext/controllers/tests/test_subcontracting_controller.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py index d4c2aeda66c..06bf1bd545a 100644 --- a/erpnext/controllers/tests/test_subcontracting_controller.py +++ b/erpnext/controllers/tests/test_subcontracting_controller.py @@ -75,6 +75,7 @@ class TestSubcontractingController(ERPNextTestSuite): sco.create_raw_materials_supplied_or_received() self.assertIsNotNone(sco.supplied_items) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_multiple_items": 1}) def test_sco_with_bom(self): """ - Set backflush based on BOM. @@ -741,6 +742,7 @@ class TestSubcontractingController(ERPNextTestSuite): "doctype": "Serial No", "item_code": "Subcontracted SRM Item 2", "serial_no": serial_no, + "company": self.companies[0].name, } ).insert() From da855341186a408f21846cac8b02f6472c6aed97 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 11 Feb 2026 07:01:17 +0530 Subject: [PATCH 161/217] refactor(test): make accounts controller deterministic --- erpnext/controllers/tests/test_accounts_controller.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index 61493b15882..6bb9b2f91fc 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -72,6 +72,7 @@ class TestAccountsController(ERPNextTestSuite): self.create_item() self.create_parties() self.clear_old_entries() + frappe.flags.is_reverse_depr_entry = False def create_company(self): company_name = "_Test Company" @@ -931,7 +932,10 @@ class TestAccountsController(ERPNextTestSuite): self.assertEqual(exc_je_for_si, []) self.assertEqual(exc_je_for_pe, []) - @ERPNextTestSuite.change_settings("Accounts Settings", {"add_taxes_from_item_tax_template": 1}) + @ERPNextTestSuite.change_settings( + "Accounts Settings", + {"add_taxes_from_taxes_and_charges_template": 1, "add_taxes_from_item_tax_template": 0}, + ) def test_18_fetch_taxes_based_on_taxes_and_charges_template(self): # Create a Sales Taxes and Charges Template if not frappe.db.exists("Sales Taxes and Charges Template", "_Test Tax - _TC"): From b680aeb62c30b7398b26f83ef37187d5d6051223 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 11 Feb 2026 07:06:21 +0530 Subject: [PATCH 162/217] refactor(test): make item wise details deterministic --- erpnext/controllers/tests/test_item_wise_tax_details.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/tests/test_item_wise_tax_details.py b/erpnext/controllers/tests/test_item_wise_tax_details.py index 7628f77f7e3..f6d94c61eca 100644 --- a/erpnext/controllers/tests/test_item_wise_tax_details.py +++ b/erpnext/controllers/tests/test_item_wise_tax_details.py @@ -1,12 +1,12 @@ import json import frappe -from frappe.tests.utils import FrappeTestCase from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxesAndTotals(FrappeTestCase): +class TestTaxesAndTotals(ERPNextTestSuite): def setUp(self): self.doc = frappe.get_doc( { From bfffbcfee93fc5f676353c5cab03f9552334aa46 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 11 Feb 2026 07:59:20 +0530 Subject: [PATCH 163/217] refactor(test): make queries deterministic --- erpnext/controllers/tests/test_queries.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/erpnext/controllers/tests/test_queries.py b/erpnext/controllers/tests/test_queries.py index 664841e2da2..cfafb534857 100644 --- a/erpnext/controllers/tests/test_queries.py +++ b/erpnext/controllers/tests/test_queries.py @@ -15,15 +15,6 @@ def add_default_params(func, doctype): class TestQueries(ERPNextTestSuite): - # All tests are based on self.globalTestRecords[doctype] - - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.make_employees() - cls.make_leads() - cls.make_projects() - def assert_nested_in(self, item, container): self.assertIn(item, [vals for tuples in container for vals in tuples]) @@ -116,7 +107,7 @@ class TestQueries(ERPNextTestSuite): } ) - with ERPNextTestSuite.set_user(user.name): + with ERPNextTestSuite.set_user(self, user.name): params = { "doctype": "Employee", "txt": "", From 0c2a5384917b2ad8e6c55e70144ed2c52d7f214f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 12 Feb 2026 15:17:44 +0530 Subject: [PATCH 164/217] refactor(test): make opportunity summary by sales stage deterministic --- ...test_opportunity_summary_by_sales_stage.py | 4 ---- .../test_sales_pipeline_analytics.py | 19 ----------------- erpnext/tests/utils.py | 21 +++++++++++++++++++ 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py index 29bc14e04e7..f136294339f 100644 --- a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py +++ b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py @@ -2,8 +2,6 @@ from erpnext.crm.report.opportunity_summary_by_sales_stage.opportunity_summary_b execute, ) from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics import ( - create_company, - create_customer, create_opportunity, ) from erpnext.tests.utils import ERPNextTestSuite @@ -13,8 +11,6 @@ class TestOpportunitySummaryBySalesStage(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() - create_company() - create_customer() create_opportunity() def test_opportunity_summary_by_sales_stage(self): diff --git a/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py b/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py index dea4b772b65..893218c37ea 100644 --- a/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py +++ b/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py @@ -8,8 +8,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestSalesPipelineAnalytics(ERPNextTestSuite): def setUp(self): - create_company() - create_customer() create_opportunity() def test_sales_pipeline_analytics(self): @@ -181,23 +179,6 @@ class TestSalesPipelineAnalytics(ERPNextTestSuite): self.assertEqual(expected_data, report[1]) -def create_company(): - doc = frappe.db.exists("Company", "Best Test") - if not doc: - doc = frappe.new_doc("Company") - doc.company_name = "Best Test" - doc.default_currency = "INR" - doc.insert() - - -def create_customer(): - doc = frappe.db.exists("Customer", "_Test NC") - if not doc: - doc = frappe.new_doc("Customer") - doc.customer_name = "_Test NC" - doc.insert() - - def create_opportunity(): doc = frappe.db.exists({"doctype": "Opportunity", "party_name": "_Test NC"}) if not doc: diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 18ef2e05779..83009b277f8 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -162,6 +162,12 @@ class ERPNextTestSuite(unittest.TestCase): update_salutations() records = get_preset_records("India") + + from erpnext.setup.setup_wizard.operations.install_fixtures import read_lines + + for doctype, title_field, filename in (("UTM Source", "name", "marketing_source.txt"),): + records += [{"doctype": doctype, title_field: title} for title in read_lines(filename)] + presets_primary_key_map = { "Address Template": "country", "Item Group": "item_group_name", @@ -973,6 +979,14 @@ class ERPNextTestSuite(unittest.TestCase): "enable_perpetual_inventory": 0, "parent_company": "Parent Group Company India", }, + { + "abbr": "BT", + "company_name": "Best Test", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "chart_of_accounts": "Standard", + }, ] cls.companies = [] for x in records: @@ -2526,6 +2540,13 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Customer", "territory": "_Test Territory", }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test NC", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, ] cls.customer = [] for x in records: From 35339fcc0e1167cb41e70d3cc6d10f83de7afc24 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 12 Feb 2026 15:27:33 +0530 Subject: [PATCH 165/217] refactor(test): make job card deterministic --- erpnext/manufacturing/doctype/job_card/test_job_card.py | 9 ++++++++- erpnext/tests/utils.py | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index fc5b00fbaf9..76a8f6cb9ae 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -86,7 +86,12 @@ class TestJobCard(ERPNextTestSuite): cut_bom = create_semi_fg_bom(cut_fg.name, raw.name, inspection_required=1) stitch_bom = create_semi_fg_bom(stitch_fg.name, cut_fg.name, inspection_required=0) final_bom = frappe.new_doc( - "BOM", item=final.name, quantity=1, with_operations=1, track_semi_finished_goods=1 + "BOM", + item=final.name, + quantity=1, + with_operations=1, + track_semi_finished_goods=1, + company=self.companies[9].name, ) final_bom.append("items", {"item_code": raw.name, "qty": 1}) final_bom.append( @@ -120,6 +125,7 @@ class TestJobCard(ERPNextTestSuite): final_bom.append("items", {"item_code": stitch_fg.name, "qty": 1, "operation_row_id": 3}) final_bom.submit() work_order = make_work_order(final_bom.name, final.name, 1, variant_items=[], use_multi_level_bom=0) + work_order.company = self.companies[9].name work_order.wip_warehouse = "Work In Progress - WP" work_order.fg_warehouse = "Finished Goods - WP" work_order.scrap_warehouse = "All Warehouses - WP" @@ -933,6 +939,7 @@ def make_wo_with_transfer_against_jc(): def create_semi_fg_bom(semi_fg_item, raw_item, inspection_required): bom = frappe.new_doc("BOM") + bom.company = "Wind Power LLC" bom.item = semi_fg_item bom.quantity = 1 bom.inspection_required = inspection_required diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 83009b277f8..2a1685de0e6 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -935,8 +935,6 @@ class ERPNextTestSuite(unittest.TestCase): "abbr": "WP", "industry": "Manufacturing", "country": "United States", - # "fy_start_date": f"{current_year}-01-01", - # "fy_end_date": f"{current_year}-12-31", "language": "english", "company_tagline": "Testing", "email": "test@erpnext.com", From 67bb6a2d6abe1793452d0d1d86c2d2182b34d9e5 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 12 Feb 2026 16:49:49 +0530 Subject: [PATCH 166/217] refactor(test): make uae vat 201 deterministic --- .../report/uae_vat_201/test_uae_vat_201.py | 37 +++---------------- erpnext/tests/utils.py | 9 +++++ 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py index 7e719bb8aec..fd4c69e8f8a 100644 --- a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py +++ b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py @@ -15,16 +15,11 @@ from erpnext.regional.report.uae_vat_201.uae_vat_201 import ( get_zero_rated_total, ) from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse_account +from erpnext.tests.utils import ERPNextTestSuite -class TestUaeVat201(TestCase): +class TestUaeVat201(ERPNextTestSuite): def setUp(self): - frappe.set_user("Administrator") - - frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company UAE VAT'") - frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company UAE VAT'") - - make_company("_Test Company UAE VAT", "_TCUV") set_vat_accounts() make_customer() @@ -61,6 +56,9 @@ class TestUaeVat201(TestCase): self.assertEqual(get_standard_rated_expenses_total(filters), 250) self.assertEqual(get_standard_rated_expenses_tax(filters), 1) + @ERPNextTestSuite.change_settings( + "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": True} + ) def test_uae_vat_201_report_with_foreign_transaction(self): pi = make_purchase_invoice( company="_Test Company UAE VAT", @@ -93,31 +91,6 @@ class TestUaeVat201(TestCase): self.assertEqual(get_standard_rated_expenses_tax(filters), 50) -def make_company(company_name, abbr): - if not frappe.db.exists("Company", company_name): - company = frappe.get_doc( - { - "doctype": "Company", - "company_name": company_name, - "abbr": abbr, - "default_currency": "AED", - "country": "United Arab Emirates", - "create_chart_of_accounts_based_on": "Standard Template", - } - ) - company.insert() - else: - company = frappe.get_doc("Company", company_name) - - company.create_default_warehouses() - - if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": company.name}): - company.create_default_cost_center() - - company.save() - return company - - def set_vat_accounts(): if not frappe.db.exists("UAE VAT Settings", "_Test Company UAE VAT"): vat_accounts = frappe.get_all( diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 2a1685de0e6..f12f0dee2bd 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -985,6 +985,15 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "chart_of_accounts": "Standard", }, + { + "abbr": "_TCUV", + "company_name": "_Test Company UAE VAT", + "country": "United Arab Emirates", + "default_currency": "AED", + "doctype": "Company", + "domain": "Manufacturing", + "create_chart_of_accounts_based_on": "Standard Template", + }, ] cls.companies = [] for x in records: From 87de91e5d081e09f431f9f73798e188539a0a06d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 12 Feb 2026 17:07:41 +0530 Subject: [PATCH 167/217] refactor(test): make uae vat audit deterministic --- .../report/vat_audit_report/test_vat_audit_report.py | 4 ++-- erpnext/tests/utils.py | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py b/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py index 2533d42dd56..ded1bde3133 100644 --- a/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py +++ b/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py @@ -11,11 +11,11 @@ from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.regional.report.vat_audit_report.vat_audit_report import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestVATAuditReport(TestCase): +class TestVATAuditReport(ERPNextTestSuite): def setUp(self): - frappe.set_user("Administrator") make_company("_Test Company SA VAT", "_TCSV") create_account( diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index f12f0dee2bd..e80760beba6 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -991,7 +991,14 @@ class ERPNextTestSuite(unittest.TestCase): "country": "United Arab Emirates", "default_currency": "AED", "doctype": "Company", - "domain": "Manufacturing", + "create_chart_of_accounts_based_on": "Standard Template", + }, + { + "abbr": "_TCSV", + "company_name": "_Test Company SA VAT", + "country": "South Africa", + "default_currency": "ZAR", + "doctype": "Company", "create_chart_of_accounts_based_on": "Standard Template", }, ] From 1cc4b67098b1202f5fbaa95975f7151deb4fca7b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 12 Feb 2026 17:15:15 +0530 Subject: [PATCH 168/217] refactor(test): make sales order analysis deterministic --- .../sales_order_analysis/test_sales_order_analysis.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py b/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py index 79eae15bd01..1a200c7eba3 100644 --- a/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py +++ b/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py @@ -159,6 +159,12 @@ class TestSalesOrderAnalysis(ERPNextTestSuite): self.assertEqual(data[0][key], val) def test_05_all_so_status(self): + transaction_date = "2021-06-01" + item1, so1 = self.create_sales_order(transaction_date) + item2, so2 = self.create_sales_order(transaction_date) + + self.create_sales_invoice(so2) + columns, data, message, chart = execute( { "company": "_Test Company", @@ -166,8 +172,7 @@ class TestSalesOrderAnalysis(ERPNextTestSuite): "to_date": "2021-06-30", } ) - # SO's from first 4 test cases should be in output - self.assertEqual(len(data), 4) + self.assertEqual(len(data), 2) def test_06_so_pending_delivery_with_multiple_delivery_notes(self): transaction_date = "2021-06-01" From 6426f637988e7dd02f24206f8ce94090e1cbdf7f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 12 Feb 2026 17:21:12 +0530 Subject: [PATCH 169/217] refactor(test): make sales partner target variance deterministic --- .../test_sales_person_target_variance_based_on_item_group.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py index 73cab86459c..3285837e605 100644 --- a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py +++ b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py @@ -79,6 +79,7 @@ def create_sales_target_doc( ): sales_target_doc = frappe.new_doc(sales_field_dt) sales_target_doc.set(sales_field_name, sales_field_value) + sales_target_doc.territory = "_Test Territory" sales_target_doc.append( "targets", { From ed9470387e296ff951277fb5feb6d84fa89c7187 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 12 Feb 2026 17:31:23 +0530 Subject: [PATCH 170/217] refactor(test): make currency exchange deterministic --- .../currency_exchange/test_currency_exchange.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py index 3c94a302d2f..79df2a7ab32 100644 --- a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py +++ b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py @@ -79,10 +79,9 @@ def patched_requests_get(*args, **kwargs): @mock.patch("requests.get", side_effect=patched_requests_get) class TestCurrencyExchange(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Currency Exchange") + def setUp(self): + self.load_test_records("Currency Exchange") + save_new_records(self.globalTestRecords["Currency Exchange"]) def clear_cache(self): cache = frappe.cache() @@ -91,8 +90,6 @@ class TestCurrencyExchange(ERPNextTestSuite): cache.delete(key) def test_exchange_rate(self, mock_get): - save_new_records(self.globalTestRecords["Currency Exchange"]) - frappe.db.set_single_value("Accounts Settings", "allow_stale", 1) # Start with allow_stale is True @@ -116,8 +113,6 @@ class TestCurrencyExchange(ERPNextTestSuite): self.assertEqual(flt(exchange_rate, 3), 65.1) def test_exchange_rate_via_exchangerate_host(self, mock_get): - save_new_records(self.globalTestRecords["Currency Exchange"]) - # Update Currency Exchange Rate settings = frappe.get_single("Currency Exchange Settings") settings.service_provider = "exchangerate.host" From 46a81bc7c45937e4ed582fc8f34df4ee0825c4fc Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 13 Feb 2026 10:51:53 +0530 Subject: [PATCH 171/217] refactor(test): make stock test_utils deterministic --- erpnext/stock/tests/test_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/tests/test_utils.py b/erpnext/stock/tests/test_utils.py index f6625d2d93c..cdbc2b4b41b 100644 --- a/erpnext/stock/tests/test_utils.py +++ b/erpnext/stock/tests/test_utils.py @@ -86,7 +86,10 @@ class TestStockUtilities(ERPNextTestSuite, StockTestMixin): serial_item = self.make_item(properties={"has_serial_no": 1}) serial = frappe.get_doc( - doctype="Serial No", item_code=serial_item.name, serial_no=frappe.generate_hash() + doctype="Serial No", + item_code=serial_item.name, + serial_no=frappe.generate_hash(), + company=self.companies[0].name, ).insert() serial_scan = scan_barcode(serial.name) From 61b40fdccc3977526e5d670f635ba555861e497e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 13 Feb 2026 12:34:45 +0530 Subject: [PATCH 172/217] refactor(test): make pos closing deterministic --- .../test_pos_closing_entry.py | 25 ++++---- .../pos_invoice_merge_log.py | 62 +++++++++++-------- 2 files changed, 48 insertions(+), 39 deletions(-) diff --git a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py index ff11fe5f4fe..af5f73a39ec 100644 --- a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py +++ b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py @@ -25,20 +25,10 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPOSClosingEntry(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - frappe.db.sql("delete from `tabPOS Opening Entry`") - cls.enterClassContext(cls.change_settings("POS Settings", {"invoice_type": "POS Invoice"})) - - @classmethod - def tearDownClass(cls): - frappe.db.sql("delete from `tabPOS Opening Entry`") - def setUp(self): - # Make stock available for POS Sales - frappe.db.sql("delete from `tabPOS Opening Entry`") + init_user_and_profile() make_stock_entry(target="_Test Warehouse - _TC", qty=2, basic_rate=100) + frappe.db.set_single_value("POS Settings", "invoice_type", "POS Invoice") def test_pos_closing_entry(self): test_user, pos_profile = init_user_and_profile() @@ -55,6 +45,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): pos_inv2.submit() pcv_doc = make_closing_entry_from_opening(opening_entry) + pcv_doc.flags.in_test = True payment = pcv_doc.payment_reconciliation[0] self.assertEqual(payment.mode_of_payment, "Cash") @@ -63,6 +54,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): if d.mode_of_payment == "Cash": d.closing_amount = 6700 + pcv_doc.flags.in_test = True pcv_doc.submit() self.assertEqual(pcv_doc.total_quantity, 2) @@ -81,6 +73,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): pos_inv.submit() pcv_doc = make_closing_entry_from_opening(opening_entry) + pcv_doc.flags.in_test = True pcv_doc.submit() self.assertTrue(pcv_doc.name) @@ -113,6 +106,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): pos_return.submit() pcv_doc = make_closing_entry_from_opening(opening_entry) + pcv_doc.flags.in_test = True pcv_doc.submit() opening_entry = create_opening_entry(pos_profile, test_user.name) @@ -142,6 +136,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): if d.mode_of_payment == "Cash": d.closing_amount = 6700 + pcv_doc.flags.in_test = True pcv_doc.submit() pos_inv1.load_from_db() @@ -195,6 +190,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): pcv_doc = make_closing_entry_from_opening(opening_entry) # will assert coz the new mandatory accounting dimension bank is not set in POS Profile + pcv_doc.flags.in_test = True self.assertRaises(frappe.ValidationError, pcv_doc.submit) accounting_dimension_department = frappe.get_doc( @@ -262,6 +258,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): self.assertEqual(batch_qty_with_pos, 0.0) pcv_doc = make_closing_entry_from_opening(opening_entry) + pcv_doc.flags.in_test = True pcv_doc.submit() piv_merge = frappe.db.get_value("POS Invoice Merge Log", {"pos_closing_entry": pcv_doc.name}, "name") @@ -285,6 +282,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): frappe.flags.print_message = True pcv_doc.reload() + pcv_doc.flags.in_test = True pcv_doc.cancel() batch_qty_with_pos = get_batch_qty(batch_no, "_Test Warehouse - _TC", item_code) @@ -327,6 +325,7 @@ class TestPOSClosingEntry(ERPNextTestSuite): if d.mode_of_payment == "Cash": d.closing_amount = 1500 + pcv_doc.flags.in_test = True pcv_doc.submit() self.assertEqual(pcv_doc.total_quantity, 15) @@ -470,7 +469,7 @@ def init_user_and_profile(**args): user = "test@example.com" test_user = frappe.get_doc("User", user) - roles = ("Accounts Manager", "Accounts User", "Sales Manager") + roles = ("Accounts Manager", "Accounts User", "Sales Manager", "Stock User", "Item Manager") test_user.add_roles(*roles) frappe.set_user(user) diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py index a1b0ecefa38..e41548b89f6 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py @@ -572,7 +572,7 @@ def split_invoices(invoices): def create_merge_logs(invoice_by_customer, closing_entry=None): - try: + def merge_and_close(): for customer, invoices_acc_dim in invoice_by_customer.items(): for invoices in invoices_acc_dim.values(): for _invoices in split_invoices(invoices): @@ -594,25 +594,30 @@ def create_merge_logs(invoice_by_customer, closing_entry=None): closing_entry.db_set("error_message", "") closing_entry.update_opening_entry() - except Exception as e: - frappe.db.rollback() - message_log = frappe.message_log.pop() if frappe.message_log else str(e) - error_message = get_error_message(message_log) + if frappe.in_test: + merge_and_close() + else: + try: + merge_and_close() + except Exception as e: + frappe.db.rollback() + message_log = frappe.message_log.pop() if frappe.message_log else str(e) + error_message = get_error_message(message_log) - if closing_entry: - closing_entry.set_status(update=True, status="Failed") - if isinstance(error_message, list): - error_message = json.dumps(error_message) - closing_entry.db_set("error_message", error_message) - raise + if closing_entry: + closing_entry.set_status(update=True, status="Failed") + if isinstance(error_message, list): + error_message = json.dumps(error_message) + closing_entry.db_set("error_message", error_message) + raise - finally: - frappe.db.commit() - frappe.publish_realtime("closing_process_complete", user=frappe.session.user) + finally: + frappe.db.commit() + frappe.publish_realtime("closing_process_complete", user=frappe.session.user) def cancel_merge_logs(merge_logs, closing_entry=None): - try: + def merge_cancel_and_close(): for log in merge_logs: merge_log = frappe.get_doc("POS Invoice Merge Log", log) if merge_log.docstatus == 2: @@ -626,19 +631,24 @@ def cancel_merge_logs(merge_logs, closing_entry=None): closing_entry.db_set("error_message", "") closing_entry.update_opening_entry(for_cancel=True) - except Exception as e: - frappe.db.rollback() - message_log = frappe.message_log.pop() if frappe.message_log else str(e) - error_message = get_error_message(message_log) + if frappe.flags.in_test: + merge_cancel_and_close() + else: + try: + merge_cancel_and_close() + except Exception as e: + frappe.db.rollback() + message_log = frappe.message_log.pop() if frappe.message_log else str(e) + error_message = get_error_message(message_log) - if closing_entry: - closing_entry.set_status(update=True, status="Submitted") - closing_entry.db_set("error_message", error_message) - raise + if closing_entry: + closing_entry.set_status(update=True, status="Submitted") + closing_entry.db_set("error_message", error_message) + raise - finally: - frappe.db.commit() - frappe.publish_realtime("closing_process_complete", user=frappe.session.user) + finally: + frappe.db.commit() + frappe.publish_realtime("closing_process_complete", user=frappe.session.user) def enqueue_job(job, **kwargs): From dba530bb47777c432ce128aaab0eabb8ab7108fe Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 13 Feb 2026 12:40:51 +0530 Subject: [PATCH 173/217] refactor(test): make pos invoice merge log deterministic --- .../test_pos_invoice_merge_log.py | 91 +++++-------------- 1 file changed, 22 insertions(+), 69 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py index 6846752a044..757860a76c6 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py @@ -22,22 +22,21 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPOSInvoiceMergeLog(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - frappe.db.sql("delete from `tabPOS Opening Entry`") - cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) - cls.enterClassContext(cls.change_settings("POS Settings", invoice_type="POS Invoice")) - mode_of_payment = frappe.get_doc("Mode of Payment", "Bank Draft") - set_default_account_for_mode_of_payment(mode_of_payment, "_Test Company", "_Test Bank - _TC") - def setUp(self): - frappe.db.sql("delete from `tabPOS Invoice`") + mode_of_payment = frappe.get_doc("Mode of Payment", "Bank Draft") + self.test_user, self.pos_profile = init_user_and_profile() + self.opening_entry = create_opening_entry(self.pos_profile, self.test_user.name) + + set_default_account_for_mode_of_payment(mode_of_payment, "_Test Company", "_Test Bank - _TC") + frappe.db.set_single_value("POS Settings", "invoice_type", "POS Invoice") + frappe.db.set_single_value("Selling Settings", "validate_selling_price", 0) + + def make_closing_entry(self): + closing_entry = make_closing_entry_from_opening(self.opening_entry) + closing_entry.insert().submit() + return closing_entry def test_consolidated_invoice_creation(self): - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - pos_inv = create_pos_invoice(rate=300, do_not_submit=1) pos_inv.append("payments", {"mode_of_payment": "Cash", "account": "Cash - _TC", "amount": 300}) pos_inv.save() @@ -53,9 +52,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): pos_inv3.save() pos_inv3.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() pos_inv.load_from_db() self.assertTrue(frappe.db.exists("Sales Invoice", pos_inv.consolidated_invoice)) @@ -66,9 +63,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): self.assertFalse(pos_inv.consolidated_invoice == pos_inv3.consolidated_invoice) def test_consolidated_credit_note_creation(self): - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - pos_inv = create_pos_invoice(rate=300, do_not_submit=1) pos_inv.append("payments", {"mode_of_payment": "Cash", "account": "Cash - _TC", "amount": 300}) pos_inv.save() @@ -93,9 +87,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): pos_inv_cn.paid_amount = -300 pos_inv_cn.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() pos_inv.load_from_db() self.assertTrue(frappe.db.exists("Sales Invoice", pos_inv.consolidated_invoice)) @@ -113,9 +105,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): self.assertEqual(consolidated_credit_note.payments[1].amount, -200) def test_consolidated_invoice_item_taxes(self): - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - inv = create_pos_invoice(qty=1, rate=100, do_not_save=True) inv.append( @@ -152,9 +141,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): inv2.save() inv2.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() inv.load_from_db() @@ -202,9 +189,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): qty=10, ) - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - inv = create_pos_invoice(qty=3, rate=10000, do_not_save=True) inv.append( "taxes", @@ -239,9 +223,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): inv2.insert() inv2.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() inv.load_from_db() consolidated_invoice = frappe.get_doc("Sales Invoice", inv.consolidated_invoice) @@ -259,9 +241,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): qty=10, ) - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - inv = create_pos_invoice(qty=6, rate=10000, do_not_save=True) inv.append( "taxes", @@ -301,9 +280,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): inv3.insert() inv3.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() inv.load_from_db() consolidated_invoice = frappe.get_doc("Sales Invoice", inv.consolidated_invoice) @@ -320,8 +297,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): rate=8000, qty=10, ) - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) item_rates = [69, 59, 29] for _i in [1, 2]: @@ -358,9 +333,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): inv.save() inv.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() inv.load_from_db() consolidated_invoice = frappe.get_doc("Sales Invoice", inv.consolidated_invoice) @@ -378,9 +351,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): qty=10, ) - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - inv = create_pos_invoice(qty=1, rate=69.5, do_not_save=True) inv.append("payments", {"mode_of_payment": "Cash", "account": "Cash - _TC", "amount": 70}) inv.insert() @@ -391,9 +361,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): inv2.insert() inv2.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() inv.load_from_db() consolidated_invoice = frappe.get_doc("Sales Invoice", inv.consolidated_invoice) @@ -416,9 +384,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): se = make_serialized_item(self) serial_no = get_serial_nos_from_bundle(se.get("items")[0].serial_and_batch_bundle)[0] - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - pos_inv = create_pos_invoice( item_code="_Test Serialized Item With Series", serial_no=[serial_no], @@ -445,9 +410,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): pos_inv2.save() pos_inv2.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() pos_inv.load_from_db() pos_inv2.load_from_db() @@ -466,9 +429,6 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): create_cost_center(cost_center_name="_Test POS Cost Center 1", is_group=0) create_cost_center(cost_center_name="_Test POS Cost Center 2", is_group=0) - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - pos_inv = create_pos_invoice(rate=300, do_not_submit=1) pos_inv.append("payments", {"mode_of_payment": "Cash", "account": "Cash - _TC", "amount": 300}) pos_inv.cost_center = "_Test POS Cost Center 1 - _TC" @@ -487,9 +447,7 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): pos_inv3.save() pos_inv3.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + self.make_closing_entry() pos_inv.load_from_db() self.assertTrue(frappe.db.exists("Sales Invoice", pos_inv.consolidated_invoice)) @@ -508,17 +466,12 @@ class TestPOSInvoiceMergeLog(ERPNextTestSuite): """ Test if the company is fetched from POS Closing Entry """ - test_user, pos_profile = init_user_and_profile() - opening_entry = create_opening_entry(pos_profile, test_user.name) - pos_inv = create_pos_invoice(rate=300, do_not_submit=1) pos_inv.append("payments", {"mode_of_payment": "Cash", "account": "Cash - _TC", "amount": 300}) pos_inv.save() pos_inv.submit() - closing_entry = make_closing_entry_from_opening(opening_entry) - closing_entry.insert() - closing_entry.submit() + closing_entry = self.make_closing_entry() self.assertTrue(frappe.db.exists("POS Invoice Merge Log", {"pos_closing_entry": closing_entry.name})) From 78b0db7988868dc9c7f1aa0f2c3bf2355132f3c4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 13 Feb 2026 12:49:11 +0530 Subject: [PATCH 174/217] refactor(test): make pos opening entry deterministic --- .../test_pos_opening_entry.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py index 2a26b29d382..775a18901c8 100644 --- a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py +++ b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py @@ -12,20 +12,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPOSOpeningEntry(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - frappe.db.sql("delete from `tabPOS Opening Entry`") - cls.enterClassContext(cls.change_settings("POS Settings", {"invoice_type": "POS Invoice"})) - - @classmethod - def tearDownClass(cls): - super().tearDownClass() - frappe.db.sql("delete from `tabPOS Opening Entry`") - def setUp(self): - # Make stock available for POS Sales - frappe.db.sql("delete from `tabPOS Opening Entry`") + frappe.db.set_single_value("POS Settings", "invoice_type", "POS Invoice") make_stock_entry(target="_Test Warehouse - _TC", qty=2, basic_rate=100) from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile @@ -59,7 +47,9 @@ class TestPOSOpeningEntry(ERPNextTestSuite): self.assertEqual(opening_entry_1.status, "Open") self.assertEqual(opening_entry_1.user, test_user.name) - cashier_user = create_user("test_cashier@example.com", "Accounts Manager", "Sales Manager") + cashier_user = create_user( + "test_cashier@example.com", "Accounts Manager", "Sales Manager", "Stock User", "System Manager" + ) frappe.set_user(cashier_user.name) pos_profile2 = make_pos_profile(name="_Test POS Profile 2") From 2bfd37152652321f94af2cc7b69bcf46356046b4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 13 Feb 2026 15:43:17 +0530 Subject: [PATCH 175/217] refactor(test): make pos profile deterministic --- erpnext/accounts/doctype/pos_profile/test_pos_profile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py index 1e874579a98..f547de9a97e 100644 --- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -14,6 +14,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPOSProfile(ERPNextTestSuite): def test_pos_profile(self): + frappe.set_user("Administrator") make_pos_profile() pos_profile = get_pos_profile("_Test Company") or {} @@ -35,8 +36,6 @@ class TestPOSProfile(ERPNextTestSuite): self.assertEqual(len(items), products_count[0][0]) self.assertEqual(len(customers), customers_count[0][0]) - frappe.db.sql("delete from `tabPOS Profile`") - def test_disabled_pos_profile_creation(self): make_pos_profile(name="_Test POS Profile 001", disabled=1) From 3f0dbbc17c3db2910f6f458fa2ca91b5a76e6f2d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 17 Feb 2026 11:01:47 +0530 Subject: [PATCH 176/217] refactor(test): make bom stock calculated deterministic --- .../report/bom_stock_calculated/test_bom_stock_calculated.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py b/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py index 37642da0680..e0105b114c5 100644 --- a/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py +++ b/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py @@ -1,6 +1,8 @@ # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt +import frappe + from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.manufacturing.report.bom_stock_calculated.bom_stock_calculated import ( execute as bom_stock_calculated_report, @@ -56,6 +58,7 @@ def create_items(): "standard_rate": 100, "opening_stock": 100, "last_purchase_rate": 100, + "item_defaults": [{"company": "_Test Company", "default_warehouse": "Stores - _TC"}], } ).name rm_item2 = make_item( @@ -64,6 +67,7 @@ def create_items(): "standard_rate": 200, "opening_stock": 200, "last_purchase_rate": 200, + "item_defaults": [{"company": "_Test Company", "default_warehouse": "Stores - _TC"}], } ).name From 16bd1075834afd2af8211789e2b332d519f28dc1 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 14 Feb 2026 14:39:34 +0530 Subject: [PATCH 177/217] refactor(test): common make function --- .../doctype/bom/test_records.json | 3 + erpnext/tests/utils.py | 532 +++--------------- 2 files changed, 76 insertions(+), 459 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/test_records.json b/erpnext/manufacturing/doctype/bom/test_records.json index e9cbdfe638a..27752d85119 100644 --- a/erpnext/manufacturing/doctype/bom/test_records.json +++ b/erpnext/manufacturing/doctype/bom/test_records.json @@ -79,6 +79,7 @@ "is_default": 1, "currency": "USD", "item": "_Test FG Item", + "company": "_Test Company", "quantity": 1.0 }, { @@ -161,6 +162,7 @@ "currency": "USD", "item": "_Test Variant Item", "quantity": 1.0, + "company": "_Test Company", "with_operations": 1 }, { @@ -187,6 +189,7 @@ "quantity": 1.0, "with_operations": 0, "fg_based_operating_cost": 1, + "company": "_Test Company", "operating_cost_per_bom_quantity": 140 } ] diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index e80760beba6..3b3bbd278c0 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -303,6 +303,27 @@ class ERPNextTestSuite(unittest.TestCase): stock_settings.enable_serial_and_batch_no_for_item = 1 stock_settings.save() + @classmethod + def make_records(cls, key, records, attr): + doctype = records[0].get("doctype") + data = [] + + def get_filters(record): + filters = {} + for x in key: + filters[x] = record.get(x) + return filters + + for x in records: + filters = get_filters(x) + if not frappe.db.exists(doctype, filters): + data.append(frappe.get_doc(x).insert()) + else: + data.append(frappe.get_doc(doctype, filters)) + + if not hasattr(cls, attr): + setattr(cls, attr, data) + @classmethod def make_price_list(cls): records = [ @@ -372,32 +393,9 @@ class ERPNextTestSuite(unittest.TestCase): "selling": 0, }, ] - cls.price_list = [] - for x in records: - if not frappe.db.exists( - "Price List", - { - "price_list_name": x.get("price_list_name"), - "enabled": x.get("enabled"), - "selling": x.get("selling"), - "buying": x.get("buying"), - "currency": x.get("currency"), - }, - ): - cls.price_list.append(frappe.get_doc(x).insert()) - else: - cls.price_list.append( - frappe.get_doc( - "Price List", - { - "price_list_name": x.get("price_list_name"), - "enabled": x.get("enabled"), - "selling": x.get("selling"), - "buying": x.get("buying"), - "currency": x.get("currency"), - }, - ) - ) + cls.make_records( + ["price_list_name", "enabled", "selling", "buying", "currency"], records, "price_list" + ) @classmethod def make_monthly_distribution(cls): @@ -422,14 +420,7 @@ class ERPNextTestSuite(unittest.TestCase): ], } ] - cls.monthly_distribution = [] - for x in records: - if not frappe.db.exists("Monthly Distribution", {"distribution_id": x.get("distribution_id")}): - cls.monthly_distribution.append(frappe.get_doc(x).insert()) - else: - cls.monthly_distribution.append( - frappe.get_doc("Monthly Distribution", {"distribution_id": x.get("distribution_id")}) - ) + cls.make_records(["distribution_id"], records, "monthly_distribution") @classmethod def make_projects(cls): @@ -441,13 +432,7 @@ class ERPNextTestSuite(unittest.TestCase): "status": "Open", } ] - - cls.projects = [] - for x in records: - if not frappe.db.exists("Project", {"project_name": x.get("project_name")}): - cls.projects.append(frappe.get_doc(x).insert()) - else: - cls.projects.append(frappe.get_doc("Project", {"project_name": x.get("project_name")})) + cls.make_records(["project_name"], records, "projects") @classmethod def make_customer_group(cls): @@ -465,14 +450,7 @@ class ERPNextTestSuite(unittest.TestCase): "parent_customer_group": "All Customer Groups", }, ] - cls.customer_group = [] - for x in records: - if not frappe.db.exists("Customer Group", {"customer_group_name": x.get("customer_group_name")}): - cls.customer_group.append(frappe.get_doc(x).insert()) - else: - cls.customer_group.append( - frappe.get_doc("Customer Group", {"customer_group_name": x.get("customer_group_name")}) - ) + cls.make_records(["customer_group_name"], records, "customer_group") @classmethod def make_territory(cls): @@ -508,14 +486,7 @@ class ERPNextTestSuite(unittest.TestCase): "territory_name": "_Test Territory United States", }, ] - cls.territories = [] - for x in records: - if not frappe.db.exists("Territory", {"territory_name": x.get("territory_name")}): - cls.territories.append(frappe.get_doc(x).insert()) - else: - cls.territories.append( - frappe.get_doc("Territory", {"territory_name": x.get("territory_name")}) - ) + cls.make_records(["territory_name"], records, "territories") @classmethod def make_department(cls): @@ -533,14 +504,7 @@ class ERPNextTestSuite(unittest.TestCase): "parent_department": "All Departments", }, ] - cls.department = [] - for x in records: - if not frappe.db.exists("Department", {"department_name": x.get("department_name")}): - cls.department.append(frappe.get_doc(x).insert()) - else: - cls.department.append( - frappe.get_doc("Department", {"department_name": x.get("department_name")}) - ) + cls.make_records(["department_name"], records, "department") @classmethod def make_role(cls): @@ -551,12 +515,7 @@ class ERPNextTestSuite(unittest.TestCase): {"doctype": "Role", "role_name": "_Test Role 4", "desk_access": 0}, {"doctype": "Role", "role_name": "Technician"}, ] - cls.roles = [] - for x in records: - if not frappe.db.exists("Role", {"role_name": x.get("role_name")}): - cls.roles.append(frappe.get_doc(x).insert()) - else: - cls.roles.append(frappe.get_doc("Role", {"role_name": x.get("role_name")})) + cls.make_records(["role_name"], records, "roles") @classmethod def make_user(cls): @@ -654,14 +613,7 @@ class ERPNextTestSuite(unittest.TestCase): "roles": [{"doctype": "Has Role", "role": "Technician"}], }, ] - cls.users = [] - for x in records: - if not frappe.db.exists("User", {"email": x.get("email")}): - user = frappe.get_doc(x) - user.flags.no_welcome_mail = True - cls.users.append(user.insert()) - else: - cls.users.append(frappe.get_doc("User", {"email": x.get("email")})) + cls.make_records(["email"], records, "users") @classmethod def make_employees(cls): @@ -703,12 +655,7 @@ class ERPNextTestSuite(unittest.TestCase): "user_id": "test2@example.com", }, ] - cls.employees = [] - for x in records: - if not frappe.db.exists("Employee", {"first_name": x.get("first_name")}): - cls.employees.append(frappe.get_doc(x).insert()) - else: - cls.employees.append(frappe.get_doc("Employee", {"first_name": x.get("first_name")})) + cls.make_records(["first_name"], records, "employees") @classmethod def make_sales_person(cls): @@ -735,14 +682,7 @@ class ERPNextTestSuite(unittest.TestCase): "sales_person_name": "_Test Sales Person 2", }, ] - cls.sales_person = [] - for x in records: - if not frappe.db.exists("Sales Person", {"sales_person_name": x.get("sales_person_name")}): - cls.sales_person.append(frappe.get_doc(x).insert()) - else: - cls.sales_person.append( - frappe.get_doc("Sales Person", {"sales_person_name": x.get("sales_person_name")}) - ) + cls.make_records(["sales_person_name"], records, "sales_person") @classmethod def make_leads(cls): @@ -785,12 +725,7 @@ class ERPNextTestSuite(unittest.TestCase): "naming_series": "_T-Lead-", }, ] - cls.leads = [] - for x in records: - if not frappe.db.exists("Lead", {"email_id": x.get("email_id")}): - cls.leads.append(frappe.get_doc(x).insert()) - else: - cls.leads.append(frappe.get_doc("Lead", {"email_id": x.get("email_id")})) + cls.make_records(["email_id"], records, "leads") @classmethod def make_holiday_list(cls): @@ -807,14 +742,7 @@ class ERPNextTestSuite(unittest.TestCase): "holiday_list_name": "_Test Holiday List", } ] - cls.holiday_list = [] - for x in records: - if not frappe.db.exists("Holiday List", {"holiday_list_name": x.get("holiday_list_name")}): - cls.holiday_list.append(frappe.get_doc(x).insert()) - else: - cls.holiday_list.append( - frappe.get_doc("Holiday List", {"holiday_list_name": x.get("holiday_list_name")}) - ) + cls.make_records(["holiday_list_name"], records, "holiday_list") @classmethod def make_company(cls): @@ -1002,12 +930,7 @@ class ERPNextTestSuite(unittest.TestCase): "create_chart_of_accounts_based_on": "Standard Template", }, ] - cls.companies = [] - for x in records: - if not frappe.db.exists("Company", {"company_name": x.get("company_name")}): - cls.companies.append(frappe.get_doc(x).insert()) - else: - cls.companies.append(frappe.get_doc("Company", {"company_name": x.get("company_name")})) + cls.make_records(["company_name"], records, "companies") @classmethod def make_fiscal_year(cls): @@ -1033,23 +956,8 @@ class ERPNextTestSuite(unittest.TestCase): } ) - cls.fiscal_year = [] - for x in records: - if not frappe.db.exists( - "Fiscal Year", - {"year_start_date": x.get("year_start_date"), "year_end_date": x.get("year_end_date")}, - ): - cls.fiscal_year.append(frappe.get_doc(x).insert()) - else: - cls.fiscal_year.append( - frappe.get_doc( - "Fiscal Year", - { - "year_start_date": x.get("year_start_date"), - "year_end_date": x.get("year_end_date"), - }, - ) - ) + key = ["year_start_date", "year_end_date"] + cls.make_records(key, records, "fiscal_year") @classmethod def make_payment_term(cls): @@ -1087,14 +995,7 @@ class ERPNextTestSuite(unittest.TestCase): "credit_days": 30, }, ] - cls.payment_terms = [] - for x in records: - if not frappe.db.exists("Payment Term", {"payment_term_name": x.get("payment_term_name")}): - cls.payment_terms.append(frappe.get_doc(x).insert()) - else: - cls.payment_terms.append( - frappe.get_doc("Payment Term", {"payment_term_name": x.get("payment_term_name")}) - ) + cls.make_records(["payment_term_name"], records, "payment_terms") @classmethod def make_payment_terms_template(cls): @@ -1158,28 +1059,16 @@ class ERPNextTestSuite(unittest.TestCase): "template_name": "_Test Payment Term Template 3", }, ] - cls.payment_terms_template = [] - for x in records: - if not frappe.db.exists("Payment Terms Template", {"template_name": x.get("template_name")}): - cls.payment_terms_template.append(frappe.get_doc(x).insert()) - else: - cls.payment_terms_template.append( - frappe.get_doc("Payment Terms Template", {"template_name": x.get("template_name")}) - ) + cls.make_records(["template_name"], records, "payment_terms_template") @classmethod def make_tax_category(cls): records = [ - {"doctype": "Tax Category", "title": "_Test Tax Category 1"}, - {"doctype": "Tax Category", "title": "_Test Tax Category 2"}, - {"doctype": "Tax Category", "title": "_Test Tax Category 3"}, + {"doctype": "Tax Category", "name": "_Test Tax Category 1", "title": "_Test Tax Category 1"}, + {"doctype": "Tax Category", "name": "_Test Tax Category 2", "title": "_Test Tax Category 2"}, + {"doctype": "Tax Category", "name": "_Test Tax Category 3", "title": "_Test Tax Category 3"}, ] - cls.tax_category = [] - for x in records: - if not frappe.db.exists("Tax Category", {"name": x.get("title")}): - cls.tax_category.append(frappe.get_doc(x).insert()) - else: - cls.tax_category.append(frappe.get_doc("Tax Category", {"name": x.get("title")})) + cls.make_records(["title"], records, "tax_category") @classmethod def make_account(cls): @@ -1204,18 +1093,7 @@ class ERPNextTestSuite(unittest.TestCase): "company": "_Test Company with perpetual inventory", }, ] - cls.accounts = [] - for x in records: - if not frappe.db.exists( - "Account", {"account_name": x.get("account_name"), "company": x.get("company")} - ): - cls.accounts.append(frappe.get_doc(x).insert()) - else: - cls.accounts.append( - frappe.get_doc( - "Account", {"account_name": x.get("account_name"), "company": x.get("company")} - ) - ) + cls.make_records(["account_name", "company"], records, "accounts") @classmethod def make_supplier(cls): @@ -1275,12 +1153,7 @@ class ERPNextTestSuite(unittest.TestCase): "companies": [{"company": cls.companies[6].name}], }, ] - cls.suppliers = [] - for x in records: - if not frappe.db.exists("Supplier", {"supplier_name": x.get("supplier_name")}): - cls.suppliers.append(frappe.get_doc(x).insert()) - else: - cls.suppliers.append(frappe.get_doc("Supplier", {"supplier_name": x.get("supplier_name")})) + cls.make_records(["supplier_name"], records, "suppliers") @classmethod def make_supplier_group(cls): @@ -1291,14 +1164,7 @@ class ERPNextTestSuite(unittest.TestCase): "parent_supplier_group": "All Supplier Groups", } ] - cls.supplier_groups = [] - for x in records: - if not frappe.db.exists("Supplier Group", {"supplier_group_name": x.get("supplier_group_name")}): - cls.supplier_groups.append(frappe.get_doc(x).insert()) - else: - cls.supplier_groups.append( - frappe.get_doc("Supplier Group", {"supplier_group_name": x.get("supplier_group_name")}) - ) + cls.make_records(["supplier_group_name"], records, "supplier_groups") @classmethod def make_cost_center(cls): @@ -1325,19 +1191,7 @@ class ERPNextTestSuite(unittest.TestCase): "parent_cost_center": "_Test Company - _TC", }, ] - cls.cost_center = [] - for x in records: - if not frappe.db.exists( - "Cost Center", {"cost_center_name": x.get("cost_center_name"), "company": x.get("company")} - ): - cls.cost_center.append(frappe.get_doc(x).insert()) - else: - cls.cost_center.append( - frappe.get_doc( - "Cost Center", - {"cost_center_name": x.get("cost_center_name"), "company": x.get("company")}, - ) - ) + cls.make_records(["cost_center_name", "company"], records, "cost_center") @classmethod def make_location(cls): @@ -1381,17 +1235,7 @@ class ERPNextTestSuite(unittest.TestCase): "is_container": 1, }, ] - cls.location = [] - for x in records: - if not frappe.db.exists("Location", {"location_name": x.get("location_name")}): - cls.location.append(frappe.get_doc(x).insert()) - else: - cls.location.append( - frappe.get_doc( - "Location", - {"location_name": x.get("location_name")}, - ) - ) + cls.make_records(["location_name"], records, "location") @classmethod def make_warehouse(cls): @@ -1471,19 +1315,7 @@ class ERPNextTestSuite(unittest.TestCase): "is_group": 0, }, ] - cls.warehouse = [] - for x in records: - if not frappe.db.exists( - "Warehouse", {"warehouse_name": x.get("warehouse_name"), "company": x.get("company")} - ): - cls.warehouse.append(frappe.get_doc(x).insert()) - else: - cls.warehouse.append( - frappe.get_doc( - "Warehouse", - {"warehouse_name": x.get("warehouse_name"), "company": x.get("company")}, - ) - ) + cls.make_records(["warehouse_name", "company"], records, "warehouse") @classmethod def make_uom(cls): @@ -1491,17 +1323,7 @@ class ERPNextTestSuite(unittest.TestCase): {"doctype": "UOM", "must_be_whole_number": 1, "uom_name": "_Test UOM"}, {"doctype": "UOM", "uom_name": "_Test UOM 1"}, ] - cls.uom = [] - for x in records: - if not frappe.db.exists("UOM", {"uom_name": x.get("uom_name")}): - cls.uom.append(frappe.get_doc(x).insert()) - else: - cls.uom.append( - frappe.get_doc( - "UOM", - {"uom_name": x.get("uom_name")}, - ) - ) + cls.make_records(["uom_name"], records, "uom") @classmethod def make_item_attribute(cls): @@ -1530,17 +1352,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.item_attribute = [] - for x in records: - if not frappe.db.exists("Item Attribute", {"attribute_name": x.get("attribute_name")}): - cls.item_attribute.append(frappe.get_doc(x).insert()) - else: - cls.item_attribute.append( - frappe.get_doc( - "Item Attribute", - {"attribute_name": x.get("attribute_name")}, - ) - ) + cls.make_records(["attribute_name"], records, "item_attribute") @classmethod def make_item_tax_template(cls): @@ -1623,19 +1435,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.item_tax_template = [] - for x in records: - if not frappe.db.exists( - "Item Tax Template", {"title": x.get("title"), "company": x.get("company")} - ): - cls.item_tax_template.append(frappe.get_doc(x).insert()) - else: - cls.item_tax_template.append( - frappe.get_doc( - "Item Tax Template", - {"title": x.get("title"), "company": x.get("company")}, - ) - ) + cls.make_records(["title", "company"], records, "item_tax_template") @classmethod def make_item_group(cls): @@ -1749,14 +1549,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.item_group = [] - for x in records: - if not frappe.db.exists("Item Group", {"item_group_name": x.get("item_group_name")}): - cls.item_group.append(frappe.get_doc(x).insert()) - else: - cls.item_group.append( - frappe.get_doc("Item Group", {"item_group_name": x.get("item_group_name")}) - ) + cls.make_records(["item_group_name"], records, "item_group") @classmethod def _make_item(cls): @@ -2351,19 +2144,7 @@ class ERPNextTestSuite(unittest.TestCase): "company": "_Test Company", }, ] - cls.item = [] - for x in records: - if not frappe.db.exists( - "Item", {"item_code": x.get("item_code"), "item_name": x.get("item_name")} - ): - cls.item.append(frappe.get_doc(x).insert()) - else: - cls.item.append( - frappe.get_doc( - "Item", - {"item_code": x.get("item_code"), "item_name": x.get("item_name")}, - ) - ) + cls.make_records(["item_code", "item_name"], records, "item") @classmethod def make_product_bundle(cls): @@ -2387,17 +2168,7 @@ class ERPNextTestSuite(unittest.TestCase): ], } ] - cls.product_bundle = [] - for x in records: - if not frappe.db.exists("Product Bundle", {"new_item_code": x.get("new_item_code")}): - cls.product_bundle.append(frappe.get_doc(x).insert()) - else: - cls.product_bundle.append( - frappe.get_doc( - "Product Bundle", - {"new_item_code": x.get("new_item_code")}, - ) - ) + cls.make_records(["new_item_code"], records, "product_bundle") @classmethod def make_test_account(cls): @@ -2562,12 +2333,7 @@ class ERPNextTestSuite(unittest.TestCase): "territory": "_Test Territory", }, ] - cls.customer = [] - for x in records: - if not frappe.db.exists("Customer", {"customer_name": x.get("customer_name")}): - cls.customer.append(frappe.get_doc(x).insert()) - else: - cls.customer.append(frappe.get_doc("Customer", {"customer_name": x.get("customer_name")})) + cls.make_records(["customer_name"], records, "customer") @classmethod def make_shareholder(cls): @@ -2581,14 +2347,7 @@ class ERPNextTestSuite(unittest.TestCase): {"doctype": "Shareholder", "naming_series": "SH-", "title": "Thor", "company": "_Test Company"}, {"doctype": "Shareholder", "naming_series": "SH-", "title": "Hulk", "company": "_Test Company"}, ] - cls.shareholder = [] - for x in records: - if not frappe.db.exists("Shareholder", {"title": x.get("title"), "company": x.get("company")}): - cls.shareholder.append(frappe.get_doc(x).insert()) - else: - cls.shareholder.append( - frappe.get_doc("Shareholder", {"title": x.get("title"), "company": x.get("company")}) - ) + cls.make_records(["title", "company"], records, "shareholder") @classmethod def make_sales_taxes_template(cls): @@ -2805,19 +2564,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.sales_taxes_and_template = [] - for x in records: - if not frappe.db.exists( - "Sales Taxes and Charges Template", {"title": x.get("title"), "company": x.get("company")} - ): - cls.sales_taxes_and_template.append(frappe.get_doc(x).insert()) - else: - cls.sales_taxes_and_template.append( - frappe.get_doc( - "Sales Taxes and Charges Template", - {"title": x.get("title"), "company": x.get("company")}, - ) - ) + cls.make_records(["title", "company"], records, "sales_taxes_and_template") @classmethod def make_asset_category(cls): @@ -2859,17 +2606,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.asset_category = [] - for x in records: - if not frappe.db.exists("Asset Category", {"asset_category_name": x.get("asset_category_name")}): - cls.asset_category.append(frappe.get_doc(x).insert()) - else: - cls.asset_category.append( - frappe.get_doc( - "Asset Category", - {"asset_category_name": x.get("asset_category_name")}, - ) - ) + cls.make_records(["asset_category_name"], records, "asset_category") @classmethod def make_asset_maintenance_team(cls): @@ -2898,19 +2635,7 @@ class ERPNextTestSuite(unittest.TestCase): ], } ] - cls.asset_maintenance_team = [] - for x in records: - if not frappe.db.exists( - "Asset Maintenance Team", {"maintenance_team_name": x.get("maintenance_team_name")} - ): - cls.asset_maintenance_team.append(frappe.get_doc(x).insert()) - else: - cls.asset_maintenance_team.append( - frappe.get_doc( - "Asset Maintenance Team", - {"maintenance_team_name": x.get("maintenance_team_name")}, - ) - ) + cls.make_records(["maintenance_team_name"], records, "asset_maintenance_team") @classmethod def make_activity_type(cls): @@ -2926,14 +2651,7 @@ class ERPNextTestSuite(unittest.TestCase): "activity_type": "_Test Activity Type 1", }, ] - cls.activity_type = [] - for x in records: - if not frappe.db.exists("Activity Type", {"activity_type": x.get("activity_type")}): - cls.activity_type.append(frappe.get_doc(x).insert()) - else: - cls.activity_type.append( - frappe.get_doc("Activity Type", {"activity_type": x.get("activity_type")}) - ) + cls.make_records(["activity_type"], records, "activity_type") @classmethod def make_loyalty_program(cls): @@ -2969,16 +2687,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.loyalty_program = [] - for x in records: - if not frappe.db.exists( - "Loyalty Program", {"loyalty_program_name": x.get("loyalty_program_name")} - ): - cls.loyalty_program.append(frappe.get_doc(x).insert()) - else: - cls.loyalty_program.append( - frappe.get_doc("Loyalty Program", {"loyalty_program_name": x.get("loyalty_program_name")}) - ) + cls.make_records(["loyalty_program_name"], records, "loyalty_program") @classmethod def make_item_price(cls): @@ -3050,40 +2759,14 @@ class ERPNextTestSuite(unittest.TestCase): "price_list_rate": 10000, }, ] - cls.item_price = [] - for x in records: - if not frappe.db.exists( - "Item Price", - { - "item_code": x.get("item_code"), - "price_list": x.get("price_list"), - "price_list_rate": x.get("price_list_rate"), - }, - ): - cls.item_price.append(frappe.get_doc(x).insert()) - else: - cls.item_price.append( - frappe.get_doc( - "Item Price", - { - "item_code": x.get("item_code"), - "price_list": x.get("price_list"), - "price_list_rate": x.get("price_list_rate"), - }, - ) - ) + cls.make_records(["item_code", "price_list", "price_list_rate"], records, "item_price") @classmethod def make_operation(cls): records = [ {"doctype": "Operation", "name": "_Test Operation 1", "workstation": "_Test Workstation 1"} ] - cls.operation = [] - for x in records: - if not frappe.db.exists("Operation", {"name": x.get("name")}): - cls.operation.append(frappe.get_doc(x).insert()) - else: - cls.operation.append(frappe.get_doc("Operation", {"name": x.get("name")})) + cls.make_records(["name"], records, "operation") @classmethod def make_workstation(cls): @@ -3101,39 +2784,19 @@ class ERPNextTestSuite(unittest.TestCase): "working_hours": [{"start_time": "10:00:00", "end_time": "20:00:00"}], } ] - cls.workstation = [] - for x in records: - if not frappe.db.exists("Workstation", {"workstation_name": x.get("workstation_name")}): - cls.workstation.append(frappe.get_doc(x).insert()) - else: - cls.workstation.append( - frappe.get_doc("Workstation", {"workstation_name": x.get("workstation_name")}) - ) + cls.make_records(["workstation_name"], records, "workstation") @classmethod def make_bom(cls): # TODO: replace JSON source with hardcoded data in py cls.load_test_records("BOM") records = cls.globalTestRecords["BOM"] - cls.bom = [] - for x in records: - x["company"] = cls.companies[0].name - if not frappe.db.exists("BOM", {"item": x.get("item"), "company": x.get("company")}): - cls.bom.append(frappe.get_doc(x).insert()) - else: - cls.bom.append(frappe.get_doc("BOM", {"item": x.get("item"), "company": x.get("company")})) + cls.make_records(["item", "company"], records, "bom") @classmethod def make_quality_inspection_param(cls): records = [{"doctype": "Quality Inspection Parameter", "parameter": "_Test Param"}] - cls.quality_inspection_param = [] - for x in records: - if not frappe.db.exists("Quality Inspection Parameter", {"parameter": x.get("parameter")}): - cls.quality_inspection_param.append(frappe.get_doc(x).insert()) - else: - cls.quality_inspection_param.append( - frappe.get_doc("Quality Inspection Parameter", {"parameter": x.get("parameter")}) - ) + cls.make_records(["parameter"], records, "quality_inspection_param") @classmethod def make_quality_inspection_template(cls): @@ -3150,20 +2813,7 @@ class ERPNextTestSuite(unittest.TestCase): ], } ] - cls.quality_inspection_template = [] - for x in records: - if not frappe.db.exists( - "Quality Inspection Template", - {"quality_inspection_template_name": x.get("quality_inspection_template_name")}, - ): - cls.quality_inspection_template.append(frappe.get_doc(x).insert()) - else: - cls.quality_inspection_template.append( - frappe.get_doc( - "Quality Inspection Template", - {"quality_inspection_template_name": x.get("quality_inspection_template_name")}, - ) - ) + cls.make_records(["quality_inspection_template_name"], records, "quality_inspection_template") @classmethod def make_brand(cls): @@ -3183,12 +2833,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.brand = [] - for x in records: - if not frappe.db.exists("Brand", {"brand": x.get("brand")}): - cls.brand.append(frappe.get_doc(x).insert()) - else: - cls.brand.append(frappe.get_doc("Brand", {"Brand": x.get("brand")})) + cls.make_records(["brand"], records, "brand") @classmethod def make_dunning_type(cls): @@ -3228,14 +2873,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.dunning_type = [] - for x in records: - if not frappe.db.exists("Dunning Type", {"dunning_type": x.get("dunning_type")}): - cls.dunning_type.append(frappe.get_doc(x).insert()) - else: - cls.dunning_type.append( - frappe.get_doc("Dunning Type", {"dunning_type": x.get("dunning_type")}) - ) + cls.make_records(["dunning_type"], records, "dunning_type") @classmethod def make_finance_book(cls): @@ -3253,14 +2891,7 @@ class ERPNextTestSuite(unittest.TestCase): "finance_book_name": "Test Finance Book 3", }, ] - cls.finance_book = [] - for x in records: - if not frappe.db.exists("Finance Book", {"finance_book_name": x.get("finance_book_name")}): - cls.finance_book.append(frappe.get_doc(x).insert()) - else: - cls.finance_book.append( - frappe.get_doc("Finance Book", {"finance_book_name": x.get("finance_book_name")}) - ) + cls.make_records(["finance_book_name"], records, "finance_book") @classmethod def make_custom_doctype(cls): @@ -3429,24 +3060,7 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.address = [] - for x in records: - if not frappe.db.exists( - "Address", - { - "address_title": x.get("address_title"), - }, - ): - cls.address.append(frappe.get_doc(x).insert()) - else: - cls.address.append( - frappe.get_doc( - "Address", - { - "address_title": x.get("address_title"), - }, - ) - ) + cls.make_records(["address_title", "address_type"], records, "address") @contextmanager def set_user(self, user: str): From fe8064c3e6f06e6de47db91a096fc154d74c44f3 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 17 Feb 2026 16:03:25 +0530 Subject: [PATCH 178/217] refactor(test): tax rule; removed setUpClass, tearDownClass --- .../bank_clearance/test_bank_clearance.py | 5 +---- .../test_financial_report_template.py | 6 ++--- .../test_opening_invoice_creation_tool.py | 4 +--- .../doctype/pos_invoice/test_pos_invoice.py | 6 +---- .../test_process_statement_of_accounts.py | 15 ++----------- .../test_repost_accounting_ledger.py | 6 +---- .../sales_invoice/test_sales_invoice.py | 22 ++++++------------- .../doctype/tax_rule/test_tax_rule.py | 11 +--------- .../test_tax_withholding_category.py | 4 +--- erpnext/assets/doctype/asset/test_asset.py | 11 +--------- .../test_asset_shift_allocation.py | 4 +--- .../test_supplier_quotation.py | 6 ++--- .../doctype/appointment/test_appointment.py | 6 +---- .../doctype/opportunity/test_opportunity.py | 8 +++---- ...test_opportunity_summary_by_sales_stage.py | 4 +--- erpnext/manufacturing/doctype/bom/test_bom.py | 6 ++--- .../bom_update_log/test_bom_update_log.py | 6 +---- .../bom_update_tool/test_bom_update_tool.py | 6 ++--- .../doctype/job_card/test_job_card.py | 6 +---- .../doctype/routing/test_routing.py | 10 ++------- .../activity_cost/test_activity_cost.py | 8 +++---- .../doctype/quotation/test_quotation.py | 6 ++--- .../doctype/sales_order/test_sales_order.py | 15 ------------- .../delivery_note/test_delivery_note.py | 6 ++--- .../doctype/item_price/test_item_price.py | 6 ++--- .../test_landed_cost_voucher.py | 6 ++--- .../material_request/test_material_request.py | 6 ++--- .../purchase_receipt/test_purchase_receipt.py | 6 +---- .../stock/doctype/serial_no/test_serial_no.py | 6 ++--- .../test_stock_reconciliation.py | 4 ---- erpnext/stock/tests/test_valuation.py | 6 ++--- .../issue_analytics/test_issue_analytics.py | 13 +++++------ 32 files changed, 57 insertions(+), 183 deletions(-) diff --git a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py index 61f7466679f..825db9d7713 100644 --- a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py +++ b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py @@ -18,9 +18,7 @@ from erpnext.tests.utils import ERPNextTestSuite, if_lending_app_installed, if_l class TestBankClearance(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): create_warehouse( warehouse_name="_Test Warehouse", properties={"parent_warehouse": "All Warehouses - _TC"}, @@ -29,7 +27,6 @@ class TestBankClearance(ERPNextTestSuite): create_item("_Test Item") create_cost_center(cost_center_name="_Test Cost Center", company="_Test Company") - def setUp(self): make_bank_account() add_transactions() diff --git a/erpnext/accounts/doctype/financial_report_template/test_financial_report_template.py b/erpnext/accounts/doctype/financial_report_template/test_financial_report_template.py index 2f3bbb36837..9372c503d12 100644 --- a/erpnext/accounts/doctype/financial_report_template/test_financial_report_template.py +++ b/erpnext/accounts/doctype/financial_report_template/test_financial_report_template.py @@ -9,11 +9,9 @@ from erpnext.tests.utils import ERPNextTestSuite class FinancialReportTemplateTestCase(ERPNextTestSuite): """Utility class with common setup and helper methods for all test classes""" - @classmethod - def setUpClass(cls): + def setUp(self): """Set up test data""" - super().setUpClass() - cls.create_test_template() + self.create_test_template() @classmethod def create_test_template(cls): diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py index ffcebcf9d1b..3d57c781983 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py @@ -14,9 +14,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestOpeningInvoiceCreationTool(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): if not frappe.db.exists("Company", "_Test Opening Invoice Company"): make_company() create_dimension() diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index c31c78b8b85..8cf4d0cb90f 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -25,14 +25,10 @@ from erpnext.tests.utils import ERPNextTestSuite class POSInvoiceTestMixin(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Stock Entry") - def setUp(self): from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile + self.load_test_records("Stock Entry") self.test_user, self.pos_profile = init_user_and_profile() if frappe.session.user != "Administrator": diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py index 31d2aa4401f..c16933c7836 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py +++ b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py @@ -15,23 +15,12 @@ from erpnext.tests.utils import ERPNextTestSuite class TestProcessStatementOfAccounts(AccountsTestMixin, ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): + frappe.db.set_single_value("Selling Settings", "validate_selling_price", 0) letterhead = frappe.get_doc("Letter Head", "Company Letterhead - Grey") letterhead.is_default = 0 letterhead.save() - cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) - @classmethod - def tearDownClass(cls): - super().tearDownClass() - letterhead = frappe.get_doc("Letter Head", "Company Letterhead - Grey") - letterhead.is_default = 1 - letterhead.save() - frappe.db.commit() # nosemgrep - - def setUp(self): self.create_company() self.create_customer() self.create_customer(customer_name="Other Customer") diff --git a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py index 274df9fc862..b60c13fc8b8 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py @@ -17,15 +17,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestRepostAccountingLedger(AccountsTestMixin, ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) - def setUp(self): self.create_company() self.create_customer() self.create_item() + frappe.db.set_single_value("Selling Settings", "validate_selling_price", 0) update_repost_settings() def test_01_basic_functions(self): diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index eb160d99287..909288734ec 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -52,6 +52,13 @@ from erpnext.tests.utils import ERPNextTestSuite class TestSalesInvoice(ERPNextTestSuite): def setUp(self): + self.make_employees() + self.make_sales_person() + self.load_test_records("Journal Entry") + self.load_test_records("Stock Entry") + self.load_test_records("Sales Invoice") + unlink_payment_on_cancel_of_invoice() + from erpnext.stock.doctype.stock_ledger_entry.test_stock_ledger_entry import create_items create_items(["_Test Internal Transfer Item"], uoms=[{"uom": "Box", "conversion_factor": 10}]) @@ -93,21 +100,6 @@ class TestSalesInvoice(ERPNextTestSuite): w.submit() return w - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) - cls.make_employees() - cls.make_sales_person() - cls.load_test_records("Journal Entry") - cls.load_test_records("Stock Entry") - cls.load_test_records("Sales Invoice") - unlink_payment_on_cancel_of_invoice() - - @classmethod - def tearDownClass(self): - unlink_payment_on_cancel_of_invoice(0) - def test_sales_invoice_qty(self): si = create_sales_invoice(qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py index f0bc9696b66..ed3d004cc7e 100644 --- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py @@ -11,17 +11,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestTaxRule(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - frappe.db.set_single_value("Shopping Cart Settings", "enabled", 0) - - @classmethod - def tearDownClass(cls): - frappe.db.sql("delete from `tabTax Rule`") - def setUp(self): - frappe.db.sql("delete from `tabTax Rule`") + frappe.db.set_single_value("Shopping Cart Settings", "enabled", 0) def test_conflict(self): tax_rule1 = make_tax_rule( diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index 3d8307805ef..66dc090f7c7 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -14,9 +14,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestTaxWithholdingCategory(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): # create relevant supplier, etc create_records() create_tax_withholding_category_records() diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 95f6fdfbd54..852a28f9948 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -818,18 +818,9 @@ class TestAsset(AssetSetup): class TestDepreciationMethods(AssetSetup): - @classmethod - def setUpClass(cls): - super().setUpClass() - - cls._old_float_precision = frappe.db.get_single_value("System Settings", "float_precision") + def setUp(self): frappe.db.set_single_value("System Settings", "float_precision", 2) - @classmethod - def tearDownClass(cls): - frappe.db.set_single_value("System Settings", "float_precision", cls._old_float_precision) - super().tearDownClass() - def test_schedule_for_straight_line_method(self): asset = create_asset( calculate_depreciation=1, diff --git a/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py b/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py index 8fba5602602..5b1cdaf0277 100644 --- a/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py +++ b/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py @@ -12,9 +12,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestAssetShiftAllocation(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): create_asset_shift_factors() def test_asset_shift_allocation(self): diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py index d6ff71322e7..c271d34b35d 100644 --- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py @@ -14,10 +14,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPurchaseOrder(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Supplier Quotation") + def setUp(self): + self.load_test_records("Supplier Quotation") def test_update_child_supplier_quotation_add_item(self): sq = frappe.copy_doc(self.globalTestRecords["Supplier Quotation"][0]) diff --git a/erpnext/crm/doctype/appointment/test_appointment.py b/erpnext/crm/doctype/appointment/test_appointment.py index 5ef79bfa4a7..24974ecf472 100644 --- a/erpnext/crm/doctype/appointment/test_appointment.py +++ b/erpnext/crm/doctype/appointment/test_appointment.py @@ -28,12 +28,8 @@ def create_test_appointment(): class TestAppointment(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - frappe.db.delete("Lead", {"email_id": LEAD_EMAIL}) - def setUp(self): + frappe.db.delete("Lead", {"email_id": LEAD_EMAIL}) self.test_appointment = create_test_appointment() self.test_appointment.set_verified(self.test_appointment.customer_email) diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index 99bb18a85d8..0b194e81f49 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -14,13 +14,11 @@ from erpnext.tests.utils import ERPNextTestSuite class TestOpportunity(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): # Only first lead is required # TODO: dynamically generate limited test records - cls.make_leads() - cls.make_opportunities() + self.make_leads() + self.make_opportunities() @classmethod def make_opportunities(cls): diff --git a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py index f136294339f..4d5ba1dc9a2 100644 --- a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py +++ b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py @@ -8,9 +8,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestOpportunitySummaryBySalesStage(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): create_opportunity() def test_opportunity_summary_by_sales_stage(self): diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index 4c5c6d85a52..146a902d323 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -24,10 +24,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestBOM(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("BOM") + def setUp(self): + self.load_test_records("BOM") @timeout def test_get_items(self): diff --git a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py index d44a9284f0f..ea2f8df8cc6 100644 --- a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py +++ b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py @@ -17,12 +17,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestBOMUpdateLog(ERPNextTestSuite): "Test BOM Update Tool Operations via BOM Update Log." - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("BOM") - def setUp(self): + self.load_test_records("BOM") bom_doc = frappe.copy_doc(self.globalTestRecords["BOM"][0]) bom_doc.items[1].item_code = "_Test Item" bom_doc.insert() diff --git a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py index 9b433a9c1d6..c035dccd06c 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py @@ -16,10 +16,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestBOMUpdateTool(ERPNextTestSuite): "Test major functions run via BOM Update Tool." - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("BOM") + def setUp(self): + self.load_test_records("BOM") @timeout def test_replace_bom(self): diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 76a8f6cb9ae..f81b19ac6ce 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -27,12 +27,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestJobCard(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("BOM") - def setUp(self): + self.load_test_records("BOM") self.make_employees() # used in job card time log self.make_bom_for_jc_tests() self.transfer_material_against: Literal["Work Order", "Job Card"] = "Work Order" diff --git a/erpnext/manufacturing/doctype/routing/test_routing.py b/erpnext/manufacturing/doctype/routing/test_routing.py index 0c53096f6a8..4575c1d1d57 100644 --- a/erpnext/manufacturing/doctype/routing/test_routing.py +++ b/erpnext/manufacturing/doctype/routing/test_routing.py @@ -9,14 +9,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestRouting(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.item_code = "Test Routing Item - A" - - @classmethod - def tearDownClass(cls): - frappe.db.sql("delete from tabBOM where item=%s", cls.item_code) + def setUp(self): + self.item_code = "Test Routing Item - A" def test_sequence_id(self): operations = [ diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py index 19188c350fe..e13e8ac2ad1 100644 --- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py +++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py @@ -10,12 +10,10 @@ from erpnext.tests.utils import ERPNextTestSuite class TestActivityCost(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() + def setUp(self): # TODO: only 1 employee is required - cls.make_employees() - cls.make_activity_type() + self.make_employees() + self.make_activity_type() def test_duplication(self): frappe.db.sql("delete from `tabActivity Cost`") diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index 2a8d582f8fb..b841f456bc9 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -13,10 +13,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestQuotation(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Quotation") + def setUp(self): + self.load_test_records("Quotation") def test_update_child_quotation_add_item(self): from erpnext.stock.doctype.item.test_item import make_item diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index 3ff406041a7..f6f4e8bea4f 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -36,21 +36,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.unlink_setting = int( - frappe.db.get_single_value("Accounts Settings", "unlink_advance_payment_on_cancelation_of_order") - ) - - @classmethod - def tearDownClass(cls) -> None: - # reset config to previous state - frappe.db.set_single_value( - "Accounts Settings", "unlink_advance_payment_on_cancelation_of_order", cls.unlink_setting - ) - super().tearDownClass() - def setUp(self): self.create_customer("_Test Customer Credit") diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index c5aa297e35b..0d6f75984f9 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -45,10 +45,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestDeliveryNote(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Stock Entry") + def setUp(self): + self.load_test_records("Stock Entry") def test_delivery_note_qty(self): dn = create_delivery_note(qty=0, do_not_save=True) diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py index f60dcc98e0d..f2f177dd8fe 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.py +++ b/erpnext/stock/doctype/item_price/test_item_price.py @@ -11,10 +11,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestItemPrice(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Item Price") + def setUp(self): + self.load_test_records("Item Price") def test_template_item_price(self): from erpnext.stock.doctype.item.test_item import make_item diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py index 0645957a22a..0efa722695b 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py @@ -24,10 +24,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestLandedCostVoucher(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Currency Exchange") + def setUp(self): + self.load_test_records("Currency Exchange") def test_landed_cost_voucher(self): frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index 82a61fcbb8d..e72637901b5 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -24,10 +24,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestMaterialRequest(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Material Request") + def setUp(self): + self.load_test_records("Material Request") def test_material_request_qty(self): mr = frappe.copy_doc(self.globalTestRecords["Material Request"][0]) diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 9bd01c8b2fc..07473784d1e 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -29,13 +29,9 @@ from erpnext.tests.utils import ERPNextTestSuite class TestPurchaseReceipt(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Purchase Receipt") - def setUp(self): frappe.local.future_sle = {} + self.load_test_records("Purchase Receipt") def test_purchase_receipt_qty(self): pr = make_purchase_receipt(qty=0, rejected_qty=0, do_not_save=True) diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py index fecd4fb672e..a82cbe5d306 100644 --- a/erpnext/stock/doctype/serial_no/test_serial_no.py +++ b/erpnext/stock/doctype/serial_no/test_serial_no.py @@ -23,10 +23,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestSerialNo(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.load_test_records("Stock Entry") + def setUp(self): + self.load_test_records("Stock Entry") def test_cannot_create_direct(self): frappe.delete_doc_if_exists("Serial No", "_TCSER0001") diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 61d91652728..9d0bd7d9104 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -34,10 +34,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): - @classmethod - def setUpClass(cls): - super().setUpClass() - def setUp(self): frappe.db.set_single_value("Stock Settings", "allow_negative_stock", 1) frappe.local.future_sle = {} diff --git a/erpnext/stock/tests/test_valuation.py b/erpnext/stock/tests/test_valuation.py index 71f604daa5e..bfe511130c8 100644 --- a/erpnext/stock/tests/test_valuation.py +++ b/erpnext/stock/tests/test_valuation.py @@ -311,10 +311,8 @@ class TestLIFOValuationSLE(ERPNextTestSuite): ITEM_CODE = "_Test LIFO item" WAREHOUSE = "_Test Warehouse - _TC" - @classmethod - def setUpClass(cls) -> None: - super().setUpClass() - make_item(cls.ITEM_CODE, {"valuation_method": "LIFO"}) + def setUp(self) -> None: + make_item(self.ITEM_CODE, {"valuation_method": "LIFO"}) def _make_stock_entry(self, qty, rate=None): kwargs = { diff --git a/erpnext/support/report/issue_analytics/test_issue_analytics.py b/erpnext/support/report/issue_analytics/test_issue_analytics.py index 039b8ef0551..31b8e99d8d4 100644 --- a/erpnext/support/report/issue_analytics/test_issue_analytics.py +++ b/erpnext/support/report/issue_analytics/test_issue_analytics.py @@ -15,19 +15,16 @@ months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", class TestIssueAnalytics(ERPNextTestSuite): - @classmethod - def setUpClass(cls): - super().setUpClass() - frappe.db.sql("delete from `tabIssue` where company='_Test Company'") + def setUp(self): frappe.db.set_single_value("Support Settings", "track_service_level_agreement", 1) current_month_date = getdate() last_month_date = add_months(current_month_date, -1) - cls.current_month = str(months[current_month_date.month - 1]).lower() - cls.last_month = str(months[last_month_date.month - 1]).lower() + self.current_month = str(months[current_month_date.month - 1]).lower() + self.last_month = str(months[last_month_date.month - 1]).lower() if current_month_date.year != last_month_date.year: - cls.current_month += "_" + str(current_month_date.year) - cls.last_month += "_" + str(last_month_date.year) + self.current_month += "_" + str(current_month_date.year) + self.last_month += "_" + str(last_month_date.year) def test_issue_analytics(self): create_service_level_agreements_for_issues() From 71ce7ff8ce3071d0f8073d2dc084742dda7ebcf1 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 17 Feb 2026 17:59:22 +0530 Subject: [PATCH 179/217] refactor(test): make customer deterministic --- erpnext/selling/doctype/customer/test_customer.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 73eb4fc254b..211343966f9 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -89,14 +89,11 @@ class TestCustomer(ERPNextTestSuite): def test_party_details_tax_category(self): from erpnext.accounts.party import get_party_details - frappe.delete_doc_if_exists("Address", "_Test Address With Tax Category-Billing") - frappe.delete_doc_if_exists("Address", "_Test Address With Tax Category-Shipping") - # Tax Category without Address details = get_party_details("_Test Customer With Tax Category") self.assertEqual(details.tax_category, "_Test Tax Category 1") - billing_address = frappe.get_doc( + frappe.get_doc( doctype="Address", address_title="_Test Address With Tax Category", tax_category="_Test Tax Category 2", @@ -104,9 +101,10 @@ class TestCustomer(ERPNextTestSuite): address_line1="Station Road", city="_Test City", country="India", + is_primary_address=True, links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")], ).insert() - shipping_address = frappe.get_doc( + frappe.get_doc( doctype="Address", address_title="_Test Address With Tax Category", tax_category="_Test Tax Category 3", @@ -114,6 +112,7 @@ class TestCustomer(ERPNextTestSuite): address_line1="Station Road", city="_Test City", country="India", + is_shipping_address=True, links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")], ).insert() @@ -135,8 +134,6 @@ class TestCustomer(ERPNextTestSuite): # Rollback settings.determine_address_tax_category_from = rollback_setting settings.save() - billing_address.delete() - shipping_address.delete() def test_rename(self): # delete communication linked to these 2 customers From 9e11b6cfb3f2f969c2996239f5af9bd55fe838f3 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 18 Feb 2026 16:36:35 +0530 Subject: [PATCH 180/217] refactor(test): make bom deterministic --- erpnext/manufacturing/doctype/bom/test_bom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index 146a902d323..d86b2da4f34 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -654,7 +654,7 @@ class TestBOM(ERPNextTestSuite): from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom - bom = make_bom(item=fg_item, raw_materials=[rm_item], do_not_save=True) + bom = make_bom(item=fg_item, raw_materials=[rm_item], currency="INR", do_not_save=True) bom.rm_cost_as_per = "Last Purchase Rate" bom.save() From aec5ba18645aaca2a5d4c27eb8d3f77124690ffb Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 28 Feb 2026 12:01:09 +0530 Subject: [PATCH 181/217] refactor(test): make process deferred accounting deterministic --- erpnext/accounts/deferred_revenue.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py index c3e23fe6e50..3c841aef05f 100644 --- a/erpnext/accounts/deferred_revenue.py +++ b/erpnext/accounts/deferred_revenue.py @@ -524,7 +524,8 @@ def make_gl_entries( if gl_entries: try: make_gl_entries(gl_entries, cancel=(doc.docstatus == 2), merge_entries=True) - frappe.db.commit() + if not frappe.in_test: + frappe.db.commit() except Exception as e: if frappe.in_test: doc.log_error(f"Error while processing deferred accounting for Invoice {doc.name}") @@ -606,7 +607,8 @@ def book_revenue_via_journal_entry( if submit: journal_entry.submit() - frappe.db.commit() + if not frappe.in_test: + frappe.db.commit() except Exception: frappe.db.rollback() doc.log_error(f"Error while processing deferred accounting for Invoice {doc.name}") From e451b6861946cbce01e2f0b1fe2f1f5fe45f2cc8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 28 Feb 2026 12:03:36 +0530 Subject: [PATCH 182/217] refactor(test): remove redundant before_tests --- erpnext/hooks.py | 2 -- erpnext/setup/utils.py | 33 --------------------------------- 2 files changed, 35 deletions(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 0277783cc74..c997443b41d 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -319,8 +319,6 @@ has_website_permission = { "Project": "erpnext.controllers.website_list_for_contact.has_website_permission", } -before_tests = "erpnext.setup.utils.before_tests" - period_closing_doctypes = [ "Sales Invoice", diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py index 4a4ae55e85c..03938ebb94e 100644 --- a/erpnext/setup/utils.py +++ b/erpnext/setup/utils.py @@ -10,39 +10,6 @@ from frappe.utils.nestedset import get_root_of from erpnext import get_default_company -def before_tests(): - frappe.clear_cache() - # complete setup if missing - from frappe.desk.page.setup_wizard.setup_wizard import setup_complete - - if not frappe.db.a_row_exists("Company"): - current_year = now_datetime().year - setup_complete( - { - "currency": "USD", - "full_name": "Test User", - "company_name": "Wind Power LLC", - "timezone": "America/New_York", - "company_abbr": "WP", - "industry": "Manufacturing", - "country": "United States", - "fy_start_date": f"{current_year}-01-01", - "fy_end_date": f"{current_year}-12-31", - "language": "english", - "company_tagline": "Testing", - "email": "test@erpnext.com", - "password": "test", - "chart_of_accounts": "Standard", - } - ) - - _enable_all_roles_for_admin() - - set_defaults_for_tests() - - frappe.db.commit() - - def get_pegged_currencies(): pegged_currencies = frappe.get_all( "Pegged Currency Details", From 5f56f61f869c488a6971cd1e259d64adeb688d40 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 28 Feb 2026 16:20:49 +0530 Subject: [PATCH 183/217] refactor(test): make stock entry deterministic --- erpnext/stock/doctype/stock_entry/test_stock_entry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 4d39552a793..7a08fce7053 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -59,6 +59,7 @@ def get_sle(**args): class TestStockEntry(ERPNextTestSuite): def setUp(self): self.load_test_records("Stock Entry") + frappe.local.flags.dont_execute_stock_reposts = False def test_stock_entry_qty(self): item_code = "_Test Item 2" From 5934670e9925558f096811192c651d04d2000d72 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 26 Feb 2026 17:14:56 +0530 Subject: [PATCH 184/217] refactor(test): speed up setup --- erpnext/tests/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 3b3bbd278c0..fe3c6b961a5 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -136,8 +136,13 @@ class ERPNextTestSuite(unittest.TestCase): if not hasattr(cls, "globalTestRecords"): cls.globalTestRecords = {} - cls.make_presets() - cls.make_persistent_master_data() + if not hasattr(cls, "bootstrap_testsite"): + cls.bootstrap_testsite = False + + if not cls.bootstrap_testsite: + cls.make_presets() + cls.make_persistent_master_data() + cls.bootstrap_testsite = True def tearDown(self): frappe.db.rollback() From 41de44f905f7d7a1b7dc8584eb504b0bce4aa904 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sun, 1 Mar 2026 21:23:57 +0530 Subject: [PATCH 185/217] refactor: move test bootstrap to module --- erpnext/tests/utils.py | 466 +++++++++++++++++------------------------ 1 file changed, 197 insertions(+), 269 deletions(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index fe3c6b961a5..b03171c662a 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -121,40 +121,12 @@ def if_lending_app_not_installed(function): return wrapper -class ERPNextTestSuite(unittest.TestCase): - @classmethod - def registerAs(cls, _as): - def decorator(cm_func): - setattr(cls, cm_func.__name__, _as(cm_func)) - return cm_func +class BootStrapTestData: + def __init__(self): + self.make_presets() + self.make_master_data() - return decorator - - @classmethod - def setUpClass(cls): - # initilize global test records attribute - if not hasattr(cls, "globalTestRecords"): - cls.globalTestRecords = {} - - if not hasattr(cls, "bootstrap_testsite"): - cls.bootstrap_testsite = False - - if not cls.bootstrap_testsite: - cls.make_presets() - cls.make_persistent_master_data() - cls.bootstrap_testsite = True - - def tearDown(self): - frappe.db.rollback() - - @classmethod - def load_test_records(cls, doctype): - if doctype not in cls.globalTestRecords: - records = load_test_records_for(doctype) - cls.globalTestRecords[doctype] = records[doctype] - - @classmethod - def make_presets(cls): + def make_presets(self): from frappe.desk.page.setup_wizard.install_fixtures import update_genders, update_salutations from erpnext.setup.setup_wizard.operations.install_fixtures import ( @@ -220,67 +192,65 @@ class ERPNextTestSuite(unittest.TestCase): frappe.db.commit() - @classmethod - def make_persistent_master_data(cls): - cls.make_fiscal_year() - cls.make_holiday_list() - cls.make_company() - cls.make_test_account() - cls.make_supplier_group() - cls.make_payment_term() - cls.make_payment_terms_template() - cls.make_tax_category() - cls.make_account() - cls.make_supplier() - cls.make_role() - cls.make_department() - cls.make_territory() - cls.make_customer_group() - cls.make_customer() - cls.make_user() - cls.make_cost_center() - cls.make_warehouse() - cls.make_uom() - cls.make_item_tax_template() - cls.make_item_group() - cls.make_item_attribute() - cls.make_asset_maintenance_team() - cls.make_asset_category() - cls._make_item() - cls.make_product_bundle() - cls.make_location() - cls.make_price_list() - cls.make_item_price() - cls.make_loyalty_program() - cls.make_shareholder() - cls.make_sales_taxes_template() - cls.make_workstation() - cls.make_operation() - cls.make_bom() - cls.make_quality_inspection_param() - cls.make_quality_inspection_template() - cls.make_employees() - cls.make_brand() - cls.make_monthly_distribution() - cls.make_projects() - cls.make_dunning_type() - cls.make_finance_book() - cls.make_leads() - cls.make_sales_person() - cls.make_activity_type() - cls.make_address() - cls.update_selling_settings() - cls.update_stock_settings() - cls.update_system_settings() + def make_master_data(self): + self.make_fiscal_year() + self.make_holiday_list() + self.make_company() + self.make_test_account() + self.make_supplier_group() + self.make_payment_term() + self.make_payment_terms_template() + self.make_tax_category() + self.make_account() + self.make_supplier() + self.make_role() + self.make_department() + self.make_territory() + self.make_customer_group() + self.make_customer() + self.make_user() + self.make_cost_center() + self.make_warehouse() + self.make_uom() + self.make_item_tax_template() + self.make_item_group() + self.make_item_attribute() + self.make_asset_maintenance_team() + self.make_asset_category() + self.make_item() + self.make_product_bundle() + self.make_location() + self.make_price_list() + self.make_item_price() + self.make_loyalty_program() + self.make_shareholder() + self.make_sales_taxes_template() + self.make_workstation() + self.make_operation() + self.make_bom() + self.make_quality_inspection_param() + self.make_quality_inspection_template() + self.make_employees() + self.make_brand() + self.make_monthly_distribution() + self.make_projects() + self.make_dunning_type() + self.make_finance_book() + self.make_leads() + self.make_sales_person() + self.make_activity_type() + self.make_address() + self.update_selling_settings() + self.update_stock_settings() + self.update_system_settings() frappe.db.commit() # custom doctype # DDL commands have implicit commit - cls.make_custom_doctype() + self.make_custom_doctype() - @classmethod - def update_system_settings(cls): + def update_system_settings(self): system_settings = frappe.get_doc("System Settings") system_settings.time_zone = "Asia/Kolkata" system_settings.language = "en" @@ -288,14 +258,12 @@ class ERPNextTestSuite(unittest.TestCase): system_settings.rounding_method = "Banker's Rounding" system_settings.save() - @classmethod - def update_selling_settings(cls): + def update_selling_settings(self): selling_settings = frappe.get_doc("Selling Settings") selling_settings.selling_price_list = "Standard Selling" selling_settings.save() - @classmethod - def update_stock_settings(cls): + def update_stock_settings(self): stock_settings = frappe.get_doc("Stock Settings") stock_settings.item_naming_by = "Item Code" stock_settings.valuation_method = "FIFO" @@ -308,10 +276,8 @@ class ERPNextTestSuite(unittest.TestCase): stock_settings.enable_serial_and_batch_no_for_item = 1 stock_settings.save() - @classmethod - def make_records(cls, key, records, attr): + def make_records(self, key, records, attr): doctype = records[0].get("doctype") - data = [] def get_filters(record): filters = {} @@ -322,15 +288,9 @@ class ERPNextTestSuite(unittest.TestCase): for x in records: filters = get_filters(x) if not frappe.db.exists(doctype, filters): - data.append(frappe.get_doc(x).insert()) - else: - data.append(frappe.get_doc(doctype, filters)) + frappe.get_doc(x).insert() - if not hasattr(cls, attr): - setattr(cls, attr, data) - - @classmethod - def make_price_list(cls): + def make_price_list(self): records = [ { "doctype": "Price List", @@ -398,12 +358,11 @@ class ERPNextTestSuite(unittest.TestCase): "selling": 0, }, ] - cls.make_records( + self.make_records( ["price_list_name", "enabled", "selling", "buying", "currency"], records, "price_list" ) - @classmethod - def make_monthly_distribution(cls): + def make_monthly_distribution(self): records = [ { "doctype": "Monthly Distribution", @@ -425,10 +384,9 @@ class ERPNextTestSuite(unittest.TestCase): ], } ] - cls.make_records(["distribution_id"], records, "monthly_distribution") + self.make_records(["distribution_id"], records, "monthly_distribution") - @classmethod - def make_projects(cls): + def make_projects(self): records = [ { "doctype": "Project", @@ -437,10 +395,9 @@ class ERPNextTestSuite(unittest.TestCase): "status": "Open", } ] - cls.make_records(["project_name"], records, "projects") + self.make_records(["project_name"], records, "projects") - @classmethod - def make_customer_group(cls): + def make_customer_group(self): records = [ { "customer_group_name": "_Test Customer Group", @@ -455,10 +412,9 @@ class ERPNextTestSuite(unittest.TestCase): "parent_customer_group": "All Customer Groups", }, ] - cls.make_records(["customer_group_name"], records, "customer_group") + self.make_records(["customer_group_name"], records, "customer_group") - @classmethod - def make_territory(cls): + def make_territory(self): records = [ { "doctype": "Territory", @@ -491,10 +447,9 @@ class ERPNextTestSuite(unittest.TestCase): "territory_name": "_Test Territory United States", }, ] - cls.make_records(["territory_name"], records, "territories") + self.make_records(["territory_name"], records, "territories") - @classmethod - def make_department(cls): + def make_department(self): records = [ { "doctype": "Department", @@ -509,10 +464,9 @@ class ERPNextTestSuite(unittest.TestCase): "parent_department": "All Departments", }, ] - cls.make_records(["department_name"], records, "department") + self.make_records(["department_name"], records, "department") - @classmethod - def make_role(cls): + def make_role(self): records = [ {"doctype": "Role", "role_name": "_Test Role", "desk_access": 1}, {"doctype": "Role", "role_name": "_Test Role 2", "desk_access": 1}, @@ -520,10 +474,9 @@ class ERPNextTestSuite(unittest.TestCase): {"doctype": "Role", "role_name": "_Test Role 4", "desk_access": 0}, {"doctype": "Role", "role_name": "Technician"}, ] - cls.make_records(["role_name"], records, "roles") + self.make_records(["role_name"], records, "roles") - @classmethod - def make_user(cls): + def make_user(self): records = [ { "doctype": "User", @@ -618,10 +571,9 @@ class ERPNextTestSuite(unittest.TestCase): "roles": [{"doctype": "Has Role", "role": "Technician"}], }, ] - cls.make_records(["email"], records, "users") + self.make_records(["email"], records, "users") - @classmethod - def make_employees(cls): + def make_employees(self): records = [ { "company": "_Test Company", @@ -660,10 +612,9 @@ class ERPNextTestSuite(unittest.TestCase): "user_id": "test2@example.com", }, ] - cls.make_records(["first_name"], records, "employees") + self.make_records(["first_name"], records, "employees") - @classmethod - def make_sales_person(cls): + def make_sales_person(self): records = [ { "doctype": "Sales Person", @@ -687,10 +638,9 @@ class ERPNextTestSuite(unittest.TestCase): "sales_person_name": "_Test Sales Person 2", }, ] - cls.make_records(["sales_person_name"], records, "sales_person") + self.make_records(["sales_person_name"], records, "sales_person") - @classmethod - def make_leads(cls): + def make_leads(self): records = [ { "doctype": "Lead", @@ -730,10 +680,9 @@ class ERPNextTestSuite(unittest.TestCase): "naming_series": "_T-Lead-", }, ] - cls.make_records(["email_id"], records, "leads") + self.make_records(["email_id"], records, "leads") - @classmethod - def make_holiday_list(cls): + def make_holiday_list(self): records = [ { "doctype": "Holiday List", @@ -747,10 +696,9 @@ class ERPNextTestSuite(unittest.TestCase): "holiday_list_name": "_Test Holiday List", } ] - cls.make_records(["holiday_list_name"], records, "holiday_list") + self.make_records(["holiday_list_name"], records, "holiday_list") - @classmethod - def make_company(cls): + def make_company(self): records = [ { "abbr": "_TC", @@ -760,7 +708,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, "allow_account_creation_against_child_company": 1, }, @@ -772,7 +720,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Retail", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, }, { @@ -783,7 +731,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Retail", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, }, { @@ -795,7 +743,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, }, { @@ -808,7 +756,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, }, { @@ -820,7 +768,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, }, { @@ -832,7 +780,7 @@ class ERPNextTestSuite(unittest.TestCase): "domain": "Manufacturing", "chart_of_accounts": "Standard", "enable_perpetual_inventory": 1, - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", }, { "abbr": "_TC6", @@ -843,7 +791,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, }, { @@ -856,7 +804,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, }, { @@ -882,7 +830,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, "is_group": 1, }, @@ -894,7 +842,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, "parent_company": "Parent Group Company India", }, @@ -906,7 +854,7 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Company", "domain": "Manufacturing", "chart_of_accounts": "Standard", - "default_holiday_list": cls.holiday_list[0].name, + "default_holiday_list": "_Test Holiday List", "enable_perpetual_inventory": 0, "parent_company": "Parent Group Company India", }, @@ -935,10 +883,9 @@ class ERPNextTestSuite(unittest.TestCase): "create_chart_of_accounts_based_on": "Standard Template", }, ] - cls.make_records(["company_name"], records, "companies") + self.make_records(["company_name"], records, "companies") - @classmethod - def make_fiscal_year(cls): + def make_fiscal_year(self): records = [ { "doctype": "Fiscal Year", @@ -962,10 +909,9 @@ class ERPNextTestSuite(unittest.TestCase): ) key = ["year_start_date", "year_end_date"] - cls.make_records(key, records, "fiscal_year") + self.make_records(key, records, "fiscal_year") - @classmethod - def make_payment_term(cls): + def make_payment_term(self): records = [ { "doctype": "Payment Term", @@ -1000,10 +946,9 @@ class ERPNextTestSuite(unittest.TestCase): "credit_days": 30, }, ] - cls.make_records(["payment_term_name"], records, "payment_terms") + self.make_records(["payment_term_name"], records, "payment_terms") - @classmethod - def make_payment_terms_template(cls): + def make_payment_terms_template(self): records = [ { "doctype": "Payment Terms Template", @@ -1064,19 +1009,17 @@ class ERPNextTestSuite(unittest.TestCase): "template_name": "_Test Payment Term Template 3", }, ] - cls.make_records(["template_name"], records, "payment_terms_template") + self.make_records(["template_name"], records, "payment_terms_template") - @classmethod - def make_tax_category(cls): + def make_tax_category(self): records = [ {"doctype": "Tax Category", "name": "_Test Tax Category 1", "title": "_Test Tax Category 1"}, {"doctype": "Tax Category", "name": "_Test Tax Category 2", "title": "_Test Tax Category 2"}, {"doctype": "Tax Category", "name": "_Test Tax Category 3", "title": "_Test Tax Category 3"}, ] - cls.make_records(["title"], records, "tax_category") + self.make_records(["title"], records, "tax_category") - @classmethod - def make_account(cls): + def make_account(self): records = [ { "doctype": "Account", @@ -1098,10 +1041,9 @@ class ERPNextTestSuite(unittest.TestCase): "company": "_Test Company with perpetual inventory", }, ] - cls.make_records(["account_name", "company"], records, "accounts") + self.make_records(["account_name", "company"], records, "accounts") - @classmethod - def make_supplier(cls): + def make_supplier(self): records = [ { "doctype": "Supplier", @@ -1154,14 +1096,13 @@ class ERPNextTestSuite(unittest.TestCase): "supplier_group": "_Test Supplier Group", "is_internal_supplier": 1, "territory": "_Test Territory", - "represents_company": cls.companies[6].name, - "companies": [{"company": cls.companies[6].name}], + "represents_company": "_Test Company with perpetual inventory", + "companies": [{"company": "_Test Company with perpetual inventory"}], }, ] - cls.make_records(["supplier_name"], records, "suppliers") + self.make_records(["supplier_name"], records, "suppliers") - @classmethod - def make_supplier_group(cls): + def make_supplier_group(self): records = [ { "doctype": "Supplier Group", @@ -1169,10 +1110,9 @@ class ERPNextTestSuite(unittest.TestCase): "parent_supplier_group": "All Supplier Groups", } ] - cls.make_records(["supplier_group_name"], records, "supplier_groups") + self.make_records(["supplier_group_name"], records, "supplier_groups") - @classmethod - def make_cost_center(cls): + def make_cost_center(self): records = [ { "company": "_Test Company", @@ -1196,10 +1136,9 @@ class ERPNextTestSuite(unittest.TestCase): "parent_cost_center": "_Test Company - _TC", }, ] - cls.make_records(["cost_center_name", "company"], records, "cost_center") + self.make_records(["cost_center_name", "company"], records, "cost_center") - @classmethod - def make_location(cls): + def make_location(self): records = [ {"doctype": "Location", "location_name": "Test Location"}, {"doctype": "Location", "location_name": "Test Location Area", "is_group": 1, "is_container": 1}, @@ -1240,10 +1179,9 @@ class ERPNextTestSuite(unittest.TestCase): "is_container": 1, }, ] - cls.make_records(["location_name"], records, "location") + self.make_records(["location_name"], records, "location") - @classmethod - def make_warehouse(cls): + def make_warehouse(self): records = [ { "company": "_Test Company", @@ -1320,18 +1258,16 @@ class ERPNextTestSuite(unittest.TestCase): "is_group": 0, }, ] - cls.make_records(["warehouse_name", "company"], records, "warehouse") + self.make_records(["warehouse_name", "company"], records, "warehouse") - @classmethod - def make_uom(cls): + def make_uom(self): records = [ {"doctype": "UOM", "must_be_whole_number": 1, "uom_name": "_Test UOM"}, {"doctype": "UOM", "uom_name": "_Test UOM 1"}, ] - cls.make_records(["uom_name"], records, "uom") + self.make_records(["uom_name"], records, "uom") - @classmethod - def make_item_attribute(cls): + def make_item_attribute(self): records = [ { "doctype": "Item Attribute", @@ -1357,10 +1293,9 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["attribute_name"], records, "item_attribute") + self.make_records(["attribute_name"], records, "item_attribute") - @classmethod - def make_item_tax_template(cls): + def make_item_tax_template(self): records = [ { "doctype": "Item Tax Template", @@ -1440,10 +1375,9 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["title", "company"], records, "item_tax_template") + self.make_records(["title", "company"], records, "item_tax_template") - @classmethod - def make_item_group(cls): + def make_item_group(self): records = [ { "doctype": "Item Group", @@ -1554,10 +1488,9 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["item_group_name"], records, "item_group") + self.make_records(["item_group_name"], records, "item_group") - @classmethod - def _make_item(cls): + def make_item(self): records = [ { "description": "_Test Item 1", @@ -2114,7 +2047,7 @@ class ERPNextTestSuite(unittest.TestCase): "stock_uom": "Box", "is_fixed_asset": 1, "auto_create_assets": 1, - "asset_category": cls.asset_category[0].name, + "asset_category": "Equipment", "asset_naming_series": "ABC.###", }, { @@ -2149,10 +2082,9 @@ class ERPNextTestSuite(unittest.TestCase): "company": "_Test Company", }, ] - cls.make_records(["item_code", "item_name"], records, "item") + self.make_records(["item_code", "item_name"], records, "item") - @classmethod - def make_product_bundle(cls): + def make_product_bundle(self): records = [ { "doctype": "Product Bundle", @@ -2173,10 +2105,9 @@ class ERPNextTestSuite(unittest.TestCase): ], } ] - cls.make_records(["new_item_code"], records, "product_bundle") + self.make_records(["new_item_code"], records, "product_bundle") - @classmethod - def make_test_account(cls): + def make_test_account(self): records = [ # [account_name, parent_account, is_group] ["_Test Bank", "Bank Accounts", 0, "Bank", None], @@ -2218,7 +2149,7 @@ class ERPNextTestSuite(unittest.TestCase): ["Loyalty", "Direct Expenses", 0, "Expense Account", None], ] - cls.test_accounts = [] + self.test_accounts = [] for company, abbr in [ ["_Test Company", "_TC"], ["_Test Company 1", "_TC1"], @@ -2226,7 +2157,7 @@ class ERPNextTestSuite(unittest.TestCase): ]: for account_name, parent_account, is_group, account_type, currency in records: if not frappe.db.exists("Account", {"account_name": account_name, "company": company}): - cls.test_accounts.append( + self.test_accounts.append( frappe.get_doc( { "doctype": "Account", @@ -2240,12 +2171,11 @@ class ERPNextTestSuite(unittest.TestCase): ).insert() ) else: - cls.test_accounts.append( + self.test_accounts.append( frappe.get_doc("Account", {"account_name": account_name, "company": company}) ) - @classmethod - def make_customer(cls): + def make_customer(self): records = [ { "customer_group": "_Test Customer Group", @@ -2320,8 +2250,8 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Customer", "is_internal_customer": 1, "territory": "_Test Territory", - "represents_company": cls.companies[6].name, - "companies": [{"company": cls.companies[6].name}], + "represents_company": "_Test Company with perpetual inventory", + "companies": [{"company": "_Test Company with perpetual inventory"}], }, { "customer_group": "_Test Customer Group", @@ -2338,10 +2268,9 @@ class ERPNextTestSuite(unittest.TestCase): "territory": "_Test Territory", }, ] - cls.make_records(["customer_name"], records, "customer") + self.make_records(["customer_name"], records, "customer") - @classmethod - def make_shareholder(cls): + def make_shareholder(self): records = [ { "doctype": "Shareholder", @@ -2352,10 +2281,9 @@ class ERPNextTestSuite(unittest.TestCase): {"doctype": "Shareholder", "naming_series": "SH-", "title": "Thor", "company": "_Test Company"}, {"doctype": "Shareholder", "naming_series": "SH-", "title": "Hulk", "company": "_Test Company"}, ] - cls.make_records(["title", "company"], records, "shareholder") + self.make_records(["title", "company"], records, "shareholder") - @classmethod - def make_sales_taxes_template(cls): + def make_sales_taxes_template(self): records = [ { "company": "_Test Company", @@ -2569,10 +2497,9 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["title", "company"], records, "sales_taxes_and_template") + self.make_records(["title", "company"], records, "sales_taxes_and_template") - @classmethod - def make_asset_category(cls): + def make_asset_category(self): records = [ { "doctype": "Asset Category", @@ -2611,10 +2538,9 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["asset_category_name"], records, "asset_category") + self.make_records(["asset_category_name"], records, "asset_category") - @classmethod - def make_asset_maintenance_team(cls): + def make_asset_maintenance_team(self): records = [ { "doctype": "Asset Maintenance Team", @@ -2640,10 +2566,9 @@ class ERPNextTestSuite(unittest.TestCase): ], } ] - cls.make_records(["maintenance_team_name"], records, "asset_maintenance_team") + self.make_records(["maintenance_team_name"], records, "asset_maintenance_team") - @classmethod - def make_activity_type(cls): + def make_activity_type(self): records = [ { "doctype": "Activity Type", @@ -2656,10 +2581,9 @@ class ERPNextTestSuite(unittest.TestCase): "activity_type": "_Test Activity Type 1", }, ] - cls.make_records(["activity_type"], records, "activity_type") + self.make_records(["activity_type"], records, "activity_type") - @classmethod - def make_loyalty_program(cls): + def make_loyalty_program(self): records = [ { "doctype": "Loyalty Program", @@ -2692,10 +2616,9 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["loyalty_program_name"], records, "loyalty_program") + self.make_records(["loyalty_program_name"], records, "loyalty_program") - @classmethod - def make_item_price(cls): + def make_item_price(self): records = [ { "doctype": "Item Price", @@ -2764,17 +2687,15 @@ class ERPNextTestSuite(unittest.TestCase): "price_list_rate": 10000, }, ] - cls.make_records(["item_code", "price_list", "price_list_rate"], records, "item_price") + self.make_records(["item_code", "price_list", "price_list_rate"], records, "item_price") - @classmethod - def make_operation(cls): + def make_operation(self): records = [ {"doctype": "Operation", "name": "_Test Operation 1", "workstation": "_Test Workstation 1"} ] - cls.make_records(["name"], records, "operation") + self.make_records(["name"], records, "operation") - @classmethod - def make_workstation(cls): + def make_workstation(self): records = [ { "doctype": "Workstation", @@ -2789,39 +2710,34 @@ class ERPNextTestSuite(unittest.TestCase): "working_hours": [{"start_time": "10:00:00", "end_time": "20:00:00"}], } ] - cls.make_records(["workstation_name"], records, "workstation") + self.make_records(["workstation_name"], records, "workstation") - @classmethod - def make_bom(cls): - # TODO: replace JSON source with hardcoded data in py - cls.load_test_records("BOM") - records = cls.globalTestRecords["BOM"] - cls.make_records(["item", "company"], records, "bom") + def make_bom(self): + # TODO: replace JSON source with hardcoded data + records = load_test_records_for("BOM")["BOM"] + self.make_records(["item", "company"], records, "bom") - @classmethod - def make_quality_inspection_param(cls): + def make_quality_inspection_param(self): records = [{"doctype": "Quality Inspection Parameter", "parameter": "_Test Param"}] - cls.make_records(["parameter"], records, "quality_inspection_param") + self.make_records(["parameter"], records, "quality_inspection_param") - @classmethod - def make_quality_inspection_template(cls): + def make_quality_inspection_template(self): records = [ { "quality_inspection_template_name": "_Test Quality Inspection Template", "doctype": "Quality Inspection Template", "item_quality_inspection_parameter": [ { - "specification": cls.quality_inspection_param[0].name, + "specification": "_Test Param", "doctype": "Item Quality Inspection Parameter", "parentfield": "item_quality_inspection_parameter", } ], } ] - cls.make_records(["quality_inspection_template_name"], records, "quality_inspection_template") + self.make_records(["quality_inspection_template_name"], records, "quality_inspection_template") - @classmethod - def make_brand(cls): + def make_brand(self): records = [ {"brand": "_Test Brand", "doctype": "Brand"}, { @@ -2838,15 +2754,14 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["brand"], records, "brand") + self.make_records(["brand"], records, "brand") - @classmethod - def make_dunning_type(cls): + def make_dunning_type(self): records = [ { "doctype": "Dunning Type", "dunning_type": "First Notice", - "company": cls.companies[0].name, + "company": "_Test Company", "is_default": 1, "dunning_fee": 0, "rate_of_interest": 0, @@ -2863,7 +2778,7 @@ class ERPNextTestSuite(unittest.TestCase): { "doctype": "Dunning Type", "dunning_type": "Second Notice", - "company": cls.companies[0].name, + "company": "_Test Company", "is_default": 0, "dunning_fee": 10, "rate_of_interest": 10, @@ -2878,10 +2793,9 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["dunning_type"], records, "dunning_type") + self.make_records(["dunning_type"], records, "dunning_type") - @classmethod - def make_finance_book(cls): + def make_finance_book(self): records = [ { "doctype": "Finance Book", @@ -2896,10 +2810,9 @@ class ERPNextTestSuite(unittest.TestCase): "finance_book_name": "Test Finance Book 3", }, ] - cls.make_records(["finance_book_name"], records, "finance_book") + self.make_records(["finance_book_name"], records, "finance_book") - @classmethod - def make_custom_doctype(cls): + def make_custom_doctype(self): if not frappe.db.exists("DocType", "Shelf"): frappe.get_doc( { @@ -3015,8 +2928,7 @@ class ERPNextTestSuite(unittest.TestCase): } ).insert(ignore_permissions=True) - @classmethod - def make_address(cls): + def make_address(self): records = [ { "doctype": "Address", @@ -3065,7 +2977,23 @@ class ERPNextTestSuite(unittest.TestCase): ], }, ] - cls.make_records(["address_title", "address_type"], records, "address") + self.make_records(["address_title", "address_type"], records, "address") + + +BootStrapTestData() + + +class ERPNextTestSuite(unittest.TestCase): + @classmethod + def registerAs(cls, _as): + def decorator(cm_func): + setattr(cls, cm_func.__name__, _as(cm_func)) + return cm_func + + return decorator + + def tearDown(self): + frappe.db.rollback() @contextmanager def set_user(self, user: str): From 495e585ab6456230aed1f75896b3daafd5d2ff39 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sun, 1 Mar 2026 21:33:45 +0530 Subject: [PATCH 186/217] refactor(test): hardcoded names over dynamic ones Much faster bootstrap without those get_doc calls --- .../test_process_deferred_accounting.py | 4 ++-- .../purchase_invoice/test_purchase_invoice.py | 4 ++-- erpnext/controllers/tests/test_mapper.py | 2 +- .../tests/test_subcontracting_controller.py | 2 +- erpnext/crm/doctype/lead/test_lead.py | 2 +- .../doctype/opportunity/test_opportunity.py | 2 +- erpnext/crm/doctype/prospect/test_prospect.py | 4 ++-- .../plaid_settings/test_plaid_settings.py | 2 +- erpnext/manufacturing/doctype/bom/test_bom.py | 10 +++++----- .../doctype/job_card/test_job_card.py | 4 ++-- .../doctype/work_order/test_work_order.py | 4 ++-- .../projects/doctype/project/test_project.py | 2 +- erpnext/projects/doctype/task/test_task.py | 2 +- .../doctype/timesheet/test_timesheet.py | 18 +++++++++--------- .../doctype/department/test_department.py | 2 +- .../setup/doctype/employee/test_employee.py | 12 ++++++------ .../delivery_note/test_delivery_note.py | 6 +++--- .../delivery_trip/test_delivery_trip.py | 4 ++-- .../test_landed_cost_voucher.py | 8 ++++---- .../purchase_receipt/test_purchase_receipt.py | 6 +++--- .../test_serial_and_batch_bundle.py | 6 +++--- .../stock/doctype/serial_no/test_serial_no.py | 4 ++-- .../doctype/stock_entry/test_stock_entry.py | 2 +- .../test_stock_reconciliation.py | 2 +- erpnext/stock/tests/test_utils.py | 2 +- erpnext/tests/utils.py | 9 +++++++++ 26 files changed, 67 insertions(+), 58 deletions(-) diff --git a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py index 91bf14867b1..ef98a010511 100644 --- a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py +++ b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py @@ -53,7 +53,7 @@ class TestProcessDeferredAccounting(ERPNextTestSuite): start_date="2023-05-01", end_date="2023-06-30", type="Income", - company=self.companies[0].name, + company="_Test Company", ) process_deferred_accounting.insert() @@ -84,7 +84,7 @@ class TestProcessDeferredAccounting(ERPNextTestSuite): start_date="2019-01-01", end_date="2019-01-31", type="Income", - company=self.companies[0].name, + company="_Test Company", ) pda.submit() pda.cancel() diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 1c51daccd60..33117c639dc 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -2272,7 +2272,7 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): def test_create_purchase_invoice_without_mandatory(self): pi = frappe.new_doc("Purchase Invoice") - pi.company = self.companies[0].name + pi.company = "_Test Company" pi.flags.ignore_mandatory = True pi.insert(ignore_permissions=True) @@ -2401,7 +2401,7 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): "doctype": "Serial No", "item_code": serial_item, "serial_no": serial_no, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert() diff --git a/erpnext/controllers/tests/test_mapper.py b/erpnext/controllers/tests/test_mapper.py index 62a32878f8e..a54fff65706 100644 --- a/erpnext/controllers/tests/test_mapper.py +++ b/erpnext/controllers/tests/test_mapper.py @@ -40,7 +40,7 @@ class TestMapper(ERPNextTestSuite): "order_type": "Sales", "transaction_date": nowdate(), "valid_till": add_months(nowdate(), 1), - "company": self.companies[0].name, + "company": "_Test Company", } ) for item in item_list: diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py index 06bf1bd545a..465b318d09b 100644 --- a/erpnext/controllers/tests/test_subcontracting_controller.py +++ b/erpnext/controllers/tests/test_subcontracting_controller.py @@ -742,7 +742,7 @@ class TestSubcontractingController(ERPNextTestSuite): "doctype": "Serial No", "item_code": "Subcontracted SRM Item 2", "serial_no": serial_no, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert() diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py index 0c37575a465..aada16d177a 100644 --- a/erpnext/crm/doctype/lead/test_lead.py +++ b/erpnext/crm/doctype/lead/test_lead.py @@ -122,7 +122,7 @@ class TestLead(ERPNextTestSuite): create_todo("followup", "Lead", lead.name) opportunity = make_opportunity(lead.name) - opportunity.company = self.companies[0].name + opportunity.company = "_Test Company" opportunity.save() self.assertEqual(opportunity.get("party_name"), lead.name) diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index 0b194e81f49..527033cd810 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -56,7 +56,7 @@ class TestOpportunity(ERPNextTestSuite): self.assertEqual(doc.status, "Quotation") def test_make_new_lead_if_required(self): - opp_doc = make_opportunity_from_lead(self.companies[0].name) + opp_doc = make_opportunity_from_lead("_Test Company") self.assertTrue(opp_doc.party_name) self.assertEqual(opp_doc.opportunity_from, "Lead") diff --git a/erpnext/crm/doctype/prospect/test_prospect.py b/erpnext/crm/doctype/prospect/test_prospect.py index 4d52ea543ab..594269dd084 100644 --- a/erpnext/crm/doctype/prospect/test_prospect.py +++ b/erpnext/crm/doctype/prospect/test_prospect.py @@ -12,7 +12,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestProspect(ERPNextTestSuite): def test_add_lead_to_prospect_and_address_linking(self): - company = self.companies[0].name + company = "_Test Company" lead_doc = make_lead() address_doc = make_address(address_title=lead_doc.name) address_doc.append("links", {"link_doctype": lead_doc.doctype, "link_name": lead_doc.name}) @@ -38,7 +38,7 @@ class TestProspect(ERPNextTestSuite): "doctype": "Prospect", "company_name": "_Test Prospect", "customer_group": "_Test Customer Group", - "company": self.companies[0].name, + "company": "_Test Company", } ) prospect.insert() diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py index 207992c8a45..6cc09e6d2a7 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py @@ -56,7 +56,7 @@ class TestPlaidSettings(ERPNextTestSuite): } bank = json.dumps(frappe.get_doc("Bank", "Citi").as_dict(), default=json_handler) - company = self.companies[0].name + company = "_Test Company" add_bank_accounts(bank_accounts, bank, company) diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index d86b2da4f34..69b55e6d1d8 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -392,7 +392,7 @@ class TestBOM(ERPNextTestSuite): item_code = make_item(properties={"is_stock_item": 1}).name bom = frappe.new_doc("BOM") - bom.company = self.companies[0].name + bom.company = "_Test Company" bom.item = item_code bom.append("items", frappe._dict(item_code=item_code)) bom.save() @@ -406,13 +406,13 @@ class TestBOM(ERPNextTestSuite): item2 = make_item(properties={"is_stock_item": 1}).name bom1 = frappe.new_doc("BOM") - bom1.company = self.companies[0].name + bom1.company = "_Test Company" bom1.item = item1 bom1.append("items", frappe._dict(item_code=item2)) bom1.save() bom2 = frappe.new_doc("BOM") - bom2.company = self.companies[0].name + bom2.company = "_Test Company" bom2.item = item2 bom2.append("items", frappe._dict(item_code=item1)) bom2.save() @@ -570,7 +570,7 @@ class TestBOM(ERPNextTestSuite): @timeout def test_clear_inpection_quality(self): bom = frappe.copy_doc(self.globalTestRecords["BOM"][2], ignore_no_copy=True) - bom.company = self.companies[0].name + bom.company = "_Test Company" bom.docstatus = 0 bom.is_default = 0 bom.quality_inspection_template = "_Test Quality Inspection Template" @@ -616,7 +616,7 @@ class TestBOM(ERPNextTestSuite): # Step 1: Create BOM bom = frappe.new_doc("BOM") - bom.company = self.companies[0].name + bom.company = "_Test Company" bom.item = fg_item.item_code bom.quantity = 1 bom.append( diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index f81b19ac6ce..f2f120f3220 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -87,7 +87,7 @@ class TestJobCard(ERPNextTestSuite): quantity=1, with_operations=1, track_semi_finished_goods=1, - company=self.companies[9].name, + company="_Test Company", ) final_bom.append("items", {"item_code": raw.name, "qty": 1}) final_bom.append( @@ -121,7 +121,7 @@ class TestJobCard(ERPNextTestSuite): final_bom.append("items", {"item_code": stitch_fg.name, "qty": 1, "operation_row_id": 3}) final_bom.submit() work_order = make_work_order(final_bom.name, final.name, 1, variant_items=[], use_multi_level_bom=0) - work_order.company = self.companies[9].name + work_order.company = "_Test Company" work_order.wip_warehouse = "Work In Progress - WP" work_order.fg_warehouse = "Finished Goods - WP" work_order.scrap_warehouse = "All Warehouses - WP" diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index b75bfafcf28..3b39c58fbac 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -960,7 +960,7 @@ class TestWorkOrder(ERPNextTestSuite): bom_item, fg_qty=1, process_loss_percentage=10, - company=self.companies[0].name, + company="_Test Company", ) bom_doc.submit() @@ -1147,7 +1147,7 @@ class TestWorkOrder(ERPNextTestSuite): "is_active": 1, "is_default": 1, "quantity": 1.0, - "company": self.companies[0].name, + "company": "_Test Company", "with_operations": 1, "operations": [ { diff --git a/erpnext/projects/doctype/project/test_project.py b/erpnext/projects/doctype/project/test_project.py index bea5c05e1d0..174d610a5bd 100644 --- a/erpnext/projects/doctype/project/test_project.py +++ b/erpnext/projects/doctype/project/test_project.py @@ -18,7 +18,7 @@ class TestProject(ERPNextTestSuite): from erpnext.setup.doctype.employee.test_employee import make_employee project_name = "Test Project Costing" - employee = make_employee("employee@frappe.io", company=self.companies[0].name) + employee = make_employee("employee@frappe.io", company="_Test Company") project = make_project({"project_name": project_name}) timesheet = make_timesheet( employee=employee, diff --git a/erpnext/projects/doctype/task/test_task.py b/erpnext/projects/doctype/task/test_task.py index 066e5960b3f..bbb821af86b 100644 --- a/erpnext/projects/doctype/task/test_task.py +++ b/erpnext/projects/doctype/task/test_task.py @@ -16,7 +16,7 @@ class TestTask(ERPNextTestSuite): from erpnext.setup.doctype.employee.test_employee import make_employee project_name = "Test Project Costing" - employee = make_employee("employee@frappe.io", company=self.companies[0].name) + employee = make_employee("employee@frappe.io", company="_Test Company") project = make_project({"project_name": project_name}) task = create_task("_Test Task 1") task.project = project.name diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py index 31d84908376..f1a0f6edfd9 100644 --- a/erpnext/projects/doctype/timesheet/test_timesheet.py +++ b/erpnext/projects/doctype/timesheet/test_timesheet.py @@ -65,7 +65,7 @@ class TestTimesheet(ERPNextTestSuite): ) def test_timesheet_base_amount(self): - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") timesheet = make_timesheet(emp, simulate=True, is_billable=1) self.assertEqual(timesheet.time_logs[0].base_billing_rate, 50) @@ -74,7 +74,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(timesheet.time_logs[0].base_costing_amount, 40) def test_timesheet_billing_amount(self): - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") timesheet = make_timesheet(emp, simulate=True, is_billable=1) self.assertEqual(timesheet.total_hours, 2) @@ -84,7 +84,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(timesheet.total_billable_amount, 100) def test_timesheet_billing_amount_not_billable(self): - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") timesheet = make_timesheet(emp, simulate=True, is_billable=0) self.assertEqual(timesheet.total_hours, 2) @@ -94,7 +94,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(timesheet.total_billable_amount, 0) def test_sales_invoice_from_timesheet(self): - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") timesheet = make_timesheet(emp, simulate=True, is_billable=1) sales_invoice = make_sales_invoice(timesheet.name, "_Test Item", "_Test Customer", currency="INR") @@ -112,7 +112,7 @@ class TestTimesheet(ERPNextTestSuite): @ERPNextTestSuite.change_settings("Projects Settings", {"fetch_timesheet_in_sales_invoice": 1}) def test_timesheet_billing_based_on_project(self): - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") project = frappe.get_value("Project", {"project_name": "_Test Project"}) timesheet = make_timesheet( @@ -128,7 +128,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(ts.time_logs[0].sales_invoice, sales_invoice.name) def test_timesheet_time_overlap(self): - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") settings = frappe.get_single("Projects Settings") initial_setting = settings.ignore_employee_time_overlap @@ -184,7 +184,7 @@ class TestTimesheet(ERPNextTestSuite): settings.save() def test_timesheet_not_overlapping_with_continuous_timelogs(self): - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") update_activity_type("_Test Activity Type") timesheet = frappe.new_doc("Timesheet") @@ -213,7 +213,7 @@ class TestTimesheet(ERPNextTestSuite): timesheet.save() # should not throw an error def test_to_time(self): - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") from_time = now_datetime() timesheet = frappe.new_doc("Timesheet") @@ -279,7 +279,7 @@ class TestTimesheet(ERPNextTestSuite): This test ensures Timesheet status is recalculated correctly across billing and return lifecycle events. """ - emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name) + emp = make_employee("test_employee_6@salary.com", company="_Test Company") timesheet = make_timesheet(emp, simulate=True, is_billable=1, do_not_submit=True) timesheet_detail = timesheet.append("time_logs", {}) diff --git a/erpnext/setup/doctype/department/test_department.py b/erpnext/setup/doctype/department/test_department.py index bd324a0c4f2..059dc8e9c96 100644 --- a/erpnext/setup/doctype/department/test_department.py +++ b/erpnext/setup/doctype/department/test_department.py @@ -9,7 +9,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestDepartment(ERPNextTestSuite): def test_remove_department_data(self): - doc = create_department("Test Department", company=self.companies[0].name) + doc = create_department("Test Department", company="_Test Company") frappe.delete_doc("Department", doc.name) diff --git a/erpnext/setup/doctype/employee/test_employee.py b/erpnext/setup/doctype/employee/test_employee.py index cd5765fac5e..c022f724a66 100644 --- a/erpnext/setup/doctype/employee/test_employee.py +++ b/erpnext/setup/doctype/employee/test_employee.py @@ -14,8 +14,8 @@ from erpnext.tests.utils import ERPNextTestSuite class TestEmployee(ERPNextTestSuite): def test_employee_status_left(self): - employee1 = make_employee("test_employee_1@company.com", company=self.companies[0].name) - employee2 = make_employee("test_employee_2@company.com", company=self.companies[0].name) + employee1 = make_employee("test_employee_1@company.com", company="_Test Company") + employee2 = make_employee("test_employee_2@company.com", company="_Test Company") employee1_doc = frappe.get_doc("Employee", employee1) employee2_doc = frappe.get_doc("Employee", employee2) employee2_doc.reload() @@ -26,7 +26,7 @@ class TestEmployee(ERPNextTestSuite): self.assertRaises(InactiveEmployeeStatusError, employee1_doc.save) def test_user_has_employee(self): - employee = make_employee("test_emp_user_creation@company.com", company=self.companies[0].name) + employee = make_employee("test_emp_user_creation@company.com", company="_Test Company") employee_doc = frappe.get_doc("Employee", employee) user = employee_doc.user_id self.assertTrue("Employee" in frappe.get_roles(user)) @@ -36,12 +36,12 @@ class TestEmployee(ERPNextTestSuite): def test_employee_user_permission(self): employee1 = make_employee( - "employee_1_test@company.com", create_user_permission=1, company=self.companies[0].name + "employee_1_test@company.com", create_user_permission=1, company="_Test Company" ) employee2 = make_employee( - "employee_2_test@company.com", create_user_permission=1, company=self.companies[0].name + "employee_2_test@company.com", create_user_permission=1, company="_Test Company" ) - make_employee("employee_3_test@company.com", create_user_permission=1, company=self.companies[0].name) + make_employee("employee_3_test@company.com", create_user_permission=1, company="_Test Company") employee1_doc = frappe.get_doc("Employee", employee1) employee2_doc = frappe.get_doc("Employee", employee2) diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 0d6f75984f9..8317a397aeb 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -161,7 +161,7 @@ class TestDeliveryNote(ERPNextTestSuite): "doctype": "Serial No", "item_code": "_Test Serialized Item With Series", "serial_no": make_autoname("SRDD", "Serial No"), - "company": self.companies[0].name, + "company": "_Test Company", } ) serial_no.save() @@ -226,7 +226,7 @@ class TestDeliveryNote(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, - "company": self.companies[0].name, + "company": "_Test Company", } ) sn_doc.insert() @@ -1837,7 +1837,7 @@ class TestDeliveryNote(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, - "company": self.companies[0].name, + "company": "_Test Company", } ) sn_doc.insert() diff --git a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py index 98c0adfc532..783a28a47d8 100644 --- a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py @@ -22,14 +22,14 @@ class TestDeliveryTrip(ERPNextTestSuite): create_test_contact_and_address() address = create_address(driver) - self.delivery_trip = create_delivery_trip(driver, address, company=self.companies[0].name) + self.delivery_trip = create_delivery_trip(driver, address, company="_Test Company") def test_delivery_trip_notify_customers(self): # set default outgoing outgoing = frappe.get_doc( { "doctype": "Email Account", - "company": self.companies[0].name, + "company": "_Test Company", "enable_outgoing": 1, "default_outgoing": 1, "awaiting_password": 1, diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py index 0efa722695b..ee2b2051e8b 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py @@ -401,7 +401,7 @@ class TestLandedCostVoucher(ERPNextTestSuite): "doctype": "Serial No", "item_code": item_code, "serial_no": serial_no, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert() @@ -670,7 +670,7 @@ class TestLandedCostVoucher(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, - "company": self.companies[0].name, + "company": "_Test Company", } ) sn_doc.insert() @@ -821,7 +821,7 @@ class TestLandedCostVoucher(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, - "company": self.companies[0].name, + "company": "_Test Company", } ) sn_doc.insert() @@ -1012,7 +1012,7 @@ class TestLandedCostVoucher(ERPNextTestSuite): "doctype": "Serial No", "item_code": sn_item, "serial_no": sn, - "company": self.companies[0].name, + "company": "_Test Company", } ) sn_doc.insert() diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 07473784d1e..3772c051b75 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -739,7 +739,7 @@ class TestPurchaseReceipt(ERPNextTestSuite): "doctype": "Serial No", "item_code": item_code, "serial_no": serial_no[0], - "company": self.companies[0].name, + "company": "_Test Company", } ).insert() @@ -2698,7 +2698,7 @@ class TestPurchaseReceipt(ERPNextTestSuite): "doctype": "Serial No", "item_code": serial_item, "serial_no": serial_no, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert() @@ -3992,7 +3992,7 @@ class TestPurchaseReceipt(ERPNextTestSuite): "doctype": "Serial No", "item_code": serial_item, "serial_no": serial_no, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert() diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py index 79bcb63e531..c6929fe4cdb 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py @@ -40,7 +40,7 @@ class TestSerialandBatchBundle(ERPNextTestSuite): "doctype": "Serial No", "serial_no": sn, "item_code": serial_item_code, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert(ignore_permissions=True) @@ -707,7 +707,7 @@ class TestSerialandBatchBundle(ERPNextTestSuite): "doctype": "Serial No", "serial_no": serial_no, "item_code": item, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert(ignore_permissions=True) @@ -805,7 +805,7 @@ class TestSerialandBatchBundle(ERPNextTestSuite): "doctype": "Serial No", "serial_no": serial_no, "item_code": sn_item, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert(ignore_permissions=True) serial_nos.append(serial_no) diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py index a82cbe5d306..3ad635eb65b 100644 --- a/erpnext/stock/doctype/serial_no/test_serial_no.py +++ b/erpnext/stock/doctype/serial_no/test_serial_no.py @@ -34,7 +34,7 @@ class TestSerialNo(ERPNextTestSuite): sr.warehouse = "_Test Warehouse - _TC" sr.serial_no = "_TCSER0001" sr.purchase_rate = 10 - sr.company = self.companies[0].name + sr.company = "_Test Company" self.assertRaises(SerialNoCannotCreateDirectError, sr.insert) sr.warehouse = None @@ -198,7 +198,7 @@ class TestSerialNo(ERPNextTestSuite): "doctype": "Serial No", "item_code": item_code, "serial_no": serial_no, - "company": self.companies[0].name, + "company": "_Test Company", } ).insert() diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 7a08fce7053..5d8ebdda56f 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -649,7 +649,7 @@ class TestStockEntry(ERPNextTestSuite): doc = frappe.new_doc("Serial No") doc.serial_no = serial_no doc.item_code = "_Test Serialized Item" - doc.company = self.companies[0].name + doc.company = "_Test Company" doc.insert(ignore_permissions=True) se = frappe.copy_doc(self.globalTestRecords["Stock Entry"][0]) diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 9d0bd7d9104..e0fc0ba6d11 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -612,7 +612,7 @@ class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): "doctype": "Serial No", "item_code": item_code, "serial_no": "SR-CREATED-SR-NO", - "company": self.companies[0].name, + "company": "_Test Company", } ).insert() diff --git a/erpnext/stock/tests/test_utils.py b/erpnext/stock/tests/test_utils.py index cdbc2b4b41b..dfbe6d24806 100644 --- a/erpnext/stock/tests/test_utils.py +++ b/erpnext/stock/tests/test_utils.py @@ -89,7 +89,7 @@ class TestStockUtilities(ERPNextTestSuite, StockTestMixin): doctype="Serial No", item_code=serial_item.name, serial_no=frappe.generate_hash(), - company=self.companies[0].name, + company="_Test Company", ).insert() serial_scan = scan_barcode(serial.name) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index b03171c662a..9bed50d4afb 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -2992,9 +2992,18 @@ class ERPNextTestSuite(unittest.TestCase): return decorator + @classmethod + def setUpClass(cls): + cls.globalTestRecords = {} + def tearDown(self): frappe.db.rollback() + def load_test_records(self, doctype): + if doctype not in self.globalTestRecords: + records = load_test_records_for(doctype) + self.globalTestRecords[doctype] = records[doctype] + @contextmanager def set_user(self, user: str): try: From 7d0779c73cf11aa25cf97db0f5656752f727f0af Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Mar 2026 07:40:17 +0530 Subject: [PATCH 187/217] refactor(test): remove explicit call to master data setup --- .../accounts/doctype/sales_invoice/test_sales_invoice.py | 2 -- erpnext/controllers/tests/test_queries.py | 2 +- erpnext/crm/doctype/lead/test_lead.py | 8 ++++---- erpnext/crm/doctype/opportunity/test_opportunity.py | 6 ------ .../maintenance_schedule/test_maintenance_schedule.py | 2 +- erpnext/manufacturing/doctype/job_card/test_job_card.py | 3 +-- .../projects/doctype/activity_cost/test_activity_cost.py | 7 +------ .../party_specific_item/test_party_specific_item.py | 8 ++++---- erpnext/stock/doctype/delivery_note/test_delivery_note.py | 2 +- 9 files changed, 13 insertions(+), 27 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 909288734ec..db0fc1c6009 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -52,8 +52,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestSalesInvoice(ERPNextTestSuite): def setUp(self): - self.make_employees() - self.make_sales_person() self.load_test_records("Journal Entry") self.load_test_records("Stock Entry") self.load_test_records("Sales Invoice") diff --git a/erpnext/controllers/tests/test_queries.py b/erpnext/controllers/tests/test_queries.py index cfafb534857..89cb4e50ee4 100644 --- a/erpnext/controllers/tests/test_queries.py +++ b/erpnext/controllers/tests/test_queries.py @@ -99,7 +99,7 @@ class TestQueries(ERPNextTestSuite): { "user": user.name, "doctype": "Employee", - "docname": self.employees[0].name, + "docname": "_Test Employee", "is_default": 1, "apply_to_all_doctypes": 1, "applicable_doctypes": [], diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py index aada16d177a..8e52116fe1f 100644 --- a/erpnext/crm/doctype/lead/test_lead.py +++ b/erpnext/crm/doctype/lead/test_lead.py @@ -17,9 +17,9 @@ class TestLead(ERPNextTestSuite): frappe.delete_doc_if_exists("Customer", "_Test Lead") - customer = make_customer(self.leads[0].name) + customer = make_customer("_Test Lead") self.assertEqual(customer.doctype, "Customer") - self.assertEqual(customer.lead_name, self.leads[0].name) + self.assertEqual(customer.lead_name, "_Test Lead") customer.company = "_Test Company" customer.customer_group = "_Test Customer Group" @@ -43,9 +43,9 @@ class TestLead(ERPNextTestSuite): def test_make_customer_from_organization(self): from erpnext.crm.doctype.lead.lead import make_customer - customer = make_customer(self.leads[1].name) + customer = make_customer("_Test Lead 1") self.assertEqual(customer.doctype, "Customer") - self.assertEqual(customer.lead_name, self.leads[1].name) + self.assertEqual(customer.lead_name, "_Test Lead 1") customer.company = "_Test Company" customer.customer_group = "_Test Customer Group" diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index 527033cd810..3d254daaa4b 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -14,12 +14,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestOpportunity(ERPNextTestSuite): - def setUp(self): - # Only first lead is required - # TODO: dynamically generate limited test records - self.make_leads() - self.make_opportunities() - @classmethod def make_opportunities(cls): records = [ diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py index 3c4843b5e0c..b10873663c7 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py @@ -156,7 +156,7 @@ class TestMaintenanceSchedule(ERPNextTestSuite): self.assertFalse(ms.validate_items_table_change()) # After Save ms.items[0].serial_no = "TEST001" - ms.items[0].sales_person = self.sales_person[0].name + ms.items[0].sales_person = "_Test Sales Person" ms.items[0].no_of_visits = 2 self.assertTrue(ms.validate_items_table_change()) ms.save() diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index f2f120f3220..1f92cfd5fad 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -29,7 +29,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestJobCard(ERPNextTestSuite): def setUp(self): self.load_test_records("BOM") - self.make_employees() # used in job card time log self.make_bom_for_jc_tests() self.transfer_material_against: Literal["Work Order", "Job Card"] = "Work Order" self.source_warehouse = None @@ -187,7 +186,7 @@ class TestJobCard(ERPNextTestSuite): jc1 = frappe.get_last_doc("Job Card", {"work_order": self.work_order.name}) jc2 = frappe.get_last_doc("Job Card", {"work_order": wo2.name}) - employee = self.employees[0].name + employee = "_Test Employee" jc1.append( "time_logs", diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py index e13e8ac2ad1..0946d347fe7 100644 --- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py +++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py @@ -10,17 +10,12 @@ from erpnext.tests.utils import ERPNextTestSuite class TestActivityCost(ERPNextTestSuite): - def setUp(self): - # TODO: only 1 employee is required - self.make_employees() - self.make_activity_type() - def test_duplication(self): frappe.db.sql("delete from `tabActivity Cost`") activity_cost1 = frappe.new_doc("Activity Cost") activity_cost1.update( { - "employee": self.employees[0].name, + "employee": "_Test Employee", "employee_name": self.employees[0].first_name, "activity_type": self.activity_type[1].name, "billing_rate": 100, diff --git a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py index e1e4aca0b28..a94837452e6 100644 --- a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py +++ b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py @@ -18,8 +18,8 @@ def create_party_specific_item(**args): class TestPartySpecificItem(ERPNextTestSuite): def test_item_query_for_customer(self): - customer = self.customer[0].name - item = self.item[0].name + customer = "_Test Customer With Template" + item = "_Test Item" create_party_specific_item( party_type="Customer", @@ -34,8 +34,8 @@ class TestPartySpecificItem(ERPNextTestSuite): self.assertTrue(item in flatten(items)) def test_item_query_for_supplier(self): - supplier = self.suppliers[0].name - item = self.item_group[0].name + supplier = "_Test Supplier With Template 1" + item = "_Test Item Group" create_party_specific_item( party_type="Supplier", diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 8317a397aeb..a9c3970e0cc 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -2613,7 +2613,7 @@ class TestDeliveryNote(ERPNextTestSuite): self.assertEqual(dn.status, "To Bill") si = make_sales_invoice(dn.name) - si.location = self.location[0].name + si.location = "Test Location" si.submit() dn_return = create_delivery_note(is_return=1, return_against=dn.name, qty=-2, do_not_submit=True) From 9f3afea27fb7d62290bf1aa04af5f4a98ca19c40 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Mar 2026 07:55:53 +0530 Subject: [PATCH 188/217] refactor(test): use JSON for company master --- erpnext/setup/doctype/company/test_company.py | 3 +- .../setup/doctype/company/test_records.json | 184 +++++++++++++++++ erpnext/tests/utils.py | 185 +----------------- 3 files changed, 187 insertions(+), 185 deletions(-) create mode 100644 erpnext/setup/doctype/company/test_records.json diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index 0e04e24b0f9..c3fb5dd6ff2 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -106,11 +106,12 @@ class TestCompany(ERPNextTestSuite): ) def test_basic_tree(self, records=None): + self.load_test_records("Company") min_lft = 1 max_rgt = frappe.db.sql("select max(rgt) from `tabCompany`")[0][0] if not records: - records = self.companies[2:] + records = self.globalTestRecords["Company"][2:] for company in records: lft, rgt, parent_company = frappe.db.get_value( diff --git a/erpnext/setup/doctype/company/test_records.json b/erpnext/setup/doctype/company/test_records.json new file mode 100644 index 00000000000..1b51d98413e --- /dev/null +++ b/erpnext/setup/doctype/company/test_records.json @@ -0,0 +1,184 @@ +[ + { + "abbr": "_TC", + "company_name": "_Test Company", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0, + "allow_account_creation_against_child_company": 1 + }, + { + "abbr": "_TC1", + "company_name": "_Test Company 1", + "country": "United States", + "default_currency": "USD", + "doctype": "Company", + "domain": "Retail", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0 + }, + { + "abbr": "_TC2", + "company_name": "_Test Company 2", + "default_currency": "EUR", + "country": "Germany", + "doctype": "Company", + "domain": "Retail", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0 + }, + { + "abbr": "_TC3", + "company_name": "_Test Company 3", + "is_group": 1, + "country": "Pakistan", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0 + }, + { + "abbr": "_TC4", + "company_name": "_Test Company 4", + "parent_company": "_Test Company 3", + "is_group": 1, + "country": "Pakistan", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0 + }, + { + "abbr": "_TC5", + "company_name": "_Test Company 5", + "parent_company": "_Test Company 4", + "country": "Pakistan", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0 + }, + { + "abbr": "TCP1", + "company_name": "_Test Company with perpetual inventory", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 1 + }, + { + "abbr": "_TC6", + "company_name": "_Test Company 6", + "is_group": 1, + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0 + }, + { + "abbr": "_TC7", + "company_name": "_Test Company 7", + "parent_company": "_Test Company 6", + "is_group": 1, + "country": "United States", + "default_currency": "USD", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0 + }, + { + "doctype": "Company", + "default_currency": "USD", + "full_name": "Test User", + "company_name": "Wind Power LLC", + "timezone": "America/New_York", + "abbr": "WP", + "industry": "Manufacturing", + "country": "United States", + "language": "english", + "company_tagline": "Testing", + "email": "test@erpnext.com", + "password": "test", + "chart_of_accounts": "Standard" + }, + { + "abbr": "PGCI", + "company_name": "Parent Group Company India", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0, + "is_group": 1 + }, + { + "abbr": "CCI", + "company_name": "Child Company India", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0, + "parent_company": "Parent Group Company India" + }, + { + "abbr": "CCU", + "company_name": "Child Company US", + "country": "United States", + "default_currency": "USD", + "doctype": "Company", + "domain": "Manufacturing", + "chart_of_accounts": "Standard", + "default_holiday_list": "_Test Holiday List", + "enable_perpetual_inventory": 0, + "parent_company": "Parent Group Company India" + }, + { + "abbr": "BT", + "company_name": "Best Test", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "chart_of_accounts": "Standard" + }, + { + "abbr": "_TCUV", + "company_name": "_Test Company UAE VAT", + "country": "United Arab Emirates", + "default_currency": "AED", + "doctype": "Company", + "create_chart_of_accounts_based_on": "Standard Template" + }, + { + "abbr": "_TCSV", + "company_name": "_Test Company SA VAT", + "country": "South Africa", + "default_currency": "ZAR", + "doctype": "Company", + "create_chart_of_accounts_based_on": "Standard Template" + } +] diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 9bed50d4afb..0c4e693fa6f 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -699,190 +699,7 @@ class BootStrapTestData: self.make_records(["holiday_list_name"], records, "holiday_list") def make_company(self): - records = [ - { - "abbr": "_TC", - "company_name": "_Test Company", - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - "allow_account_creation_against_child_company": 1, - }, - { - "abbr": "_TC1", - "company_name": "_Test Company 1", - "country": "United States", - "default_currency": "USD", - "doctype": "Company", - "domain": "Retail", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - }, - { - "abbr": "_TC2", - "company_name": "_Test Company 2", - "default_currency": "EUR", - "country": "Germany", - "doctype": "Company", - "domain": "Retail", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - }, - { - "abbr": "_TC3", - "company_name": "_Test Company 3", - "is_group": 1, - "country": "Pakistan", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - }, - { - "abbr": "_TC4", - "company_name": "_Test Company 4", - "parent_company": "_Test Company 3", - "is_group": 1, - "country": "Pakistan", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - }, - { - "abbr": "_TC5", - "company_name": "_Test Company 5", - "parent_company": "_Test Company 4", - "country": "Pakistan", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - }, - { - "abbr": "TCP1", - "company_name": "_Test Company with perpetual inventory", - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "enable_perpetual_inventory": 1, - "default_holiday_list": "_Test Holiday List", - }, - { - "abbr": "_TC6", - "company_name": "_Test Company 6", - "is_group": 1, - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - }, - { - "abbr": "_TC7", - "company_name": "_Test Company 7", - "parent_company": "_Test Company 6", - "is_group": 1, - "country": "United States", - "default_currency": "USD", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - }, - { - "doctype": "Company", - "default_currency": "USD", - "full_name": "Test User", - "company_name": "Wind Power LLC", - "timezone": "America/New_York", - "abbr": "WP", - "industry": "Manufacturing", - "country": "United States", - "language": "english", - "company_tagline": "Testing", - "email": "test@erpnext.com", - "password": "test", - "chart_of_accounts": "Standard", - }, - { - "abbr": "PGCI", - "company_name": "Parent Group Company India", - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - "is_group": 1, - }, - { - "abbr": "CCI", - "company_name": "Child Company India", - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - "parent_company": "Parent Group Company India", - }, - { - "abbr": "CCU", - "company_name": "Child Company US", - "country": "United States", - "default_currency": "USD", - "doctype": "Company", - "domain": "Manufacturing", - "chart_of_accounts": "Standard", - "default_holiday_list": "_Test Holiday List", - "enable_perpetual_inventory": 0, - "parent_company": "Parent Group Company India", - }, - { - "abbr": "BT", - "company_name": "Best Test", - "country": "India", - "default_currency": "INR", - "doctype": "Company", - "chart_of_accounts": "Standard", - }, - { - "abbr": "_TCUV", - "company_name": "_Test Company UAE VAT", - "country": "United Arab Emirates", - "default_currency": "AED", - "doctype": "Company", - "create_chart_of_accounts_based_on": "Standard Template", - }, - { - "abbr": "_TCSV", - "company_name": "_Test Company SA VAT", - "country": "South Africa", - "default_currency": "ZAR", - "doctype": "Company", - "create_chart_of_accounts_based_on": "Standard Template", - }, - ] + records = load_test_records_for("Company")["Company"] self.make_records(["company_name"], records, "companies") def make_fiscal_year(self): From 021789baf128f95fb3d1e40007492a2083adf454 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Mar 2026 11:05:32 +0530 Subject: [PATCH 189/217] refactor(test): hardcoded names over dynamic --- erpnext/controllers/tests/test_queries.py | 4 +++- erpnext/crm/doctype/lead/test_lead.py | 11 +++++++---- .../manufacturing/doctype/job_card/test_job_card.py | 8 ++++---- .../doctype/activity_cost/test_activity_cost.py | 11 ++++++++--- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/erpnext/controllers/tests/test_queries.py b/erpnext/controllers/tests/test_queries.py index 89cb4e50ee4..29f7ea1ea9f 100644 --- a/erpnext/controllers/tests/test_queries.py +++ b/erpnext/controllers/tests/test_queries.py @@ -85,6 +85,8 @@ class TestQueries(ERPNextTestSuite): self.assertGreaterEqual(frappe.db.count("UOM", {"enabled": 1}), 10) def test_employee_query_with_user_permissions(self): + employee = frappe.db.get_all("Employee", {"first_name": "_Test Employee"})[0].name + # party field is a dynamic link field in Payment Entry doctype with ignore_user_permissions=0 ps = make_property_setter( doctype="Payment Entry", @@ -99,7 +101,7 @@ class TestQueries(ERPNextTestSuite): { "user": user.name, "doctype": "Employee", - "docname": "_Test Employee", + "docname": employee, "is_default": 1, "apply_to_all_doctypes": 1, "applicable_doctypes": [], diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py index 8e52116fe1f..91287166cee 100644 --- a/erpnext/crm/doctype/lead/test_lead.py +++ b/erpnext/crm/doctype/lead/test_lead.py @@ -15,11 +15,13 @@ class TestLead(ERPNextTestSuite): def test_make_customer(self): from erpnext.crm.doctype.lead.lead import make_customer + lead = frappe.db.get_all("Lead", {"lead_name": "_Test Lead"})[0].name + frappe.delete_doc_if_exists("Customer", "_Test Lead") - customer = make_customer("_Test Lead") + customer = make_customer(lead) self.assertEqual(customer.doctype, "Customer") - self.assertEqual(customer.lead_name, "_Test Lead") + self.assertEqual(customer.lead_name, lead) customer.company = "_Test Company" customer.customer_group = "_Test Customer Group" @@ -43,9 +45,10 @@ class TestLead(ERPNextTestSuite): def test_make_customer_from_organization(self): from erpnext.crm.doctype.lead.lead import make_customer - customer = make_customer("_Test Lead 1") + lead = frappe.db.get_all("Lead", {"lead_name": "_Test Lead 1"})[0].name + customer = make_customer(lead) self.assertEqual(customer.doctype, "Customer") - self.assertEqual(customer.lead_name, "_Test Lead 1") + self.assertEqual(customer.lead_name, lead) customer.company = "_Test Company" customer.customer_group = "_Test Customer Group" diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 1f92cfd5fad..cb05acb9433 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -121,9 +121,9 @@ class TestJobCard(ERPNextTestSuite): final_bom.submit() work_order = make_work_order(final_bom.name, final.name, 1, variant_items=[], use_multi_level_bom=0) work_order.company = "_Test Company" - work_order.wip_warehouse = "Work In Progress - WP" - work_order.fg_warehouse = "Finished Goods - WP" - work_order.scrap_warehouse = "All Warehouses - WP" + work_order.wip_warehouse = "Work In Progress - _TC" + work_order.fg_warehouse = "Finished Goods - _TC" + work_order.scrap_warehouse = "All Warehouses - _TC" for operation in work_order.operations: operation.time_in_mins = 60 @@ -186,7 +186,7 @@ class TestJobCard(ERPNextTestSuite): jc1 = frappe.get_last_doc("Job Card", {"work_order": self.work_order.name}) jc2 = frappe.get_last_doc("Job Card", {"work_order": wo2.name}) - employee = "_Test Employee" + employee = frappe.db.get_all("Employee", {"first_name": "_Test Employee"})[0].name jc1.append( "time_logs", diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py index 0946d347fe7..2859f6d2952 100644 --- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py +++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py @@ -11,13 +11,18 @@ from erpnext.tests.utils import ERPNextTestSuite class TestActivityCost(ERPNextTestSuite): def test_duplication(self): + employee = frappe.db.get_all("Employee", filters={"first_name": "_Test Employee"})[0].name + activity_type = frappe.db.get_all( + "Activity Type", filters={"activity_type": "_Test Activity Type 1"} + )[0].name + frappe.db.sql("delete from `tabActivity Cost`") activity_cost1 = frappe.new_doc("Activity Cost") activity_cost1.update( { - "employee": "_Test Employee", - "employee_name": self.employees[0].first_name, - "activity_type": self.activity_type[1].name, + "employee": employee, + "employee_name": employee, + "activity_type": activity_type, "billing_rate": 100, "costing_rate": 50, } From 7cb662a54c485fadadc5614b3e693318a84f3bf8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Mar 2026 12:23:10 +0530 Subject: [PATCH 190/217] refactor(test): make sales invoice deterministic --- .../accounts/doctype/sales_invoice/test_sales_invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index db0fc1c6009..7a62a22f06b 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -261,6 +261,9 @@ class TestSalesInvoice(ERPNextTestSuite): si1.load_from_db() self.assertRaises(PaymentEntryUnlinkError, si1.cancel) + @ERPNextTestSuite.change_settings( + "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1} + ) def test_sales_invoice_calculation_export_currency(self): si = frappe.copy_doc(self.globalTestRecords["Sales Invoice"][2]) si.currency = "USD" @@ -745,6 +748,9 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(si.base_grand_total, 1622.97) self.assertEqual(si.grand_total, 1622.97) + @ERPNextTestSuite.change_settings( + "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1} + ) def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self): # prepare si = frappe.copy_doc(self.globalTestRecords["Sales Invoice"][3]) From 037fdd6882640a0871283b7e01b451906bfb32de Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Mar 2026 21:36:42 +0530 Subject: [PATCH 191/217] refactor(test): make bank clearance deterministic --- erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py index 825db9d7713..4982177e73b 100644 --- a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py +++ b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py @@ -19,6 +19,7 @@ from erpnext.tests.utils import ERPNextTestSuite, if_lending_app_installed, if_l class TestBankClearance(ERPNextTestSuite): def setUp(self): + frappe.clear_cache() create_warehouse( warehouse_name="_Test Warehouse", properties={"parent_warehouse": "All Warehouses - _TC"}, From af614bd195837aed63082900176e0d2fd4e5cf92 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 2 Mar 2026 21:49:46 +0530 Subject: [PATCH 192/217] refactor(test): make location determinisitic --- erpnext/assets/doctype/location/location.py | 6 +++--- erpnext/assets/doctype/location/test_location.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/assets/doctype/location/location.py b/erpnext/assets/doctype/location/location.py index 03d0980b03f..684a15860cd 100644 --- a/erpnext/assets/doctype/location/location.py +++ b/erpnext/assets/doctype/location/location.py @@ -77,7 +77,7 @@ class Location(NestedSet): location = json.loads(self.location) location["features"] = features - self.db_set("location", json.dumps(location), commit=True) + self.db_set("location", json.dumps(location)) def update_ancestor_location_features(self): self_features = set(self.add_child_property()) @@ -105,7 +105,7 @@ class Location(NestedSet): ancestor_features[index] = json.loads(feature) ancestor_doc.set_location_features(features=ancestor_features) - ancestor_doc.db_set("area", ancestor_doc.area + self.area_difference, commit=True) + ancestor_doc.db_set("area", ancestor_doc.area + self.area_difference) def remove_ancestor_location_features(self): for ancestor in self.get_ancestors(): @@ -116,7 +116,7 @@ class Location(NestedSet): ancestor_features[index] = json.loads(feature) ancestor_doc.set_location_features(features=ancestor_features) - ancestor_doc.db_set("area", ancestor_doc.area - self.area, commit=True) + ancestor_doc.db_set("area", ancestor_doc.area - self.area) def add_child_property(self): features = self.get_location_features() diff --git a/erpnext/assets/doctype/location/test_location.py b/erpnext/assets/doctype/location/test_location.py index 771a99d2380..1222def606e 100644 --- a/erpnext/assets/doctype/location/test_location.py +++ b/erpnext/assets/doctype/location/test_location.py @@ -9,7 +9,7 @@ from erpnext.tests.utils import ERPNextTestSuite class TestLocation(ERPNextTestSuite): - def runTest(self): + def test_location_features(self): locations = ["Basil Farm", "Division 1", "Field 1", "Block 1"] area = 0 formatted_locations = [] From e3e4dae3bb9d5445d96ac44a962045154a6f5f7e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 3 Mar 2026 08:25:42 +0530 Subject: [PATCH 193/217] refactor(test): make sales invoice deterministic --- .../doctype/sales_invoice/test_sales_invoice.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 7a62a22f06b..3616f196bb7 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -2127,16 +2127,19 @@ class TestSalesInvoice(ERPNextTestSuite): @ERPNextTestSuite.change_settings("Selling Settings", {"sales_update_frequency": "Each Transaction"}) def test_company_monthly_sales(self): - existing_current_month_sales = frappe.get_cached_value( - "Company", "_Test Company", "total_monthly_sales" - ) + from erpnext.setup.doctype.company.company import update_company_current_month_sales + + company = "_Test Company" + + update_company_current_month_sales(company) + existing_current_month_sales = frappe.db.get_value("Company", company, "total_monthly_sales") si = create_sales_invoice() - current_month_sales = frappe.get_cached_value("Company", "_Test Company", "total_monthly_sales") + current_month_sales = frappe.db.get_value("Company", company, "total_monthly_sales") self.assertEqual(current_month_sales, existing_current_month_sales + si.base_grand_total) si.cancel() - current_month_sales = frappe.get_cached_value("Company", "_Test Company", "total_monthly_sales") + current_month_sales = frappe.db.get_value("Company", company, "total_monthly_sales") self.assertEqual(current_month_sales, existing_current_month_sales) def test_rounding_adjustment(self): From 37d69781902682e2f1e6432b815c013cc422ceaa Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 4 Mar 2026 21:31:10 +0530 Subject: [PATCH 194/217] refactor(test): make purchase order deterministic --- erpnext/buying/doctype/purchase_order/test_purchase_order.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index fefa8717bd5..fe4bb12c3db 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -787,6 +787,7 @@ class TestPurchaseOrder(ERPNextTestSuite): Test "Advance Paid" on Purchase Order, when "Book Advance Payments in Separate Party Account" is enabled and the payment entry linked to the Order is allocated to Purchase Invoice. """ + frappe.flags.is_reverse_depr_entry = False supplier = "_Test Supplier" company = "_Test Company" @@ -818,6 +819,7 @@ class TestPurchaseOrder(ERPNextTestSuite): def test_advance_paid_upon_payment_entry_cancellation(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry + frappe.flags.is_reverse_depr_entry = False supplier = "_Test Supplier USD" company = "_Test Company" @@ -1181,6 +1183,7 @@ class TestPurchaseOrder(ERPNextTestSuite): self.assertTrue(frappe.db.get_value("Subcontracting Order", {"purchase_order": po.name})) def test_purchase_order_advance_payment_status(self): + frappe.flags.is_reverse_depr_entry = False from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request @@ -1334,6 +1337,7 @@ class TestPurchaseOrder(ERPNextTestSuite): self.assertEqual(pi.items[0].qty, 50) def test_multiple_advances_against_purchase_order_are_allocated_across_partial_purchase_invoices(self): + frappe.flags.is_reverse_depr_entry = False # step - 1: create PO po = create_purchase_order(qty=10, rate=10) From 1c9634806461b2f636675b8a7527ca2fb61caa7e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 18 Mar 2026 20:48:07 +0530 Subject: [PATCH 195/217] refactor(test): make item wise sales register deterministic --- .../test_item_wise_sales_register.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py index d982af3e996..689edeac1c4 100644 --- a/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py @@ -76,9 +76,13 @@ class TestItemWiseSalesRegister(AccountsTestMixin, ERPNextTestSuite): self.assertDictEqual(report_output, expected_result) def test_grouped_report_handles_different_tax_descriptions(self): - self.create_item(item_name="_Test Item Tax Description A") + self.create_item( + item_name="_Test Item Tax Description A", company="_Test Company", warehouse="Stores - _TC" + ) first_item = self.item - self.create_item(item_name="_Test Item Tax Description B") + self.create_item( + item_name="_Test Item Tax Description B", company="_Test Company", warehouse="Stores - _TC" + ) second_item = self.item first_tax_description = "Tax Description A" From 3f35db5db12c7029e25dd4b4d78e4c93f01af69f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 18 Mar 2026 20:50:37 +0530 Subject: [PATCH 196/217] refactor(test): make pick list deterministic --- erpnext/stock/doctype/pick_list/test_pick_list.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py index e6c94d12418..283e0207d60 100644 --- a/erpnext/stock/doctype/pick_list/test_pick_list.py +++ b/erpnext/stock/doctype/pick_list/test_pick_list.py @@ -278,7 +278,12 @@ class TestPickList(ERPNextTestSuite): from erpnext.stock.doctype.batch.test_batch import make_new_batch batch_company = frappe.get_doc( - {"doctype": "Company", "company_name": "Batch Company", "default_currency": "INR"} + { + "doctype": "Company", + "company_name": "Batch Company", + "default_currency": "INR", + "country": "India", + } ) batch_company.insert() @@ -349,7 +354,12 @@ class TestPickList(ERPNextTestSuite): warehouse_item = create_item("Warehouse Item") temp_company = frappe.get_doc( - {"doctype": "Company", "company_name": "Temp Company", "default_currency": "INR"} + { + "doctype": "Company", + "company_name": "Temp Company", + "default_currency": "INR", + "country": "India", + } ).insert() temp_warehouse = frappe.get_doc( {"doctype": "Warehouse", "warehouse_name": "Temp Warehouse", "company": temp_company.name} From 08ee50a902c7b4ab6621c012d1010882d810343b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 18 Mar 2026 20:55:18 +0530 Subject: [PATCH 197/217] refactor(test): cleanup; remove redundant attribute --- erpnext/tests/utils.py | 96 +++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 0c4e693fa6f..551fe8017aa 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -276,7 +276,7 @@ class BootStrapTestData: stock_settings.enable_serial_and_batch_no_for_item = 1 stock_settings.save() - def make_records(self, key, records, attr): + def make_records(self, key, records): doctype = records[0].get("doctype") def get_filters(record): @@ -358,9 +358,7 @@ class BootStrapTestData: "selling": 0, }, ] - self.make_records( - ["price_list_name", "enabled", "selling", "buying", "currency"], records, "price_list" - ) + self.make_records(["price_list_name", "enabled", "selling", "buying", "currency"], records) def make_monthly_distribution(self): records = [ @@ -384,7 +382,7 @@ class BootStrapTestData: ], } ] - self.make_records(["distribution_id"], records, "monthly_distribution") + self.make_records(["distribution_id"], records) def make_projects(self): records = [ @@ -395,7 +393,7 @@ class BootStrapTestData: "status": "Open", } ] - self.make_records(["project_name"], records, "projects") + self.make_records(["project_name"], records) def make_customer_group(self): records = [ @@ -412,7 +410,7 @@ class BootStrapTestData: "parent_customer_group": "All Customer Groups", }, ] - self.make_records(["customer_group_name"], records, "customer_group") + self.make_records(["customer_group_name"], records) def make_territory(self): records = [ @@ -447,7 +445,7 @@ class BootStrapTestData: "territory_name": "_Test Territory United States", }, ] - self.make_records(["territory_name"], records, "territories") + self.make_records(["territory_name"], records) def make_department(self): records = [ @@ -464,7 +462,7 @@ class BootStrapTestData: "parent_department": "All Departments", }, ] - self.make_records(["department_name"], records, "department") + self.make_records(["department_name"], records) def make_role(self): records = [ @@ -474,7 +472,7 @@ class BootStrapTestData: {"doctype": "Role", "role_name": "_Test Role 4", "desk_access": 0}, {"doctype": "Role", "role_name": "Technician"}, ] - self.make_records(["role_name"], records, "roles") + self.make_records(["role_name"], records) def make_user(self): records = [ @@ -571,7 +569,7 @@ class BootStrapTestData: "roles": [{"doctype": "Has Role", "role": "Technician"}], }, ] - self.make_records(["email"], records, "users") + self.make_records(["email"], records) def make_employees(self): records = [ @@ -612,7 +610,7 @@ class BootStrapTestData: "user_id": "test2@example.com", }, ] - self.make_records(["first_name"], records, "employees") + self.make_records(["first_name"], records) def make_sales_person(self): records = [ @@ -638,7 +636,7 @@ class BootStrapTestData: "sales_person_name": "_Test Sales Person 2", }, ] - self.make_records(["sales_person_name"], records, "sales_person") + self.make_records(["sales_person_name"], records) def make_leads(self): records = [ @@ -680,7 +678,7 @@ class BootStrapTestData: "naming_series": "_T-Lead-", }, ] - self.make_records(["email_id"], records, "leads") + self.make_records(["email_id"], records) def make_holiday_list(self): records = [ @@ -696,11 +694,11 @@ class BootStrapTestData: "holiday_list_name": "_Test Holiday List", } ] - self.make_records(["holiday_list_name"], records, "holiday_list") + self.make_records(["holiday_list_name"], records) def make_company(self): records = load_test_records_for("Company")["Company"] - self.make_records(["company_name"], records, "companies") + self.make_records(["company_name"], records) def make_fiscal_year(self): records = [ @@ -726,7 +724,7 @@ class BootStrapTestData: ) key = ["year_start_date", "year_end_date"] - self.make_records(key, records, "fiscal_year") + self.make_records(key, records) def make_payment_term(self): records = [ @@ -763,7 +761,7 @@ class BootStrapTestData: "credit_days": 30, }, ] - self.make_records(["payment_term_name"], records, "payment_terms") + self.make_records(["payment_term_name"], records) def make_payment_terms_template(self): records = [ @@ -826,7 +824,7 @@ class BootStrapTestData: "template_name": "_Test Payment Term Template 3", }, ] - self.make_records(["template_name"], records, "payment_terms_template") + self.make_records(["template_name"], records) def make_tax_category(self): records = [ @@ -834,7 +832,7 @@ class BootStrapTestData: {"doctype": "Tax Category", "name": "_Test Tax Category 2", "title": "_Test Tax Category 2"}, {"doctype": "Tax Category", "name": "_Test Tax Category 3", "title": "_Test Tax Category 3"}, ] - self.make_records(["title"], records, "tax_category") + self.make_records(["title"], records) def make_account(self): records = [ @@ -858,7 +856,7 @@ class BootStrapTestData: "company": "_Test Company with perpetual inventory", }, ] - self.make_records(["account_name", "company"], records, "accounts") + self.make_records(["account_name", "company"], records) def make_supplier(self): records = [ @@ -917,7 +915,7 @@ class BootStrapTestData: "companies": [{"company": "_Test Company with perpetual inventory"}], }, ] - self.make_records(["supplier_name"], records, "suppliers") + self.make_records(["supplier_name"], records) def make_supplier_group(self): records = [ @@ -927,7 +925,7 @@ class BootStrapTestData: "parent_supplier_group": "All Supplier Groups", } ] - self.make_records(["supplier_group_name"], records, "supplier_groups") + self.make_records(["supplier_group_name"], records) def make_cost_center(self): records = [ @@ -953,7 +951,7 @@ class BootStrapTestData: "parent_cost_center": "_Test Company - _TC", }, ] - self.make_records(["cost_center_name", "company"], records, "cost_center") + self.make_records(["cost_center_name", "company"], records) def make_location(self): records = [ @@ -996,7 +994,7 @@ class BootStrapTestData: "is_container": 1, }, ] - self.make_records(["location_name"], records, "location") + self.make_records(["location_name"], records) def make_warehouse(self): records = [ @@ -1075,14 +1073,14 @@ class BootStrapTestData: "is_group": 0, }, ] - self.make_records(["warehouse_name", "company"], records, "warehouse") + self.make_records(["warehouse_name", "company"], records) def make_uom(self): records = [ {"doctype": "UOM", "must_be_whole_number": 1, "uom_name": "_Test UOM"}, {"doctype": "UOM", "uom_name": "_Test UOM 1"}, ] - self.make_records(["uom_name"], records, "uom") + self.make_records(["uom_name"], records) def make_item_attribute(self): records = [ @@ -1110,7 +1108,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["attribute_name"], records, "item_attribute") + self.make_records(["attribute_name"], records) def make_item_tax_template(self): records = [ @@ -1192,7 +1190,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["title", "company"], records, "item_tax_template") + self.make_records(["title", "company"], records) def make_item_group(self): records = [ @@ -1305,7 +1303,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["item_group_name"], records, "item_group") + self.make_records(["item_group_name"], records) def make_item(self): records = [ @@ -1899,7 +1897,7 @@ class BootStrapTestData: "company": "_Test Company", }, ] - self.make_records(["item_code", "item_name"], records, "item") + self.make_records(["item_code", "item_name"], records) def make_product_bundle(self): records = [ @@ -1922,7 +1920,7 @@ class BootStrapTestData: ], } ] - self.make_records(["new_item_code"], records, "product_bundle") + self.make_records(["new_item_code"], records) def make_test_account(self): records = [ @@ -2085,7 +2083,7 @@ class BootStrapTestData: "territory": "_Test Territory", }, ] - self.make_records(["customer_name"], records, "customer") + self.make_records(["customer_name"], records) def make_shareholder(self): records = [ @@ -2098,7 +2096,7 @@ class BootStrapTestData: {"doctype": "Shareholder", "naming_series": "SH-", "title": "Thor", "company": "_Test Company"}, {"doctype": "Shareholder", "naming_series": "SH-", "title": "Hulk", "company": "_Test Company"}, ] - self.make_records(["title", "company"], records, "shareholder") + self.make_records(["title", "company"], records) def make_sales_taxes_template(self): records = [ @@ -2314,7 +2312,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["title", "company"], records, "sales_taxes_and_template") + self.make_records(["title", "company"], records) def make_asset_category(self): records = [ @@ -2355,7 +2353,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["asset_category_name"], records, "asset_category") + self.make_records(["asset_category_name"], records) def make_asset_maintenance_team(self): records = [ @@ -2383,7 +2381,7 @@ class BootStrapTestData: ], } ] - self.make_records(["maintenance_team_name"], records, "asset_maintenance_team") + self.make_records(["maintenance_team_name"], records) def make_activity_type(self): records = [ @@ -2398,7 +2396,7 @@ class BootStrapTestData: "activity_type": "_Test Activity Type 1", }, ] - self.make_records(["activity_type"], records, "activity_type") + self.make_records(["activity_type"], records) def make_loyalty_program(self): records = [ @@ -2433,7 +2431,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["loyalty_program_name"], records, "loyalty_program") + self.make_records(["loyalty_program_name"], records) def make_item_price(self): records = [ @@ -2504,13 +2502,13 @@ class BootStrapTestData: "price_list_rate": 10000, }, ] - self.make_records(["item_code", "price_list", "price_list_rate"], records, "item_price") + self.make_records(["item_code", "price_list", "price_list_rate"], records) def make_operation(self): records = [ {"doctype": "Operation", "name": "_Test Operation 1", "workstation": "_Test Workstation 1"} ] - self.make_records(["name"], records, "operation") + self.make_records(["name"], records) def make_workstation(self): records = [ @@ -2527,16 +2525,16 @@ class BootStrapTestData: "working_hours": [{"start_time": "10:00:00", "end_time": "20:00:00"}], } ] - self.make_records(["workstation_name"], records, "workstation") + self.make_records(["workstation_name"], records) def make_bom(self): # TODO: replace JSON source with hardcoded data records = load_test_records_for("BOM")["BOM"] - self.make_records(["item", "company"], records, "bom") + self.make_records(["item", "company"], records) def make_quality_inspection_param(self): records = [{"doctype": "Quality Inspection Parameter", "parameter": "_Test Param"}] - self.make_records(["parameter"], records, "quality_inspection_param") + self.make_records(["parameter"], records) def make_quality_inspection_template(self): records = [ @@ -2552,7 +2550,7 @@ class BootStrapTestData: ], } ] - self.make_records(["quality_inspection_template_name"], records, "quality_inspection_template") + self.make_records(["quality_inspection_template_name"], records) def make_brand(self): records = [ @@ -2571,7 +2569,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["brand"], records, "brand") + self.make_records(["brand"], records) def make_dunning_type(self): records = [ @@ -2610,7 +2608,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["dunning_type"], records, "dunning_type") + self.make_records(["dunning_type"], records) def make_finance_book(self): records = [ @@ -2627,7 +2625,7 @@ class BootStrapTestData: "finance_book_name": "Test Finance Book 3", }, ] - self.make_records(["finance_book_name"], records, "finance_book") + self.make_records(["finance_book_name"], records) def make_custom_doctype(self): if not frappe.db.exists("DocType", "Shelf"): @@ -2794,7 +2792,7 @@ class BootStrapTestData: ], }, ] - self.make_records(["address_title", "address_type"], records, "address") + self.make_records(["address_title", "address_type"], records) BootStrapTestData() From 35f6bc5d30bf88b257e76ce2d988b39aaed4f4f4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 19 Mar 2026 06:33:52 +0530 Subject: [PATCH 198/217] refactor(test): remove all remaining reference to integration test --- erpnext/crm/doctype/lead/test_lead.py | 1 - erpnext/crm/doctype/opportunity/test_opportunity.py | 1 - erpnext/projects/doctype/activity_cost/test_activity_cost.py | 1 - erpnext/projects/doctype/project/test_project.py | 1 - erpnext/projects/doctype/task/test_task.py | 1 - 5 files changed, 5 deletions(-) diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py index 91287166cee..5da10ff9ea2 100644 --- a/erpnext/crm/doctype/lead/test_lead.py +++ b/erpnext/crm/doctype/lead/test_lead.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import random_string, today from erpnext.crm.doctype.lead.lead import make_opportunity diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index 3d254daaa4b..caf94a044cb 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime, random_string, today from erpnext.crm.doctype.lead.lead import make_customer diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py index 2859f6d2952..73736e305b4 100644 --- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py +++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.projects.doctype.activity_cost.activity_cost import DuplicationError from erpnext.tests.utils import ERPNextTestSuite diff --git a/erpnext/projects/doctype/project/test_project.py b/erpnext/projects/doctype/project/test_project.py index 174d610a5bd..aa37c34ef89 100644 --- a/erpnext/projects/doctype/project/test_project.py +++ b/erpnext/projects/doctype/project/test_project.py @@ -2,7 +2,6 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, nowdate from erpnext.projects.doctype.project_template.test_project_template import make_project_template diff --git a/erpnext/projects/doctype/task/test_task.py b/erpnext/projects/doctype/task/test_task.py index bbb821af86b..0d02fa9c9fb 100644 --- a/erpnext/projects/doctype/task/test_task.py +++ b/erpnext/projects/doctype/task/test_task.py @@ -2,7 +2,6 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, nowdate from erpnext.projects.doctype.task.task import CircularReferenceError, ParentIsGroupError From a94bf6db060a55680a590c5e72870579f8eacc35 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 12:57:45 +0530 Subject: [PATCH 199/217] fix(payment_schedule): using `show_alert` instead of `msgprint` for non-selection of payment schedule (backport #53623) (#53631) Co-authored-by: diptanilsaha fix(payment_schedule): using `show_alert` instead of `msgprint` for non-selection of payment schedule (#53623) --- erpnext/public/js/controllers/transaction.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 4a6ae04dac7..1100ab7a581 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -516,7 +516,10 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe const selected = values.payment_schedules.filter((r) => r.__checked); if (!selected.length) { - frappe.msgprint(__("Please select at least one schedule.")); + frappe.show_alert({ + message: __("Please select at least one schedule."), + indicator: "orange", + }); return; } console.log(selected); From 48e8944a867f39f459ff2324407df3530bb56efa Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 07:42:44 +0000 Subject: [PATCH 200/217] fix(stock): fix email error message (backport #53606) (#53633) Co-authored-by: Sudharsanan Ashok <135326972+Sudharsanan11@users.noreply.github.com> fix(stock): fix email error message (#53606) --- erpnext/stock/reorder_item.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index 4e820c88d9b..3b99992df9c 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -7,7 +7,7 @@ from math import ceil import frappe from frappe import _ -from frappe.utils import add_days, cint, flt, nowdate +from frappe.utils import add_days, cint, escape_html, flt, nowdate import erpnext @@ -223,15 +223,6 @@ def create_material_request(material_requests): mr_list = [] exceptions_list = [] - def _log_exception(mr): - if frappe.local.message_log: - exceptions_list.extend(frappe.local.message_log) - frappe.local.message_log = [] - else: - exceptions_list.append(frappe.get_traceback(with_context=True)) - - mr.log_error("Unable to create material request") - company_wise_mr = frappe._dict({}) for request_type in material_requests: for company in material_requests[request_type]: @@ -305,8 +296,9 @@ def create_material_request(material_requests): company_wise_mr.setdefault(company, []).append(mr) - except Exception: - _log_exception(mr) + except Exception as exception: + exceptions_list.append(exception) + mr.log_error("Unable to create material request") if company_wise_mr: if getattr(frappe.local, "reorder_email_notify", None) is None: @@ -391,10 +383,7 @@ def notify_errors(exceptions_list): for exception in exceptions_list: try: - exception = json.loads(exception) - error_message = """
{}

""".format( - _(exception.get("message")) - ) + error_message = f"
{escape_html(str(exception))}

" content += error_message except Exception: pass From c38b252289b46d6cc48667fe4b5fced7bbe3dd55 Mon Sep 17 00:00:00 2001 From: nishkagosalia Date: Thu, 19 Mar 2026 16:21:40 +0530 Subject: [PATCH 201/217] fix: Adding validation for operation time in BOM (cherry picked from commit 7f70e62c30d3939b975b40f956bbeccc81a16fa9) # Conflicts: # erpnext/manufacturing/doctype/job_card/test_job_card.py --- erpnext/manufacturing/doctype/bom/bom.py | 6 + erpnext/manufacturing/doctype/bom/test_bom.py | 9 + .../doctype/job_card/test_job_card.py | 193 ++++++++++++++++++ 3 files changed, 208 insertions(+) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index ceb2e9d0ffd..efcbc5fa9b9 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -1204,6 +1204,12 @@ class BOM(WebsiteGenerator): "Row {0}: Workstation or Workstation Type is mandatory for an operation {1}" ).format(d.idx, d.operation) ) + if not d.time_in_mins or d.time_in_mins <= 0: + frappe.throw( + _("Row {0}: Operation time should be greater than 0 for operation {1}").format( + d.idx, d.operation + ) + ) def get_tree_representation(self) -> BOMTree: """Get a complete tree representation preserving order of child items.""" diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index 69b55e6d1d8..68a29d7da4e 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -133,6 +133,15 @@ class TestBOM(ERPNextTestSuite): self.assertAlmostEqual(bom.base_raw_material_cost, base_raw_material_cost) self.assertAlmostEqual(bom.base_total_cost, base_raw_material_cost + base_op_cost) + @timeout + def test_bom_no_operation_time_validation(self): + bom = frappe.copy_doc(self.globalTestRecords["BOM"][2]) + bom.docstatus = 0 + for op_row in bom.operations: + op_row.time_in_mins = 0 + + self.assertRaises(frappe.ValidationError, bom.save) + @timeout def test_bom_cost_with_batch_size(self): bom = frappe.copy_doc(self.globalTestRecords["BOM"][2]) diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index cb05acb9433..8d5c792f483 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -96,6 +96,7 @@ class TestJobCard(ERPNextTestSuite): "workstation": "_Test Workstation 1", "bom_no": cut_bom, "skip_material_transfer": 1, + "time_in_mins": 60, }, ) final_bom.append( @@ -105,6 +106,7 @@ class TestJobCard(ERPNextTestSuite): "workstation": "_Test Workstation 1", "bom_no": stitch_bom, "skip_material_transfer": 1, + "time_in_mins": 60, }, ) final_bom.append( @@ -115,6 +117,7 @@ class TestJobCard(ERPNextTestSuite): "is_final_finished_good": 1, "bom_no": final_bom.name, "skip_material_transfer": 1, + "time_in_mins": 60, }, ) final_bom.append("items", {"item_code": stitch_fg.name, "qty": 1, "operation_row_id": 3}) @@ -879,6 +882,196 @@ class TestJobCard(ERPNextTestSuite): s = frappe.get_doc(make_stock_entry_for_wo(wo_doc.name, "Manufacture", 6)) self.assertEqual(s.additional_costs[0].amount, 8) +<<<<<<< HEAD +======= + def test_co_by_product_for_sfg_flow(self): + from erpnext.manufacturing.doctype.operation.test_operation import make_operation + + frappe.db.set_value("UOM", "Nos", "must_be_whole_number", 0) + + def create_bom(raw_material, finished_good, scrap_item, submit=True): + bom = frappe.new_doc("BOM") + bom.company = "_Test Company" + bom.item = finished_good + bom.quantity = 1 + bom.append("items", {"item_code": raw_material, "qty": 1}) + bom.append( + "secondary_items", + { + "item_code": scrap_item, + "qty": 1, + "process_loss_per": 10, + "cost_allocation_per": 5, + "type": "Scrap", + }, + ) + if submit: + bom.insert() + bom.submit() + + return bom + + rm1 = create_item("RM 1") + scrap1 = create_item("Scrap 1") + sfg = create_item("SFG 1") + sfg_bom = create_bom(rm1.name, sfg.name, scrap1.name) + + rm2 = create_item("RM 2") + fg1 = create_item("FG 1") + scrap2 = create_item("Scrap 2") + scrap_extra = create_item("Scrap Extra") + fg_bom = create_bom(rm2.name, fg1.name, scrap2.name, submit=False) + fg_bom.with_operations = 1 + fg_bom.track_semi_finished_goods = 1 + + operation1 = { + "operation": "Test Operation A", + "workstation": "_Test Workstation A", + "finished_good": sfg.name, + "bom_no": sfg_bom.name, + "finished_good_qty": 1, + "sequence_id": 1, + "time_in_mins": 60, + } + operation2 = { + "operation": "Test Operation B", + "workstation": "_Test Workstation A", + "finished_good": fg1.name, + "bom_no": fg_bom.name, + "finished_good_qty": 1, + "is_final_finished_good": 1, + "sequence_id": 2, + "time_in_mins": 60, + } + + make_workstation(operation1) + make_operation(operation1) + make_operation(operation2) + + fg_bom.append("operations", operation1) + fg_bom.append("operations", operation2) + fg_bom.append("items", {"item_code": sfg.name, "qty": 1, "uom": "Nos", "operation_row_id": 2}) + fg_bom.insert() + fg_bom.save() + fg_bom.submit() + + work_order = make_wo_order_test_record( + item=fg1.name, + qty=10, + source_warehouse="Stores - _TC", + fg_warehouse="Finished Goods - _TC", + bom_no=fg_bom.name, + skip_transfer=1, + do_not_save=True, + ) + + work_order.operations[0].time_in_mins = 60 + work_order.operations[1].time_in_mins = 60 + work_order.save() + work_order.submit() + + job_card = frappe.get_doc( + "Job Card", + frappe.db.get_value( + "Job Card", {"work_order": work_order.name, "operation": "Test Operation A"}, "name" + ), + ) + job_card.append( + "time_logs", + { + "from_time": "2009-01-01 12:06:25", + "to_time": "2009-01-01 12:37:25", + "completed_qty": job_card.for_quantity, + }, + ) + job_card.append( + "secondary_items", {"item_code": scrap_extra.name, "stock_qty": 5, "type": "Co-Product"} + ) + job_card.submit() + + for row in sfg_bom.items: + make_stock_entry( + item_code=row.item_code, + target="Stores - _TC", + qty=10, + basic_rate=100, + ) + + manufacturing_entry = frappe.get_doc(job_card.make_stock_entry_for_semi_fg_item()) + manufacturing_entry.submit() + + self.assertEqual(manufacturing_entry.items[2].item_code, scrap1.name) + self.assertEqual(manufacturing_entry.items[2].qty, 9) + self.assertEqual(flt(manufacturing_entry.items[2].basic_rate, 3), 5.556) + self.assertEqual(manufacturing_entry.items[3].item_code, scrap_extra.name) + self.assertEqual(manufacturing_entry.items[3].type, "Co-Product") + self.assertEqual(manufacturing_entry.items[3].qty, 5) + self.assertEqual(manufacturing_entry.items[3].basic_rate, 0) + + job_card = frappe.get_doc( + "Job Card", + frappe.db.get_value( + "Job Card", {"work_order": work_order.name, "operation": "Test Operation B"}, "name" + ), + ) + job_card.append( + "time_logs", + { + "from_time": "2009-02-01 12:06:25", + "to_time": "2009-02-01 12:37:25", + "completed_qty": job_card.for_quantity, + }, + ) + job_card.submit() + + for row in fg_bom.items: + make_stock_entry( + item_code=row.item_code, + target="Stores - _TC", + qty=10, + basic_rate=100, + ) + + manufacturing_entry = frappe.get_doc(job_card.make_stock_entry_for_semi_fg_item()) + manufacturing_entry.submit() + + self.assertEqual(manufacturing_entry.items[2].item_code, scrap2.name) + self.assertEqual(manufacturing_entry.items[2].qty, 9) + self.assertEqual(flt(manufacturing_entry.items[2].basic_rate, 3), 5.556) + + def test_secondary_items_without_sfg(self): + for row in frappe.get_doc("BOM", self.work_order.bom_no).items: + make_stock_entry( + item_code=row.item_code, + target="_Test Warehouse - _TC", + qty=10, + basic_rate=100, + ) + + job_card = frappe.get_last_doc("Job Card", {"work_order": self.work_order.name}) + job_card.append("secondary_items", {"item_code": "_Test Item", "stock_qty": 2, "type": "Scrap"}) + job_card.append( + "time_logs", + { + "from_time": "2009-01-01 12:06:25", + "to_time": "2009-01-01 12:37:25", + "completed_qty": job_card.for_quantity, + }, + ) + job_card.save() + job_card.submit() + + from erpnext.manufacturing.doctype.work_order.work_order import ( + make_stock_entry as make_stock_entry_for_wo, + ) + + s = frappe.get_doc(make_stock_entry_for_wo(self.work_order.name, "Manufacture")) + s.submit() + + self.assertEqual(s.items[3].item_code, "_Test Item") + self.assertEqual(s.items[3].transfer_qty, 2) + +>>>>>>> 7f70e62c30 (fix: Adding validation for operation time in BOM) def create_bom_with_multiple_operations(): "Create a BOM with multiple operations and Material Transfer against Job Card" From 7ebed912cfaaacef61e1dccf6bd779775dedfcc0 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:28:01 +0000 Subject: [PATCH 202/217] fix: validate permission before updating status (backport #53651) (#53653) * fix: validate permission before updating status (#53651) (cherry picked from commit 8e17c722fbb2c685d215d7daf309eb856282050c) # Conflicts: # erpnext/buying/doctype/purchase_order/purchase_order.py # erpnext/selling/doctype/sales_order/sales_order.py # erpnext/stock/doctype/purchase_receipt/purchase_receipt.py * chore: resolve conflicts --------- Co-authored-by: diptanilsaha --- erpnext/buying/doctype/purchase_order/purchase_order.py | 2 +- erpnext/selling/doctype/sales_order/sales_order.py | 2 +- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index aaace54db63..22e731a336c 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -889,7 +889,7 @@ def get_list_context(context=None): @frappe.whitelist() def update_status(status, name): - po = frappe.get_lazy_doc("Purchase Order", name) + po = frappe.get_lazy_doc("Purchase Order", name, check_permission="write") po.update_status(status) po.update_delivered_qty_in_sales_order() diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 7918dced389..35ff3c054fd 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -1803,7 +1803,7 @@ def make_work_orders(items, sales_order, company, project=None): @frappe.whitelist() def update_status(status, name): - so = frappe.get_doc("Sales Order", name) + so = frappe.get_doc("Sales Order", name, check_permission="write") so.update_status(status) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 45353633a15..185a06b4ea6 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -1577,7 +1577,7 @@ def make_purchase_return(source_name, target_doc=None): @frappe.whitelist() def update_purchase_receipt_status(docname, status): - pr = frappe.get_lazy_doc("Purchase Receipt", docname) + pr = frappe.get_lazy_doc("Purchase Receipt", docname, check_permission="write") pr.update_status(status) From f1c93d4b98181828e2825b2ef82d733e4f99ad25 Mon Sep 17 00:00:00 2001 From: nishkagosalia Date: Thu, 19 Mar 2026 18:35:07 +0530 Subject: [PATCH 203/217] fix: merge conflict --- .../doctype/job_card/test_job_card.py | 159 ------------------ 1 file changed, 159 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 8d5c792f483..5eca4c3a6ea 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -882,164 +882,6 @@ class TestJobCard(ERPNextTestSuite): s = frappe.get_doc(make_stock_entry_for_wo(wo_doc.name, "Manufacture", 6)) self.assertEqual(s.additional_costs[0].amount, 8) -<<<<<<< HEAD -======= - def test_co_by_product_for_sfg_flow(self): - from erpnext.manufacturing.doctype.operation.test_operation import make_operation - - frappe.db.set_value("UOM", "Nos", "must_be_whole_number", 0) - - def create_bom(raw_material, finished_good, scrap_item, submit=True): - bom = frappe.new_doc("BOM") - bom.company = "_Test Company" - bom.item = finished_good - bom.quantity = 1 - bom.append("items", {"item_code": raw_material, "qty": 1}) - bom.append( - "secondary_items", - { - "item_code": scrap_item, - "qty": 1, - "process_loss_per": 10, - "cost_allocation_per": 5, - "type": "Scrap", - }, - ) - if submit: - bom.insert() - bom.submit() - - return bom - - rm1 = create_item("RM 1") - scrap1 = create_item("Scrap 1") - sfg = create_item("SFG 1") - sfg_bom = create_bom(rm1.name, sfg.name, scrap1.name) - - rm2 = create_item("RM 2") - fg1 = create_item("FG 1") - scrap2 = create_item("Scrap 2") - scrap_extra = create_item("Scrap Extra") - fg_bom = create_bom(rm2.name, fg1.name, scrap2.name, submit=False) - fg_bom.with_operations = 1 - fg_bom.track_semi_finished_goods = 1 - - operation1 = { - "operation": "Test Operation A", - "workstation": "_Test Workstation A", - "finished_good": sfg.name, - "bom_no": sfg_bom.name, - "finished_good_qty": 1, - "sequence_id": 1, - "time_in_mins": 60, - } - operation2 = { - "operation": "Test Operation B", - "workstation": "_Test Workstation A", - "finished_good": fg1.name, - "bom_no": fg_bom.name, - "finished_good_qty": 1, - "is_final_finished_good": 1, - "sequence_id": 2, - "time_in_mins": 60, - } - - make_workstation(operation1) - make_operation(operation1) - make_operation(operation2) - - fg_bom.append("operations", operation1) - fg_bom.append("operations", operation2) - fg_bom.append("items", {"item_code": sfg.name, "qty": 1, "uom": "Nos", "operation_row_id": 2}) - fg_bom.insert() - fg_bom.save() - fg_bom.submit() - - work_order = make_wo_order_test_record( - item=fg1.name, - qty=10, - source_warehouse="Stores - _TC", - fg_warehouse="Finished Goods - _TC", - bom_no=fg_bom.name, - skip_transfer=1, - do_not_save=True, - ) - - work_order.operations[0].time_in_mins = 60 - work_order.operations[1].time_in_mins = 60 - work_order.save() - work_order.submit() - - job_card = frappe.get_doc( - "Job Card", - frappe.db.get_value( - "Job Card", {"work_order": work_order.name, "operation": "Test Operation A"}, "name" - ), - ) - job_card.append( - "time_logs", - { - "from_time": "2009-01-01 12:06:25", - "to_time": "2009-01-01 12:37:25", - "completed_qty": job_card.for_quantity, - }, - ) - job_card.append( - "secondary_items", {"item_code": scrap_extra.name, "stock_qty": 5, "type": "Co-Product"} - ) - job_card.submit() - - for row in sfg_bom.items: - make_stock_entry( - item_code=row.item_code, - target="Stores - _TC", - qty=10, - basic_rate=100, - ) - - manufacturing_entry = frappe.get_doc(job_card.make_stock_entry_for_semi_fg_item()) - manufacturing_entry.submit() - - self.assertEqual(manufacturing_entry.items[2].item_code, scrap1.name) - self.assertEqual(manufacturing_entry.items[2].qty, 9) - self.assertEqual(flt(manufacturing_entry.items[2].basic_rate, 3), 5.556) - self.assertEqual(manufacturing_entry.items[3].item_code, scrap_extra.name) - self.assertEqual(manufacturing_entry.items[3].type, "Co-Product") - self.assertEqual(manufacturing_entry.items[3].qty, 5) - self.assertEqual(manufacturing_entry.items[3].basic_rate, 0) - - job_card = frappe.get_doc( - "Job Card", - frappe.db.get_value( - "Job Card", {"work_order": work_order.name, "operation": "Test Operation B"}, "name" - ), - ) - job_card.append( - "time_logs", - { - "from_time": "2009-02-01 12:06:25", - "to_time": "2009-02-01 12:37:25", - "completed_qty": job_card.for_quantity, - }, - ) - job_card.submit() - - for row in fg_bom.items: - make_stock_entry( - item_code=row.item_code, - target="Stores - _TC", - qty=10, - basic_rate=100, - ) - - manufacturing_entry = frappe.get_doc(job_card.make_stock_entry_for_semi_fg_item()) - manufacturing_entry.submit() - - self.assertEqual(manufacturing_entry.items[2].item_code, scrap2.name) - self.assertEqual(manufacturing_entry.items[2].qty, 9) - self.assertEqual(flt(manufacturing_entry.items[2].basic_rate, 3), 5.556) - - def test_secondary_items_without_sfg(self): for row in frappe.get_doc("BOM", self.work_order.bom_no).items: make_stock_entry( item_code=row.item_code, @@ -1071,7 +913,6 @@ class TestJobCard(ERPNextTestSuite): self.assertEqual(s.items[3].item_code, "_Test Item") self.assertEqual(s.items[3].transfer_qty, 2) ->>>>>>> 7f70e62c30 (fix: Adding validation for operation time in BOM) def create_bom_with_multiple_operations(): "Create a BOM with multiple operations and Material Transfer against Job Card" From aac60b4c134b01224b606d19a85ef81602fc2b79 Mon Sep 17 00:00:00 2001 From: nishkagosalia Date: Thu, 19 Mar 2026 22:05:58 +0530 Subject: [PATCH 204/217] fix: test case --- .../doctype/job_card/test_job_card.py | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 5eca4c3a6ea..556d3911eb3 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -882,37 +882,6 @@ class TestJobCard(ERPNextTestSuite): s = frappe.get_doc(make_stock_entry_for_wo(wo_doc.name, "Manufacture", 6)) self.assertEqual(s.additional_costs[0].amount, 8) - for row in frappe.get_doc("BOM", self.work_order.bom_no).items: - make_stock_entry( - item_code=row.item_code, - target="_Test Warehouse - _TC", - qty=10, - basic_rate=100, - ) - - job_card = frappe.get_last_doc("Job Card", {"work_order": self.work_order.name}) - job_card.append("secondary_items", {"item_code": "_Test Item", "stock_qty": 2, "type": "Scrap"}) - job_card.append( - "time_logs", - { - "from_time": "2009-01-01 12:06:25", - "to_time": "2009-01-01 12:37:25", - "completed_qty": job_card.for_quantity, - }, - ) - job_card.save() - job_card.submit() - - from erpnext.manufacturing.doctype.work_order.work_order import ( - make_stock_entry as make_stock_entry_for_wo, - ) - - s = frappe.get_doc(make_stock_entry_for_wo(self.work_order.name, "Manufacture")) - s.submit() - - self.assertEqual(s.items[3].item_code, "_Test Item") - self.assertEqual(s.items[3].transfer_qty, 2) - def create_bom_with_multiple_operations(): "Create a BOM with multiple operations and Material Transfer against Job Card" From 077f39721a9e56d2b011519506350b7f755ac512 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 14:56:44 +0530 Subject: [PATCH 205/217] fix: do not overwrite expense account in stock entry (backport #53658) (#53661) Co-authored-by: Mihir Kandoi fix: do not overwrite expense account in stock entry (#53658) --- erpnext/stock/doctype/stock_entry/stock_entry.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 728096880d0..4ce2bda3631 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -655,9 +655,6 @@ class StockEntry(StockController, SubcontractingInwardController): if self.purpose == "Subcontracting Delivery": item.expense_account = frappe.get_value("Company", self.company, "default_expense_account") - if self.purpose == "Manufacture": - item.set("expense_account", item_details.get("expense_account")) - def validate_fg_completed_qty(self): if self.purpose != "Manufacture": return From de41abaaf29962df3614fb91d77a657430958a44 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 19 Mar 2026 14:13:56 +0530 Subject: [PATCH 206/217] fix: deadlock issue for SLE (cherry picked from commit f48b03c6ece7916c107ff80e64cf837b986d6f0d) --- erpnext/stock/stock_ledger.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index ae643406982..1e6cec59a5c 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -2046,7 +2046,6 @@ def update_qty_in_future_sle(args, allow_negative_stock=False): where item_code = %(item_code)s and warehouse = %(warehouse)s - and voucher_no != %(voucher_no)s and is_cancelled = 0 and ( posting_datetime > %(posting_datetime)s From f570a4cb5d78503d2bbdf0fd808a5045657a1ae2 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sun, 22 Mar 2026 12:06:43 +0530 Subject: [PATCH 207/217] fix: stock queue for SABB (cherry picked from commit 3fcf308ed80b3f5a1f1fb5a258fa252fe7b10cb0) --- .../serial_and_batch_bundle/serial_and_batch_bundle.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 5ca0bef74fc..45790ed89c4 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -757,11 +757,16 @@ class SerialandBatchBundle(Document): precision = frappe.get_precision("Serial and Batch Entry", "incoming_rate") for d in self.entries: + fifo_batch_wise_val = True + if valuation_method == "FIFO" and d.batch_no in batches: + fifo_batch_wise_val = False + if self.is_rejected and not set_valuation_rate_for_rejected_materials: rate = 0.0 elif ( (flt(d.incoming_rate, precision) == flt(rate, precision)) and not stock_queue + and fifo_batch_wise_val and d.qty and d.stock_value_difference ): From eee1c3626314228173589e68c0f4c22176870e87 Mon Sep 17 00:00:00 2001 From: MochaMind Date: Sun, 22 Mar 2026 19:15:56 +0530 Subject: [PATCH 208/217] chore: update POT file (#53676) --- erpnext/locale/main.pot | 1475 ++++++++++++++++++++------------------- 1 file changed, 760 insertions(+), 715 deletions(-) diff --git a/erpnext/locale/main.pot b/erpnext/locale/main.pot index 1361fc78c39..f627ccf1b41 100644 --- a/erpnext/locale/main.pot +++ b/erpnext/locale/main.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: ERPNext VERSION\n" "Report-Msgid-Bugs-To: hello@frappe.io\n" -"POT-Creation-Date: 2026-03-15 09:45+0000\n" -"PO-Revision-Date: 2026-03-15 09:45+0000\n" +"POT-Creation-Date: 2026-03-22 09:44+0000\n" +"PO-Revision-Date: 2026-03-22 09:44+0000\n" "Last-Translator: hello@frappe.io\n" "Language-Team: hello@frappe.io\n" "MIME-Version: 1.0\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.16.0\n" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1515 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1520 msgid "" "\n" "\t\t\tThe Batch {0} of an item {1} has negative stock in the warehouse {2}{3}.\n" @@ -35,7 +35,7 @@ msgstr "" msgid " Address" msgstr "" -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:604 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:611 msgid " Amount" msgstr "" @@ -72,7 +72,7 @@ msgstr "" msgid " Phantom Item" msgstr "" -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:595 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:602 msgid " Rate" msgstr "" @@ -157,7 +157,7 @@ msgstr "" msgid "% Delivered" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:999 +#: erpnext/manufacturing/doctype/bom/bom.js:1000 #, python-format msgid "% Finished Item Quantity" msgstr "" @@ -172,8 +172,8 @@ msgstr "" msgid "% Occupied" msgstr "" -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:278 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:330 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:283 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:337 msgid "% Of Grand Total" msgstr "" @@ -309,8 +309,8 @@ msgid "'Inspection Required before Purchase' has disabled for the item {0}, no n msgstr "" #: erpnext/stock/report/stock_ledger/stock_ledger.py:665 -#: erpnext/stock/report/stock_ledger/stock_ledger.py:705 -#: erpnext/stock/report/stock_ledger/stock_ledger.py:810 +#: erpnext/stock/report/stock_ledger/stock_ledger.py:706 +#: erpnext/stock/report/stock_ledger/stock_ledger.py:811 msgid "'Opening'" msgstr "" @@ -759,7 +759,7 @@ msgstr "" msgid "" msgstr "" -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:123 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:125 msgid "
  • Clearance date must be after cheque date for row(s): {0}
  • " msgstr "" @@ -771,7 +771,7 @@ msgstr "" msgid "
  • Packed Item {0}: Required {1}, Available {2}
  • " msgstr "" -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:118 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:120 msgid "
  • Payment document required for row(s): {0}
  • " msgstr "" @@ -813,7 +813,7 @@ msgid "" "

    Apart from these, you can access all values in this RFQ, like {{ message_for_supplier }} or {{ terms }}.

    " msgstr "" -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:116 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:118 msgid "

    Please correct the following row(s):

      " msgstr "" @@ -1183,7 +1183,7 @@ msgstr "" #. Label of the qty (Float) field in DocType 'Purchase Receipt Item' #. Label of the qty (Float) field in DocType 'Subcontracting Receipt Item' -#: erpnext/public/js/controllers/transaction.js:2916 +#: erpnext/public/js/controllers/transaction.js:2919 #: erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json #: erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json msgid "Accepted Quantity" @@ -1216,7 +1216,7 @@ msgstr "" msgid "According to CEFACT/ICG/2010/IC013 or CEFACT/ICG/2010/IC010" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:990 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:988 msgid "According to the BOM {0}, the Item '{1}' is missing in the stock entry." msgstr "" @@ -1334,7 +1334,7 @@ msgstr "" msgid "Account Manager" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1009 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1007 #: erpnext/controllers/accounts_controller.py:2380 msgid "Account Missing" msgstr "" @@ -1443,7 +1443,7 @@ msgstr "" msgid "Account is mandatory" msgstr "" -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:46 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:48 msgid "Account is mandatory to get payment entries" msgstr "" @@ -1451,7 +1451,7 @@ msgstr "" msgid "Account is not set for the dashboard chart {0}" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:905 +#: erpnext/assets/doctype/asset/asset.py:903 msgid "Account not Found" msgstr "" @@ -1564,7 +1564,7 @@ msgstr "" msgid "Account: {0} can only be updated via Stock Transactions" msgstr "" -#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2725 +#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2720 msgid "Account: {0} is not permitted under Payment Entry" msgstr "" @@ -1847,14 +1847,14 @@ msgstr "" msgid "Accounting Entries" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:939 -#: erpnext/assets/doctype/asset/asset.py:954 +#: erpnext/assets/doctype/asset/asset.py:937 +#: erpnext/assets/doctype/asset/asset.py:952 #: erpnext/assets/doctype/asset_capitalization/asset_capitalization.py:543 msgid "Accounting Entry for Asset" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1961 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1981 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1959 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1979 msgid "Accounting Entry for LCV in Stock Entry {0}" msgstr "" @@ -1862,7 +1862,7 @@ msgstr "" msgid "Accounting Entry for Landed Cost Voucher for SCR {0}" msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:837 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:840 msgid "Accounting Entry for Service" msgstr "" @@ -1877,14 +1877,14 @@ msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:1490 #: erpnext/controllers/stock_controller.py:727 #: erpnext/controllers/stock_controller.py:744 -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:930 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1906 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1920 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:933 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1904 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1918 #: erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py:708 msgid "Accounting Entry for Stock" msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:734 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:737 msgid "Accounting Entry for {0}" msgstr "" @@ -2453,7 +2453,7 @@ msgstr "" msgid "Actual Qty {0} / Waiting Qty {1}" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.js:179 +#: erpnext/manufacturing/doctype/production_plan/production_plan.js:196 msgid "Actual Qty: Quantity available in the warehouse." msgstr "" @@ -2537,7 +2537,7 @@ msgstr "" msgid "Add Customers" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:92 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:93 #: erpnext/selling/page/point_of_sale/pos_item_cart.js:442 msgid "Add Discount" msgstr "" @@ -2609,7 +2609,7 @@ msgid "Add Quote" msgstr "" #. Label of the add_raw_materials (Button) field in DocType 'BOM Operation' -#: erpnext/manufacturing/doctype/bom/bom.js:1027 +#: erpnext/manufacturing/doctype/bom/bom.js:1028 #: erpnext/manufacturing/doctype/bom_operation/bom_operation.json msgid "Add Raw Materials" msgstr "" @@ -2694,7 +2694,7 @@ msgid "Add details" msgstr "" #: erpnext/stock/doctype/pick_list/pick_list.js:86 -#: erpnext/stock/doctype/pick_list/pick_list.py:870 +#: erpnext/stock/doctype/pick_list/pick_list.py:905 msgid "Add items in the Item Locations table" msgstr "" @@ -2755,7 +2755,7 @@ msgstr "" msgid "Adding Lead to Prospect..." msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:450 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:451 msgid "Additional" msgstr "" @@ -3153,7 +3153,7 @@ msgstr "" msgid "Adjustment Against" msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:662 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:665 msgid "Adjustment based on Purchase Invoice rate" msgstr "" @@ -3326,8 +3326,8 @@ msgstr "" #. Label of the against_account (Text) field in DocType 'Journal Entry Account' #: erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.json #: erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json -#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:39 -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:91 +#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:42 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:95 #: erpnext/accounts/report/general_ledger/general_ledger.py:750 msgid "Against Account" msgstr "" @@ -3343,7 +3343,7 @@ msgstr "" msgid "Against Blanket Order" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1102 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1100 msgid "Against Customer Order {0}" msgstr "" @@ -3670,7 +3670,7 @@ msgstr "" msgid "All Item Groups" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_selector.js:27 +#: erpnext/selling/page/point_of_sale/pos_item_selector.js:29 #: erpnext/selling/page/point_of_sale/pos_item_selector.js:247 msgid "All Items" msgstr "" @@ -3741,11 +3741,11 @@ msgstr "" msgid "All communications including and above this shall be moved into the new Issue" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:965 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:967 msgid "All items are already requested" msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:1423 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:1426 msgid "All items have already been Invoiced/Returned" msgstr "" @@ -3753,19 +3753,19 @@ msgstr "" msgid "All items have already been received" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3113 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3111 msgid "All items have already been transferred for this Work Order." msgstr "" -#: erpnext/public/js/controllers/transaction.js:3025 +#: erpnext/public/js/controllers/transaction.js:3028 msgid "All items in this document already have a linked Quality Inspection." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1241 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1239 msgid "All items must be linked to a Sales Order or Subcontracting Inward Order for this Sales Invoice." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1252 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1250 msgid "All linked Sales Orders must be subcontracted." msgstr "" @@ -3970,7 +3970,7 @@ msgstr "" msgid "Allow Item To Be Added Multiple Times in a Transaction" msgstr "" -#: erpnext/controllers/selling_controller.py:855 +#: erpnext/controllers/selling_controller.py:858 msgid "Allow Item to Be Added Multiple Times in a Transaction" msgstr "" @@ -4013,8 +4013,8 @@ msgstr "" #: erpnext/stock/doctype/item/item.json #: erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json #: erpnext/stock/doctype/stock_settings/stock_settings.json -#: erpnext/stock/doctype/stock_settings/stock_settings.py:201 -#: erpnext/stock/doctype/stock_settings/stock_settings.py:213 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:217 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:229 msgid "Allow Negative Stock" msgstr "" @@ -4316,7 +4316,7 @@ msgstr "" msgid "Allows users to submit Supplier Quotations with zero quantity. Useful when rates are fixed but the quantities are not. Eg. Rate Contracts." msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:1012 +#: erpnext/stock/doctype/pick_list/pick_list.py:1048 msgid "Already Picked" msgstr "" @@ -4352,7 +4352,7 @@ msgstr "" msgid "Alternative Item Name" msgstr "" -#: erpnext/selling/doctype/quotation/quotation.js:378 +#: erpnext/selling/doctype/quotation/quotation.js:380 msgid "Alternative Items" msgstr "" @@ -4508,11 +4508,11 @@ msgstr "" #: erpnext/accounts/doctype/share_transfer/share_transfer.json #: erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html:10 #: erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html:93 -#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:45 +#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:48 #: erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py:79 #: erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py:44 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:268 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:320 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:273 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:327 #: erpnext/accounts/report/payment_ledger/payment_ledger.py:201 #: erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py:111 #: erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py:44 @@ -4537,7 +4537,7 @@ msgstr "" #: erpnext/selling/doctype/quotation/quotation.js:316 #: erpnext/selling/doctype/quotation_item/quotation_item.json #: erpnext/selling/doctype/sales_order_item/sales_order_item.json -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:46 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:52 #: erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py:52 #: erpnext/selling/report/sales_order_analysis/sales_order_analysis.py:290 #: erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py:53 @@ -4746,7 +4746,7 @@ msgstr "" msgid "An error occurred during the update process" msgstr "" -#: erpnext/stock/reorder_item.py:386 +#: erpnext/stock/reorder_item.py:378 msgid "An error occurred for certain Items while creating Material Requests based on Re-order level. Please rectify these issues :" msgstr "" @@ -5238,20 +5238,20 @@ msgstr "" msgid "As there are existing submitted transactions against item {0}, you can not change the value of {1}." msgstr "" -#: erpnext/stock/doctype/stock_settings/stock_settings.py:226 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:242 msgid "As there are reserved stock, you cannot disable {0}." msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1085 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1087 msgid "As there are sufficient Sub Assembly Items, Work Order is not required for Warehouse {0}." msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1825 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1827 msgid "As there are sufficient raw materials, Material Request is not required for Warehouse {0}." msgstr "" -#: erpnext/stock/doctype/stock_settings/stock_settings.py:200 -#: erpnext/stock/doctype/stock_settings/stock_settings.py:212 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:216 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:228 msgid "As {0} is enabled, you can not enable {1}." msgstr "" @@ -5514,7 +5514,7 @@ msgstr "" msgid "Asset Movement Item" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1185 +#: erpnext/assets/doctype/asset/asset.py:1183 msgid "Asset Movement record {0} created" msgstr "" @@ -5660,7 +5660,7 @@ msgstr "" msgid "Asset cancelled" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:734 +#: erpnext/assets/doctype/asset/asset.py:732 msgid "Asset cannot be cancelled, as it is already {0}" msgstr "" @@ -5676,7 +5676,7 @@ msgstr "" msgid "Asset created" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1426 +#: erpnext/assets/doctype/asset/asset.py:1424 msgid "Asset created after being split from Asset {0}" msgstr "" @@ -5704,7 +5704,7 @@ msgstr "" msgid "Asset restored after Asset Capitalization {0} was cancelled" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1524 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1522 msgid "Asset returned" msgstr "" @@ -5716,8 +5716,8 @@ msgstr "" msgid "Asset scrapped via Journal Entry {0}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1524 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1527 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1522 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1525 msgid "Asset sold" msgstr "" @@ -5729,7 +5729,7 @@ msgstr "" msgid "Asset transferred to Location {0}" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1435 +#: erpnext/assets/doctype/asset/asset.py:1433 msgid "Asset updated after being split into Asset {0}" msgstr "" @@ -5848,15 +5848,15 @@ msgstr "" msgid "Associate" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:124 +#: erpnext/stock/doctype/pick_list/pick_list.py:134 msgid "At Row #{0}: The picked quantity {1} for the item {2} is greater than available stock {3} for the batch {4} in the warehouse {5}. Please restock the item." msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:149 +#: erpnext/stock/doctype/pick_list/pick_list.py:159 msgid "At Row #{0}: The picked quantity {1} for the item {2} is greater than available stock {3} in the warehouse {4}." msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1398 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1403 msgid "At Row {0}: In Serial and Batch Bundle {1} must have docstatus as 1 and not 0" msgstr "" @@ -5864,7 +5864,7 @@ msgstr "" msgid "At least one account with exchange gain or loss is required" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1291 +#: erpnext/assets/doctype/asset/asset.py:1289 msgid "At least one asset has to be selected." msgstr "" @@ -5889,7 +5889,7 @@ msgstr "" msgid "At least one of the Selling or Buying must be selected" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:315 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:316 msgid "At least one raw material item must be present in the stock entry for the type {0}" msgstr "" @@ -5897,11 +5897,11 @@ msgstr "" msgid "At least one row is required for a financial report template" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:821 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:819 msgid "At least one warehouse is mandatory" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:723 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:721 msgid "At row #{0}: the Difference Account must not be a Stock type account, please change the Account Type for the account {1} or select a different account" msgstr "" @@ -5909,11 +5909,11 @@ msgstr "" msgid "At row #{0}: the sequence id {1} cannot be less than previous row sequence id {2}" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:734 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:732 msgid "At row #{0}: you have selected the Difference Account {1}, which is a Cost of Goods Sold type account. Please select a different account" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1146 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1151 msgid "At row {0}: Batch No is mandatory for Item {1}" msgstr "" @@ -5921,11 +5921,11 @@ msgstr "" msgid "At row {0}: Parent Row No cannot be set for item {1}" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1131 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1136 msgid "At row {0}: Qty is mandatory for the batch {1}" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1138 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1143 msgid "At row {0}: Serial No is mandatory for Item {1}" msgstr "" @@ -6130,7 +6130,7 @@ msgstr "" msgid "Auto Material Request" msgstr "" -#: erpnext/stock/reorder_item.py:337 +#: erpnext/stock/reorder_item.py:329 msgid "Auto Material Requests Generated" msgstr "" @@ -6405,7 +6405,7 @@ msgstr "" msgid "Available for use date is required" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:954 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:952 msgid "Available quantity is {0}, you need {1}" msgstr "" @@ -6537,7 +6537,7 @@ msgstr "" #: erpnext/selling/doctype/sales_order/sales_order.js:1415 #: erpnext/stock/doctype/material_request/material_request.js:351 #: erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json -#: erpnext/stock/doctype/stock_entry/stock_entry.js:707 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:709 #: erpnext/stock/report/bom_search/bom_search.py:38 #: erpnext/subcontracting/doctype/subcontracting_inward_order_item/subcontracting_inward_order_item.json #: erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js:525 @@ -6551,7 +6551,7 @@ msgstr "" msgid "BOM 1" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1751 +#: erpnext/manufacturing/doctype/bom/bom.py:1757 msgid "BOM 1 {0} and BOM 2 {1} should not be same" msgstr "" @@ -6789,11 +6789,11 @@ msgstr "" msgid "BOM Website Operation" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:2281 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:2279 msgid "BOM and Finished Good Quantity is mandatory for Disassembly" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.js:1341 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:1343 msgid "BOM and Manufacturing Quantity are required" msgstr "" @@ -6804,7 +6804,7 @@ msgid "BOM and Production" msgstr "" #: erpnext/stock/doctype/material_request/material_request.js:386 -#: erpnext/stock/doctype/stock_entry/stock_entry.js:759 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:761 msgid "BOM does not contain any stock item" msgstr "" @@ -6816,15 +6816,15 @@ msgstr "" msgid "BOM recursion: {1} cannot be parent or child of {0}" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1486 +#: erpnext/manufacturing/doctype/bom/bom.py:1492 msgid "BOM {0} does not belong to Item {1}" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1468 +#: erpnext/manufacturing/doctype/bom/bom.py:1474 msgid "BOM {0} must be active" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1471 +#: erpnext/manufacturing/doctype/bom/bom.py:1477 msgid "BOM {0} must be submitted" msgstr "" @@ -7235,7 +7235,7 @@ msgstr "" msgid "Bank Statement Import" msgstr "" -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:40 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:44 msgid "Bank Statement balance as per General Ledger" msgstr "" @@ -7280,7 +7280,7 @@ msgstr "" msgid "Bank Transaction {0} updated" msgstr "" -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:575 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:584 msgid "Bank account cannot be named as {0}" msgstr "" @@ -7558,7 +7558,7 @@ msgstr "" #: erpnext/manufacturing/doctype/job_card/job_card.json #: erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.js:89 #: erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py:115 -#: erpnext/public/js/controllers/transaction.js:2942 +#: erpnext/public/js/controllers/transaction.js:2945 #: erpnext/public/js/utils/barcode_scanner.js:281 #: erpnext/public/js/utils/serial_no_batch_selector.js:438 #: erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -7589,11 +7589,11 @@ msgstr "" msgid "Batch No" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1149 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1154 msgid "Batch No is mandatory" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:3368 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:3397 msgid "Batch No {0} does not exists" msgstr "" @@ -7616,7 +7616,7 @@ msgstr "" msgid "Batch Nos" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1933 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1938 msgid "Batch Nos are created successfully" msgstr "" @@ -7682,12 +7682,12 @@ msgstr "" msgid "Batch {0} is not available in warehouse {1}" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3290 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3288 #: erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py:290 msgid "Batch {0} of Item {1} has expired." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3296 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3294 msgid "Batch {0} of Item {1} is disabled." msgstr "" @@ -7754,10 +7754,10 @@ msgstr "" #. Label of a Card Break in the Manufacturing Workspace #. Label of a Link in the Manufacturing Workspace #. Label of a Workspace Sidebar Item -#: erpnext/manufacturing/doctype/bom/bom.py:1318 +#: erpnext/manufacturing/doctype/bom/bom.py:1324 #: erpnext/manufacturing/workspace/manufacturing/manufacturing.json #: erpnext/stock/doctype/material_request/material_request.js:139 -#: erpnext/stock/doctype/stock_entry/stock_entry.js:693 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:695 #: erpnext/workspace_sidebar/subcontracting.json msgid "Bill of Materials" msgstr "" @@ -8461,7 +8461,7 @@ msgstr "" msgid "Buildings" msgstr "" -#: erpnext/utilities/doctype/rename_tool/rename_tool.js:70 +#: erpnext/utilities/doctype/rename_tool/rename_tool.js:71 msgid "Bulk Rename Jobs" msgstr "" @@ -8720,7 +8720,7 @@ msgstr "" msgid "Calculated Amount" msgstr "" -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:53 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:57 msgid "Calculated Bank Statement balance" msgstr "" @@ -8817,7 +8817,7 @@ msgstr "" msgid "Call Summary" msgstr "" -#: erpnext/public/js/call_popup/call_popup.js:186 +#: erpnext/public/js/call_popup/call_popup.js:187 msgid "Call Summary Saved" msgstr "" @@ -8900,7 +8900,7 @@ msgstr "" msgid "Can be approved by {0}" msgstr "" -#: erpnext/manufacturing/doctype/work_order/work_order.py:2524 +#: erpnext/manufacturing/doctype/work_order/work_order.py:2529 msgid "Can not close Work Order. Since {0} Job Cards are in Work In Progress state." msgstr "" @@ -8929,7 +8929,7 @@ msgid "Can not filter based on Voucher No, if grouped by Voucher" msgstr "" #: erpnext/accounts/doctype/journal_entry/journal_entry.py:1384 -#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2879 +#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2874 msgid "Can only make payment against unbilled {0}" msgstr "" @@ -8940,7 +8940,7 @@ msgid "Can refer row only if the charge type is 'On Previous Row Amount' or 'Pre msgstr "" #: erpnext/setup/doctype/company/company.py:207 -#: erpnext/stock/doctype/stock_settings/stock_settings.py:167 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:183 msgid "Can't change the valuation method, as there are transactions against some items which do not have its own valuation method" msgstr "" @@ -9055,11 +9055,11 @@ msgstr "" msgid "Cannot cancel this document as it is linked with the submitted Asset Value Adjustment {0}. Please cancel the Asset Value Adjustment to continue." msgstr "" -#: erpnext/controllers/buying_controller.py:1139 +#: erpnext/controllers/buying_controller.py:1136 msgid "Cannot cancel this document as it is linked with the submitted asset {asset_link}. Please cancel the asset to continue." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:495 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:496 msgid "Cannot cancel transaction for Completed Work Order." msgstr "" @@ -9103,12 +9103,12 @@ msgstr "" msgid "Cannot covert to Group because Account Type is selected." msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:1011 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:1014 msgid "Cannot create Stock Reservation Entries for future dated Purchase Receipts." msgstr "" -#: erpnext/selling/doctype/sales_order/sales_order.py:1890 -#: erpnext/stock/doctype/pick_list/pick_list.py:219 +#: erpnext/selling/doctype/sales_order/sales_order.py:1886 +#: erpnext/stock/doctype/pick_list/pick_list.py:254 msgid "Cannot create a pick list for Sales Order {0} because it has reserved stock. Please unreserve the stock in order to create a pick list." msgstr "" @@ -9154,7 +9154,7 @@ msgstr "" msgid "Cannot delete virtual DocType: {0}. Virtual DocTypes do not have database tables." msgstr "" -#: erpnext/stock/doctype/stock_settings/stock_settings.py:132 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:148 msgid "Cannot disable Serial and Batch No for Item, as there are existing records for serial / batch." msgstr "" @@ -9162,6 +9162,10 @@ msgstr "" msgid "Cannot disable perpetual inventory, as there are existing Stock Ledger Entries for the company {0}. Please cancel the stock transactions first and try again." msgstr "" +#: erpnext/stock/doctype/stock_settings/stock_settings.py:129 +msgid "Cannot disable {0} as it may lead to incorrect stock valuation." +msgstr "" + #: erpnext/manufacturing/doctype/work_order/work_order.py:711 msgid "Cannot disassemble more than produced quantity." msgstr "" @@ -9646,7 +9650,7 @@ msgstr "" msgid "Change in Stock Value" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1028 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1026 msgid "Change the account type to Receivable or select a different account." msgstr "" @@ -9660,7 +9664,7 @@ msgstr "" msgid "Changed customer name to '{}' as '{}' already exists." msgstr "" -#: erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js:155 +#: erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js:156 msgid "Changes in {0}" msgstr "" @@ -9694,11 +9698,11 @@ msgstr "" msgid "Charges Incurred" msgstr "" -#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:9 +#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:24 msgid "Charges are updated in Purchase Receipt against each item" msgstr "" -#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:9 +#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:18 msgid "Charges will be distributed proportionately based on item qty or amount, as per your selection" msgstr "" @@ -9814,7 +9818,7 @@ msgstr "" msgid "Checking this will round off the tax amount to the nearest integer" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:92 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:108 #: erpnext/selling/page/point_of_sale/pos_item_cart.js:148 msgid "Checkout" msgstr "" @@ -9865,13 +9869,13 @@ msgstr "" #. Label of the reference_date (Date) field in DocType 'Payment Entry' #: erpnext/accounts/doctype/payment_entry/payment_entry.json -#: erpnext/public/js/controllers/transaction.js:2853 +#: erpnext/public/js/controllers/transaction.js:2856 msgid "Cheque/Reference Date" msgstr "" #. Label of the reference_no (Data) field in DocType 'Payment Entry' #: erpnext/accounts/doctype/payment_entry/payment_entry.json -#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:36 +#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:39 msgid "Cheque/Reference No" msgstr "" @@ -9886,7 +9890,7 @@ msgid "Cheques and Deposits Incorrectly cleared" msgstr "" #: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js:50 -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:50 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:54 msgid "Cheques and Deposits incorrectly cleared" msgstr "" @@ -9919,7 +9923,7 @@ msgstr "" #. Label of the child_row_reference (Data) field in DocType 'Quality #. Inspection' -#: erpnext/public/js/controllers/transaction.js:2948 +#: erpnext/public/js/controllers/transaction.js:2951 #: erpnext/stock/doctype/quality_inspection/quality_inspection.json msgid "Child Row Reference" msgstr "" @@ -9972,10 +9976,12 @@ msgstr "" msgid "Clauses and Conditions" msgstr "" -#. Label of a standard navbar item -#. Type: Action -#: erpnext/hooks.py erpnext/public/js/utils/demo.js:5 -msgid "Clear Demo Data" +#: erpnext/public/js/utils/barcode_scanner.js:493 +msgid "Clear Last Scanned Warehouse" +msgstr "" + +#: erpnext/selling/page/point_of_sale/pos_item_selector.js:264 +msgid "Clear Link" msgstr "" #. Label of the clear_notifications_status (Select) field in DocType @@ -10002,24 +10008,24 @@ msgstr "" #: erpnext/accounts/doctype/payment_entry/payment_entry.json #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json #: erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json -#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:37 +#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:40 #: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html:28 -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:98 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:102 #: erpnext/accounts/report/cheques_and_deposits_incorrectly_cleared/cheques_and_deposits_incorrectly_cleared.py:152 #: erpnext/templates/form_grid/bank_reconciliation_grid.html:7 msgid "Clearance Date" msgstr "" -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:132 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:134 msgid "Clearance Date not mentioned" msgstr "" -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:177 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:179 msgid "Clearance Date updated" msgstr "" -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:156 -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:171 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:158 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:173 msgid "Clearance date changed from {0} to {1} via Bank Clearance Tool" msgstr "" @@ -10089,7 +10095,7 @@ msgstr "" msgid "Closed Documents" msgstr "" -#: erpnext/manufacturing/doctype/work_order/work_order.py:2447 +#: erpnext/manufacturing/doctype/work_order/work_order.py:2452 msgid "Closed Work Order can not be stopped or Re-opened" msgstr "" @@ -10580,9 +10586,9 @@ msgstr "" #: erpnext/accounts/report/gross_profit/gross_profit.js:8 #: erpnext/accounts/report/invalid_ledger_entries/invalid_ledger_entries.js:8 #: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js:40 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:225 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:230 #: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js:28 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:270 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:277 #: erpnext/accounts/report/payment_ledger/payment_ledger.js:8 #: erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js:8 #: erpnext/accounts/report/pos_register/pos_register.js:8 @@ -10947,12 +10953,12 @@ msgstr "" msgid "Company and Posting Date is mandatory" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2583 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2581 msgid "Company currencies of both the companies should match for Inter Company Transactions." msgstr "" #: erpnext/stock/doctype/material_request/material_request.js:380 -#: erpnext/stock/doctype/stock_entry/stock_entry.js:753 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:755 msgid "Company field is required" msgstr "" @@ -11057,7 +11063,7 @@ msgstr "" msgid "Complete Job" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_payment.js:24 +#: erpnext/selling/page/point_of_sale/pos_payment.js:44 msgid "Complete Order" msgstr "" @@ -11954,6 +11960,7 @@ msgstr "" #. Label of the cost_center (Link) field in DocType 'Material Request Item' #. Label of the cost_center (Link) field in DocType 'Purchase Receipt' #. Label of the cost_center (Link) field in DocType 'Purchase Receipt Item' +#. Label of the cost_center (Link) field in DocType 'Stock Entry' #. Label of the cost_center (Link) field in DocType 'Stock Entry Detail' #. Label of the cost_center (Link) field in DocType 'Stock Reconciliation' #. Label of the cost_center (Link) field in DocType 'Subcontracting Order' @@ -12011,7 +12018,7 @@ msgstr "" #: erpnext/accounts/report/general_ledger/general_ledger.py:776 #: erpnext/accounts/report/gross_profit/gross_profit.js:68 #: erpnext/accounts/report/gross_profit/gross_profit.py:395 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:298 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:305 #: erpnext/accounts/report/purchase_register/purchase_register.js:46 #: erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py:29 #: erpnext/accounts/report/sales_register/sales_register.js:52 @@ -12042,6 +12049,7 @@ msgstr "" #: erpnext/stock/doctype/material_request_item/material_request_item.json #: erpnext/stock/doctype/purchase_receipt/purchase_receipt.json #: erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +#: erpnext/stock/doctype/stock_entry/stock_entry.json #: erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json #: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json #: erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.json @@ -12098,7 +12106,7 @@ msgid "Cost Center is a part of Cost Center Allocation, hence cannot be converte msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:1433 -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:896 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:899 msgid "Cost Center is required in row {0} in Taxes table for type {1}" msgstr "" @@ -12164,7 +12172,7 @@ msgstr "" msgid "Cost of Goods Sold" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:737 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:735 msgid "Cost of Goods Sold Account in Items Table" msgstr "" @@ -12330,7 +12338,7 @@ msgid "Coupon Type" msgstr "" #: erpnext/accounts/doctype/account/account_tree.js:86 -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:82 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:84 #: erpnext/templates/form_grid/bank_reconciliation_grid.html:16 msgid "Cr" msgstr "" @@ -12627,7 +12635,7 @@ msgid "Create Service Item" msgstr "" #: erpnext/stock/dashboard/item_dashboard.js:283 -#: erpnext/stock/doctype/material_request/material_request.js:500 +#: erpnext/stock/doctype/material_request/material_request.js:478 msgid "Create Stock Entry" msgstr "" @@ -12733,7 +12741,7 @@ msgstr "" msgid "Create a variant with the template image." msgstr "" -#: erpnext/stock/stock_ledger.py:2014 +#: erpnext/stock/stock_ledger.py:2018 msgid "Create an incoming stock transaction for the Item." msgstr "" @@ -12789,7 +12797,7 @@ msgstr "" msgid "Creating Delivery Schedule..." msgstr "" -#: erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py:144 +#: erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py:140 msgid "Creating Dimensions..." msgstr "" @@ -12873,7 +12881,7 @@ msgstr "" #: erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json #: erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html:39 #: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html:11 -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:84 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:88 #: erpnext/accounts/report/cheques_and_deposits_incorrectly_cleared/cheques_and_deposits_incorrectly_cleared.py:146 #: erpnext/accounts/report/consolidated_trial_balance/consolidated_trial_balance.py:431 #: erpnext/accounts/report/general_ledger/general_ledger.html:93 @@ -13531,7 +13539,7 @@ msgstr "" #: erpnext/accounts/report/gross_profit/gross_profit.py:416 #: erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py:37 #: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js:22 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:214 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:221 #: erpnext/accounts/report/pos_register/pos_register.js:44 #: erpnext/accounts/report/pos_register/pos_register.py:120 #: erpnext/accounts/report/pos_register/pos_register.py:181 @@ -13640,7 +13648,7 @@ msgstr "" msgid "Customer / Lead Address" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:50 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:95 msgid "Customer > Customer Group > Territory" msgstr "" @@ -13809,7 +13817,7 @@ msgstr "" #: erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.js:56 #: erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py:163 #: erpnext/accounts/report/gross_profit/gross_profit.py:423 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:201 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:208 #: erpnext/accounts/report/sales_register/sales_register.js:27 #: erpnext/accounts/report/sales_register/sales_register.py:202 #: erpnext/crm/doctype/opportunity/opportunity.json @@ -13921,7 +13929,7 @@ msgstr "" #: erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.js:92 #: erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py:35 #: erpnext/accounts/report/gross_profit/gross_profit.py:430 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:221 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:228 #: erpnext/accounts/report/sales_register/sales_register.py:193 #: erpnext/buying/doctype/purchase_order/purchase_order.json #: erpnext/crm/doctype/opportunity/opportunity.json @@ -14079,7 +14087,7 @@ msgstr "" msgid "Customer required for 'Customerwise Discount'" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1145 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1143 #: erpnext/selling/doctype/sales_order/sales_order.py:434 #: erpnext/stock/doctype/delivery_note/delivery_note.py:436 msgid "Customer {0} does not belong to project {1}" @@ -14428,7 +14436,7 @@ msgstr "" #: erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json #: erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html:38 #: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html:10 -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:77 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:81 #: erpnext/accounts/report/cheques_and_deposits_incorrectly_cleared/cheques_and_deposits_incorrectly_cleared.py:139 #: erpnext/accounts/report/consolidated_trial_balance/consolidated_trial_balance.py:424 #: erpnext/accounts/report/general_ledger/general_ledger.html:92 @@ -14525,13 +14533,13 @@ msgstr "" #. Label of the debit_to (Link) field in DocType 'Sales Invoice' #: erpnext/accounts/doctype/pos_invoice/pos_invoice.json #: erpnext/accounts/doctype/sales_invoice/sales_invoice.json -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1013 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1024 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1011 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1022 #: erpnext/controllers/accounts_controller.py:2360 msgid "Debit To" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1009 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1007 msgid "Debit To is required" msgstr "" @@ -15186,7 +15194,7 @@ msgstr "" msgid "Deferred Revenue and Expense" msgstr "" -#: erpnext/accounts/deferred_revenue.py:541 +#: erpnext/accounts/deferred_revenue.py:542 msgid "Deferred accounting failed for some invoices:" msgstr "" @@ -15258,6 +15266,12 @@ msgstr "" msgid "Delete Cancelled Ledger Entries" msgstr "" +#. Label of a standard navbar item +#. Type: Action +#: erpnext/hooks.py erpnext/public/js/utils/demo.js:5 +msgid "Delete Demo Data" +msgstr "" + #: erpnext/stock/doctype/inventory_dimension/inventory_dimension.js:66 msgid "Delete Dimension" msgstr "" @@ -15425,7 +15439,7 @@ msgstr "" #: erpnext/public/js/utils.js:875 #: erpnext/selling/doctype/delivery_schedule_item/delivery_schedule_item.json #: erpnext/selling/doctype/sales_order/sales_order.js:624 -#: erpnext/selling/doctype/sales_order/sales_order.js:1486 +#: erpnext/selling/doctype/sales_order/sales_order.js:1490 #: erpnext/selling/doctype/sales_order/sales_order.json #: erpnext/selling/doctype/sales_order_item/sales_order_item.json #: erpnext/selling/report/sales_order_analysis/sales_order_analysis.py:321 @@ -15470,7 +15484,7 @@ msgstr "" #: erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json #: erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.js:22 #: erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py:21 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:284 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:291 #: erpnext/accounts/report/sales_register/sales_register.py:245 #: erpnext/selling/doctype/sales_order/sales_order.js:1042 #: erpnext/selling/doctype/sales_order/sales_order_list.js:81 @@ -15525,7 +15539,7 @@ msgstr "" msgid "Delivery Note Trends" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1406 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1404 msgid "Delivery Note {0} is not submitted" msgstr "" @@ -15639,7 +15653,7 @@ msgstr "" msgid "Demand vs Supply" msgstr "" -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:542 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:551 msgid "Demo Bank Account" msgstr "" @@ -15770,7 +15784,7 @@ msgstr "" msgid "Depreciation Entry Posting Status" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1259 +#: erpnext/assets/doctype/asset/asset.py:1257 msgid "Depreciation Entry against asset {0}" msgstr "" @@ -15821,7 +15835,7 @@ msgstr "" msgid "Depreciation Row {0}: Depreciation Posting Date cannot be before Available-for-use Date" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:719 +#: erpnext/assets/doctype/asset/asset.py:717 msgid "Depreciation Row {0}: Expected value after useful life must be greater than or equal to {1}" msgstr "" @@ -15930,15 +15944,15 @@ msgstr "" msgid "Difference Account" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:726 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:724 msgid "Difference Account in Items Table" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:715 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:713 msgid "Difference Account must be a Asset/Liability type account (Temporary Opening), since this Stock Entry is an Opening Entry" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:986 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:987 msgid "Difference Account must be a Asset/Liability type account, since this Stock Reconciliation is an Opening Entry" msgstr "" @@ -16223,7 +16237,7 @@ msgstr "" #: erpnext/accounts/doctype/payment_term/payment_term.json #: erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json #: erpnext/selling/page/point_of_sale/pos_item_cart.js:406 -#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:146 +#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:147 #: erpnext/templates/form_grid/item_grid.html:71 msgid "Discount" msgstr "" @@ -16312,7 +16326,7 @@ msgstr "" msgid "Discount Percentage" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:42 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:56 msgid "Discount Percentage can be applied either against a Price List or for all Price List." msgstr "" @@ -16405,7 +16419,7 @@ msgstr "" msgid "Discount must be less than 100" msgstr "" -#: erpnext/accounts/doctype/payment_entry/payment_entry.py:3357 +#: erpnext/accounts/doctype/payment_entry/payment_entry.py:3352 msgid "Discount of {} applied as per Payment Term" msgstr "" @@ -16528,7 +16542,7 @@ msgstr "" #: erpnext/patches/v11_0/add_default_dispatch_notification_template.py:20 #: erpnext/patches/v11_0/add_default_dispatch_notification_template.py:28 #: erpnext/setup/setup_wizard/operations/defaults_setup.py:58 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:335 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:340 msgid "Dispatch Notification" msgstr "" @@ -16713,6 +16727,10 @@ msgstr "" msgid "Do Not Use Batch-wise Valuation" msgstr "" +#: erpnext/stock/doctype/stock_settings/stock_settings.py:130 +msgid "Do Not Use Batchwise Valuation" +msgstr "" + #. Description of the 'Hide Currency Symbol' (Select) field in DocType 'Global #. Defaults' #: erpnext/setup/doctype/global_defaults/global_defaults.json @@ -17246,7 +17264,7 @@ msgstr "" msgid "Edit Capacity" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:92 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:109 msgid "Edit Cart" msgstr "" @@ -17432,12 +17450,6 @@ msgstr "" msgid "Email Receipt" msgstr "" -#. Label of the email_sent (Check) field in DocType 'Request for Quotation -#. Supplier' -#: erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json -msgid "Email Sent" -msgstr "" - #: erpnext/buying/doctype/request_for_quotation/request_for_quotation.py:371 msgid "Email Sent to Supplier {0}" msgstr "" @@ -18007,10 +18019,6 @@ msgstr "" msgid "Enter Serial Nos" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.js:437 -msgid "Enter Supplier" -msgstr "" - #: erpnext/manufacturing/doctype/job_card/job_card.js:402 #: erpnext/manufacturing/doctype/job_card/job_card.js:471 #: erpnext/manufacturing/doctype/workstation/workstation.js:312 @@ -18088,7 +18096,7 @@ msgstr "" msgid "Enter the opening stock units." msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:972 +#: erpnext/manufacturing/doctype/bom/bom.js:973 msgid "Enter the quantity of the Item that will be manufactured from this Bill of Materials." msgstr "" @@ -18177,7 +18185,7 @@ msgstr "" msgid "Error while posting depreciation entries" msgstr "" -#: erpnext/accounts/deferred_revenue.py:539 +#: erpnext/accounts/deferred_revenue.py:540 msgid "Error while processing deferred accounting for {0}" msgstr "" @@ -18224,7 +18232,7 @@ msgstr "" msgid "Evaluation Period" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:48 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:87 msgid "Even if there are multiple Pricing Rules with highest priority, then following internal priorities are applied:" msgstr "" @@ -18254,7 +18262,7 @@ msgstr "" msgid "Example: ABCD.#####. If series is set and Batch No is not mentioned in transactions, then automatic batch number will be created based on this series. If you always want to explicitly mention Batch No for this item, leave this blank. Note: this setting will take priority over the Naming Series Prefix in Stock Settings." msgstr "" -#: erpnext/stock/stock_ledger.py:2278 +#: erpnext/stock/stock_ledger.py:2281 msgid "Example: Serial No {0} reserved in {1}." msgstr "" @@ -18268,7 +18276,7 @@ msgstr "" msgid "Excess Materials Consumed" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1115 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1114 msgid "Excess Transfer" msgstr "" @@ -18409,7 +18417,7 @@ msgstr "" msgid "Excise Entry" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.js:1409 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:1411 msgid "Excise Invoice" msgstr "" @@ -18638,7 +18646,7 @@ msgstr "" #: erpnext/accounts/doctype/pos_profile/pos_profile.json #: erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json #: erpnext/accounts/report/account_balance/account_balance.js:46 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:246 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:251 #: erpnext/assets/doctype/asset_capitalization_service_item/asset_capitalization_service_item.json #: erpnext/assets/doctype/asset_repair_purchase_invoice/asset_repair_purchase_invoice.json #: erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -18699,7 +18707,7 @@ msgstr "" msgid "Expenses Included In Valuation" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:271 +#: erpnext/stock/doctype/pick_list/pick_list.py:306 #: erpnext/stock/doctype/stock_entry/stock_entry.js:409 msgid "Expired Batches" msgstr "" @@ -18871,7 +18879,7 @@ msgstr "" msgid "Failed to parse MT940 format. Error: {0}" msgstr "" -#: erpnext/assets/doctype/asset/asset.js:260 +#: erpnext/assets/doctype/asset/asset.js:264 msgid "Failed to post depreciation entries" msgstr "" @@ -18988,7 +18996,7 @@ msgid "Fetch Value From" msgstr "" #: erpnext/stock/doctype/material_request/material_request.js:372 -#: erpnext/stock/doctype/stock_entry/stock_entry.js:730 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:732 msgid "Fetch exploded BOM (including sub-assemblies)" msgstr "" @@ -19009,11 +19017,11 @@ msgid "Fetching Sales Orders..." msgstr "" #: erpnext/accounts/doctype/dunning/dunning.js:135 -#: erpnext/public/js/controllers/transaction.js:1590 +#: erpnext/public/js/controllers/transaction.js:1593 msgid "Fetching exchange rates ..." msgstr "" -#: erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js:72 +#: erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js:74 msgid "Fetching..." msgstr "" @@ -19402,7 +19410,7 @@ msgstr "" msgid "Finished Goods based Operating Cost" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1672 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1670 msgid "Finished Item {0} does not match with Work Order {1}" msgstr "" @@ -19546,7 +19554,7 @@ msgstr "" #. Capitalization Asset Item' #. Label of the fixed_asset_account (Link) field in DocType 'Asset Category #. Account' -#: erpnext/assets/doctype/asset/asset.py:901 +#: erpnext/assets/doctype/asset/asset.py:899 #: erpnext/assets/doctype/asset_capitalization_asset_item/asset_capitalization_asset_item.json #: erpnext/assets/doctype/asset_category_account/asset_category_account.json msgid "Fixed Asset Account" @@ -19702,10 +19710,6 @@ msgstr "" msgid "For Company" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.js:415 -msgid "For Default Supplier (Optional)" -msgstr "" - #: erpnext/manufacturing/doctype/plant_floor/plant_floor.js:187 #: erpnext/manufacturing/doctype/plant_floor/plant_floor.js:211 msgid "For Item" @@ -19742,7 +19746,7 @@ msgstr "" msgid "For Production" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:838 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:836 msgid "For Quantity (Manufactured Qty) is mandatory" msgstr "" @@ -19822,7 +19826,7 @@ msgstr "" msgid "For operation {0} at row {1}, please add raw materials or set a BOM against it." msgstr "" -#: erpnext/manufacturing/doctype/work_order/work_order.py:2594 +#: erpnext/manufacturing/doctype/work_order/work_order.py:2599 msgid "For operation {0}: Quantity ({1}) can not be greater than pending quantity({2})" msgstr "" @@ -19839,7 +19843,7 @@ msgstr "" msgid "For projected and forecast quantities, the system will consider all child warehouses under the selected parent warehouse." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1704 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1702 msgid "For quantity {0} should not be greater than allowed quantity {1}" msgstr "" @@ -19853,7 +19857,7 @@ msgstr "" msgid "For row {0} in {1}. To include {2} in Item rate, rows {3} must also be included" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1714 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1716 msgid "For row {0}: Enter Planned Qty" msgstr "" @@ -19872,11 +19876,11 @@ msgstr "" msgid "For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:979 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:977 msgid "For the item {0}, the consumed quantity should be {1} according to the BOM {2}." msgstr "" -#: erpnext/public/js/controllers/transaction.js:1400 +#: erpnext/public/js/controllers/transaction.js:1403 msgctxt "Clear payment terms template and/or payment schedule when due date is changed" msgid "For the new {0} to take effect, would you like to clear the current {1}?" msgstr "" @@ -19915,7 +19919,7 @@ msgstr "" #: erpnext/accounts/report/consolidated_trial_balance/consolidated_trial_balance.py:254 #: erpnext/accounts/report/consolidated_trial_balance/consolidated_trial_balance.py:255 -#: erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py:88 +#: erpnext/accounts/report/consolidated_trial_balance/test_consolidated_trial_balance.py:73 msgid "Foreign Currency Translation Reserve" msgstr "" @@ -19989,7 +19993,7 @@ msgstr "" msgid "Free item code is not selected" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:654 +#: erpnext/accounts/doctype/pricing_rule/utils.py:656 msgid "Free item not set in the pricing rule {0}" msgstr "" @@ -20060,7 +20064,7 @@ msgstr "" msgid "From Customer" msgstr "" -#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:43 +#: erpnext/accounts/doctype/bank_clearance/bank_clearance.py:45 msgid "From Date and To Date are Mandatory" msgstr "" @@ -20791,7 +20795,7 @@ msgstr "" #: erpnext/stock/doctype/stock_entry/stock_entry.js:399 #: erpnext/stock/doctype/stock_entry/stock_entry.js:432 #: erpnext/stock/doctype/stock_entry/stock_entry.js:523 -#: erpnext/stock/doctype/stock_entry/stock_entry.js:697 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:699 #: erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js:165 msgid "Get Items From" msgstr "" @@ -20807,8 +20811,8 @@ msgid "Get Items for Purchase Only" msgstr "" #: erpnext/stock/doctype/material_request/material_request.js:346 -#: erpnext/stock/doctype/stock_entry/stock_entry.js:733 -#: erpnext/stock/doctype/stock_entry/stock_entry.js:746 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:735 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:748 msgid "Get Items from BOM" msgstr "" @@ -20983,7 +20987,7 @@ msgstr "" msgid "Goods Transferred" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:2222 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:2220 msgid "Goods are already received against the outward entry {0}" msgstr "" @@ -21117,11 +21121,11 @@ msgstr "" #: erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json #: erpnext/selling/doctype/quotation/quotation.json #: erpnext/selling/doctype/sales_order/sales_order.json -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:92 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:105 #: erpnext/selling/page/point_of_sale/pos_item_cart.js:548 #: erpnext/selling/page/point_of_sale/pos_item_cart.js:552 -#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:180 -#: erpnext/selling/page/point_of_sale/pos_payment.js:691 +#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:181 +#: erpnext/selling/page/point_of_sale/pos_payment.js:692 #: erpnext/setup/doctype/authorization_rule/authorization_rule.json #: erpnext/stock/doctype/delivery_note/delivery_note.json #: erpnext/stock/doctype/delivery_stop/delivery_stop.json @@ -21280,7 +21284,7 @@ msgstr "" msgid "Group Same Items" msgstr "" -#: erpnext/stock/doctype/stock_settings/stock_settings.py:142 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:158 msgid "Group Warehouses cannot be used in transactions. Please change the value of {0}" msgstr "" @@ -21585,7 +21589,7 @@ msgstr "" msgid "Here are the error logs for the aforementioned failed depreciation entries: {0}" msgstr "" -#: erpnext/stock/stock_ledger.py:1999 +#: erpnext/stock/stock_ledger.py:2003 msgid "Here are the options to proceed:" msgstr "" @@ -21769,7 +21773,7 @@ msgstr "" msgid "Hours Spent" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:44 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:67 msgid "How Pricing Rule is applied?" msgstr "" @@ -21891,7 +21895,7 @@ msgid "Identification of the package for the delivery (for print)" msgstr "" #: erpnext/setup/setup_wizard/data/sales_stage.txt:5 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:436 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:441 msgid "Identifying Decision Makers" msgstr "" @@ -21914,7 +21918,7 @@ msgid "" "If Disabled - Reconciliation happens on oldest of 2 Dates: Invoice Date or the Advance Payment posting date
      \n" msgstr "" -#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:14 +#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:34 msgid "If Auto Opt In is checked, then the customers will be automatically linked with the concerned Loyalty Program (on save)" msgstr "" @@ -22160,7 +22164,7 @@ msgstr "" msgid "If more than one package of the same type (for print)" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:50 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:103 msgid "If multiple Pricing Rules continue to prevail, users are asked to set Priority manually to resolve conflict." msgstr "" @@ -22170,7 +22174,7 @@ msgstr "" msgid "If no taxes are set, and Taxes and Charges Template is selected, the system will automatically apply the taxes from the chosen template." msgstr "" -#: erpnext/stock/stock_ledger.py:2009 +#: erpnext/stock/stock_ledger.py:2013 msgid "If not, you can Cancel / Submit this entry" msgstr "" @@ -22180,7 +22184,7 @@ msgstr "" msgid "If rate is zero then item will be treated as \"Free Item\"" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:40 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:51 msgid "If selected Pricing Rule is made for 'Rate', it will overwrite Price List. Pricing Rule rate is the final rate, so no further discount should be applied. Hence, in transactions like Sales Order, Purchase Order etc, it will be fetched in 'Rate' field, rather than 'Price List Rate' field." msgstr "" @@ -22199,7 +22203,7 @@ msgstr "" msgid "If the account is frozen, entries are allowed to restricted users." msgstr "" -#: erpnext/stock/stock_ledger.py:2002 +#: erpnext/stock/stock_ledger.py:2006 msgid "If the item is transacting as a Zero Valuation Rate item in this entry, please enable 'Allow Zero Valuation Rate' in the {0} Item table." msgstr "" @@ -22272,11 +22276,11 @@ msgstr "" msgid "If ticked, the BOM cost will be automatically updated based on Valuation Rate / Price List Rate / last purchase rate of raw materials." msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:46 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:82 msgid "If two or more Pricing Rules are found based on the above conditions, Priority is applied. Priority is a number between 0 to 20 while default value is zero (blank). Higher number means it will take precedence if there are multiple Pricing Rules with same conditions." msgstr "" -#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:14 +#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:31 msgid "If unlimited expiry for the Loyalty Points, keep the Expiry Duration empty or 0." msgstr "" @@ -22296,11 +22300,11 @@ msgstr "" msgid "If you need to reconcile particular transactions against each other, then please select accordingly. If not, all the transactions will be allocated in FIFO order." msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1090 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1092 msgid "If you still want to proceed, please disable 'Skip Available Sub Assembly Items' checkbox." msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1830 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1832 msgid "If you still want to proceed, please enable {0}." msgstr "" @@ -22309,11 +22313,11 @@ msgstr "" msgid "If you want to run operations in parallel, keep the same sequence ID for them." msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:376 +#: erpnext/accounts/doctype/pricing_rule/utils.py:378 msgid "If you {0} {1} quantities of the item {2}, the scheme {3} will be applied on the item." msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:381 +#: erpnext/accounts/doctype/pricing_rule/utils.py:383 msgid "If you {0} {1} worth item {2}, the scheme {3} will be applied on the item." msgstr "" @@ -22380,7 +22384,7 @@ msgstr "" msgid "Ignore Existing Ordered Qty" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1822 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1824 msgid "Ignore Existing Projected Quantity" msgstr "" @@ -22618,11 +22622,11 @@ msgstr "" msgid "In Transit" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.js:499 +#: erpnext/stock/doctype/material_request/material_request.js:477 msgid "In Transit Transfer" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.js:468 +#: erpnext/stock/doctype/material_request/material_request.js:446 msgid "In Transit Warehouse" msgstr "" @@ -22717,7 +22721,7 @@ msgstr "" msgid "In stock" msgstr "" -#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:12 +#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:26 msgid "In the case of multi-tier program, Customers will be auto assigned to the concerned tier as per their spent" msgstr "" @@ -22980,7 +22984,7 @@ msgstr "" #: erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json #: erpnext/accounts/report/account_balance/account_balance.js:53 #: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js:77 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:291 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:298 msgid "Income Account" msgstr "" @@ -23054,7 +23058,7 @@ msgstr "" msgid "Incorrect Company" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:986 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:984 msgid "Incorrect Component Quantity" msgstr "" @@ -23098,8 +23102,9 @@ msgstr "" msgid "Incorrect Type of Transaction" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:175 -#: erpnext/stock/doctype/stock_settings/stock_settings.py:145 +#: erpnext/stock/doctype/pick_list/pick_list.py:186 +#: erpnext/stock/doctype/pick_list/pick_list.py:210 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:161 msgid "Incorrect Warehouse" msgstr "" @@ -23256,7 +23261,7 @@ msgid "Inspected By" msgstr "" #: erpnext/controllers/stock_controller.py:1494 -#: erpnext/manufacturing/doctype/job_card/job_card.py:815 +#: erpnext/manufacturing/doctype/job_card/job_card.py:814 msgid "Inspection Rejected" msgstr "" @@ -23280,7 +23285,7 @@ msgid "Inspection Required before Purchase" msgstr "" #: erpnext/controllers/stock_controller.py:1479 -#: erpnext/manufacturing/doctype/job_card/job_card.py:796 +#: erpnext/manufacturing/doctype/job_card/job_card.py:795 msgid "Inspection Submission" msgstr "" @@ -23355,16 +23360,16 @@ msgid "Insufficient Permissions" msgstr "" #: erpnext/accounts/doctype/pos_invoice/pos_invoice.py:462 -#: erpnext/stock/doctype/pick_list/pick_list.py:134 -#: erpnext/stock/doctype/pick_list/pick_list.py:152 -#: erpnext/stock/doctype/pick_list/pick_list.py:1019 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:958 -#: erpnext/stock/serial_batch_bundle.py:1205 erpnext/stock/stock_ledger.py:1710 -#: erpnext/stock/stock_ledger.py:2169 +#: erpnext/stock/doctype/pick_list/pick_list.py:144 +#: erpnext/stock/doctype/pick_list/pick_list.py:162 +#: erpnext/stock/doctype/pick_list/pick_list.py:1055 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:956 +#: erpnext/stock/serial_batch_bundle.py:1205 erpnext/stock/stock_ledger.py:1713 +#: erpnext/stock/stock_ledger.py:2172 msgid "Insufficient Stock" msgstr "" -#: erpnext/stock/stock_ledger.py:2184 +#: erpnext/stock/stock_ledger.py:2187 msgid "Insufficient Stock for Batch" msgstr "" @@ -23500,7 +23505,7 @@ msgstr "" msgid "Interest Income" msgstr "" -#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2991 +#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2986 msgid "Interest and/or dunning fee" msgstr "" @@ -23601,8 +23606,8 @@ msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:380 #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:388 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1019 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1029 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1017 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1027 #: erpnext/assets/doctype/asset_category/asset_category.py:69 #: erpnext/assets/doctype/asset_category/asset_category.py:97 #: erpnext/controllers/accounts_controller.py:3207 @@ -23635,7 +23640,7 @@ msgstr "" msgid "Invalid Barcode. There is no Item attached to this barcode." msgstr "" -#: erpnext/public/js/controllers/transaction.js:3209 +#: erpnext/public/js/controllers/transaction.js:3212 msgid "Invalid Blanket Order for the selected Customer and Item" msgstr "" @@ -23651,7 +23656,7 @@ msgstr "" msgid "Invalid Company Field" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2358 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2356 msgid "Invalid Company for Inter Company Transaction." msgstr "" @@ -23691,7 +23696,7 @@ msgid "Invalid Group By" msgstr "" #: erpnext/accounts/doctype/pos_invoice/pos_invoice.py:499 -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:953 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:955 msgid "Invalid Item" msgstr "" @@ -23743,7 +23748,7 @@ msgstr "" msgid "Invalid Priority" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1224 +#: erpnext/manufacturing/doctype/bom/bom.py:1230 msgid "Invalid Process Loss Configuration" msgstr "" @@ -23772,8 +23777,8 @@ msgstr "" msgid "Invalid Sales Invoices" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:656 -#: erpnext/assets/doctype/asset/asset.py:684 +#: erpnext/assets/doctype/asset/asset.py:654 +#: erpnext/assets/doctype/asset/asset.py:682 msgid "Invalid Schedule" msgstr "" @@ -23781,12 +23786,12 @@ msgstr "" msgid "Invalid Selling Price" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1747 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1745 msgid "Invalid Serial and Batch Bundle" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1020 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1042 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1018 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1040 msgid "Invalid Source and Target Warehouse" msgstr "" @@ -23850,7 +23855,7 @@ msgstr "" msgid "Invalid {0}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2356 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2354 msgid "Invalid {0} for Inter Company Transaction." msgstr "" @@ -23929,8 +23934,8 @@ msgstr "" #: erpnext/accounts/doctype/discounted_invoice/discounted_invoice.json #: erpnext/accounts/doctype/loyalty_point_entry/loyalty_point_entry.json #: erpnext/accounts/doctype/subscription_invoice/subscription_invoice.json -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:170 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:187 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:175 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:194 #: erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py:97 msgid "Invoice" msgstr "" @@ -24084,7 +24089,7 @@ msgstr "" #: erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.json #: erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json #: erpnext/accounts/doctype/pos_profile/pos_profile.json -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2407 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2405 #: erpnext/buying/doctype/supplier/supplier.json #: erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py:62 msgid "Invoices" @@ -24754,7 +24759,7 @@ msgstr "" msgid "It can take upto few hours for accurate stock values to be visible after merging items." msgstr "" -#: erpnext/public/js/controllers/transaction.js:2610 +#: erpnext/public/js/controllers/transaction.js:2613 msgid "It is needed to fetch Item Details." msgstr "" @@ -24815,7 +24820,7 @@ msgstr "" #: erpnext/buying/workspace/buying/buying.json #: erpnext/controllers/taxes_and_totals.py:1212 #: erpnext/manufacturing/doctype/blanket_order/blanket_order.json -#: erpnext/manufacturing/doctype/bom/bom.js:1065 +#: erpnext/manufacturing/doctype/bom/bom.js:1066 #: erpnext/manufacturing/doctype/bom/bom.json #: erpnext/manufacturing/doctype/plant_floor/plant_floor.js:109 #: erpnext/manufacturing/doctype/workstation/workstation_job_card.html:25 @@ -24837,7 +24842,7 @@ msgstr "" #: erpnext/selling/doctype/party_specific_item/party_specific_item.json #: erpnext/selling/doctype/product_bundle_item/product_bundle_item.json #: erpnext/selling/doctype/sales_order/sales_order.js:1631 -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:46 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:50 #: erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.js:14 #: erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js:36 #: erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.js:61 @@ -24962,7 +24967,7 @@ msgstr "" msgid "Item Barcode" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:46 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:48 msgid "Item Cart" msgstr "" @@ -25067,8 +25072,8 @@ msgstr "" #: erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py:68 #: erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py:37 #: erpnext/accounts/report/gross_profit/gross_profit.py:312 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:143 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:160 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:148 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:167 #: erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py:37 #: erpnext/assets/doctype/asset/asset.json #: erpnext/assets/doctype/asset_capitalization_asset_item/asset_capitalization_asset_item.json @@ -25103,7 +25108,7 @@ msgstr "" #: erpnext/manufacturing/doctype/sales_forecast_item/sales_forecast_item.json #: erpnext/manufacturing/doctype/work_order_item/work_order_item.json #: erpnext/manufacturing/doctype/workstation/workstation.js:471 -#: erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js:155 +#: erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js:159 #: erpnext/manufacturing/report/bom_explorer/bom_explorer.py:60 #: erpnext/manufacturing/report/bom_operations_time/bom_operations_time.js:8 #: erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py:103 @@ -25118,7 +25123,7 @@ msgstr "" #: erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py:86 #: erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py:119 #: erpnext/projects/doctype/timesheet/timesheet.js:214 -#: erpnext/public/js/controllers/transaction.js:2904 +#: erpnext/public/js/controllers/transaction.js:2907 #: erpnext/public/js/stock_reservation.js:112 #: erpnext/public/js/stock_reservation.js:318 erpnext/public/js/utils.js:559 #: erpnext/public/js/utils.js:716 @@ -25204,7 +25209,7 @@ msgstr "" msgid "Item Code (Final Product)" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:50 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:92 msgid "Item Code > Item Group > Brand" msgstr "" @@ -25262,7 +25267,7 @@ msgstr "" #. Plan Sub Assembly Item' #. Label of the item_details_tab (Tab Break) field in DocType 'Item Lead Time' #: erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.json -#: erpnext/selling/page/point_of_sale/pos_item_details.js:29 +#: erpnext/selling/page/point_of_sale/pos_item_details.js:30 #: erpnext/stock/doctype/item_lead_time/item_lead_time.json msgid "Item Details" msgstr "" @@ -25324,9 +25329,9 @@ msgstr "" #: erpnext/accounts/report/inactive_sales_items/inactive_sales_items.js:21 #: erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py:28 #: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js:28 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:157 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:162 #: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js:65 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:174 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:181 #: erpnext/accounts/report/purchase_register/purchase_register.js:58 #: erpnext/accounts/report/sales_register/sales_register.js:70 #: erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -25552,8 +25557,8 @@ msgstr "" #: erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py:71 #: erpnext/accounts/report/gross_profit/gross_profit.py:319 #: erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py:33 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:149 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:166 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:154 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:173 #: erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py:71 #: erpnext/assets/doctype/asset/asset.json #: erpnext/assets/doctype/asset_capitalization_asset_item/asset_capitalization_asset_item.json @@ -25600,7 +25605,7 @@ msgstr "" #: erpnext/manufacturing/report/production_planning_report/production_planning_report.py:371 #: erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py:92 #: erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py:138 -#: erpnext/public/js/controllers/transaction.js:2910 +#: erpnext/public/js/controllers/transaction.js:2913 #: erpnext/public/js/utils.js:811 #: erpnext/selling/doctype/quotation_item/quotation_item.json #: erpnext/selling/doctype/sales_order/sales_order.js:1252 @@ -25682,6 +25687,10 @@ msgstr "" msgid "Item Price" msgstr "" +#: erpnext/stock/get_item_details.py:1118 +msgid "Item Price Added for {0} in Price List {1}" +msgstr "" + #. Label of the item_price_settings_section (Section Break) field in DocType #. 'Accounts Settings' #. Label of the item_price_settings_section (Section Break) field in DocType @@ -25700,7 +25709,7 @@ msgstr "" msgid "Item Price Stock" msgstr "" -#: erpnext/stock/get_item_details.py:1105 +#: erpnext/stock/get_item_details.py:1141 msgid "Item Price added for {0} in Price List {1}" msgstr "" @@ -25708,7 +25717,7 @@ msgstr "" msgid "Item Price appears multiple times based on Price List, Supplier/Customer, Currency, Item, Batch, UOM, Qty, and Dates." msgstr "" -#: erpnext/stock/get_item_details.py:1084 +#: erpnext/stock/get_item_details.py:1102 msgid "Item Price updated for {0} in Price List {1}" msgstr "" @@ -25994,7 +26003,7 @@ msgstr "" msgid "Item and Warranty Details" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3269 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3267 msgid "Item for row {0} does not match Material Request" msgstr "" @@ -26028,7 +26037,7 @@ msgstr "" msgid "Item qty can not be updated as raw materials are already processed." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1150 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1148 msgid "Item rate has been updated to zero as Allow Zero Valuation Rate is checked for item {0}" msgstr "" @@ -26042,7 +26051,7 @@ msgstr "" msgid "Item to be manufactured or repacked" msgstr "" -#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:9 +#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:27 msgid "Item valuation rate is recalculated considering landed cost voucher amount" msgstr "" @@ -26079,7 +26088,7 @@ msgstr "" msgid "Item {0} does not exist." msgstr "" -#: erpnext/controllers/selling_controller.py:852 +#: erpnext/controllers/selling_controller.py:855 msgid "Item {0} entered multiple times." msgstr "" @@ -26123,11 +26132,11 @@ msgstr "" msgid "Item {0} is not a stock Item" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:952 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:954 msgid "Item {0} is not a subcontracted item" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:2134 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:2132 msgid "Item {0} is not active or end of life has been reached" msgstr "" @@ -26147,7 +26156,7 @@ msgstr "" msgid "Item {0} must be a non-stock item" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1483 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1481 msgid "Item {0} not found in 'Raw Materials Supplied' table in {1} {2}" msgstr "" @@ -26163,7 +26172,7 @@ msgstr "" msgid "Item {0}: {1} qty produced. " msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1450 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1451 msgid "Item {} does not exist." msgstr "" @@ -26233,7 +26242,7 @@ msgstr "" msgid "Items Filter" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1676 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1678 #: erpnext/selling/doctype/sales_order/sales_order.js:1676 msgid "Items Required" msgstr "" @@ -26273,7 +26282,7 @@ msgstr "" msgid "Items not found." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1146 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1144 msgid "Items rate has been updated to zero as Allow Zero Valuation Rate is checked for the following items: {0}" msgstr "" @@ -26283,7 +26292,7 @@ msgstr "" msgid "Items to Be Repost" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1675 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1677 msgid "Items to Manufacture are required to pull the Raw Materials associated with it." msgstr "" @@ -26348,7 +26357,7 @@ msgstr "" #: erpnext/buying/doctype/purchase_order_item/purchase_order_item.json #: erpnext/manufacturing/doctype/bom/bom.json #: erpnext/manufacturing/doctype/job_card/job_card.json -#: erpnext/manufacturing/doctype/job_card/job_card.py:980 +#: erpnext/manufacturing/doctype/job_card/job_card.py:979 #: erpnext/manufacturing/doctype/operation/operation.json #: erpnext/manufacturing/doctype/work_order/work_order.js:396 #: erpnext/manufacturing/doctype/work_order/work_order.json @@ -26412,7 +26421,7 @@ msgstr "" msgid "Job Card and Capacity Planning" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1456 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1455 msgid "Job Card {0} has been completed" msgstr "" @@ -26488,7 +26497,7 @@ msgstr "" msgid "Job Worker Warehouse" msgstr "" -#: erpnext/manufacturing/doctype/work_order/work_order.py:2647 +#: erpnext/manufacturing/doctype/work_order/work_order.py:2652 msgid "Job card {0} created" msgstr "" @@ -26704,7 +26713,7 @@ msgstr "" msgid "Kilowatt-Hour" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:982 +#: erpnext/manufacturing/doctype/job_card/job_card.py:981 msgid "Kindly cancel the Manufacturing Entries first against the work order {0}." msgstr "" @@ -27225,7 +27234,7 @@ msgstr "" msgid "License Plate" msgstr "" -#: erpnext/controllers/status_updater.py:471 +#: erpnext/controllers/status_updater.py:474 msgid "Limit Crossed" msgstr "" @@ -27518,7 +27527,7 @@ msgid "Lower Deduction Certificate" msgstr "" #: erpnext/setup/setup_wizard/operations/install_fixtures.py:309 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:421 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:426 msgid "Lower Income" msgstr "" @@ -27570,7 +27579,7 @@ msgstr "" msgid "Loyalty Points Redemption" msgstr "" -#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:8 +#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:16 msgid "Loyalty Points will be calculated from the spent done (via the Sales Invoice), based on collection factor mentioned." msgstr "" @@ -27988,6 +27997,10 @@ msgstr "" msgid "Make Transfer Entry" msgstr "" +#: erpnext/public/js/telephony.js:29 +msgid "Make a call" +msgstr "" + #: erpnext/config/projects.py:34 msgid "Make project from a template." msgstr "" @@ -28040,7 +28053,7 @@ msgstr "" msgid "Mandatory Accounting Dimension" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1884 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1882 msgid "Mandatory Field" msgstr "" @@ -28139,8 +28152,8 @@ msgstr "" #: erpnext/stock/doctype/material_request_item/material_request_item.json #: erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json #: erpnext/stock/doctype/stock_entry/stock_entry.json -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1227 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1243 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1225 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1241 #: erpnext/stock/doctype/stock_entry_type/stock_entry_type.json #: erpnext/subcontracting/doctype/subcontracting_order_item/subcontracting_order_item.json #: erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json @@ -28289,7 +28302,7 @@ msgstr "" msgid "Manufacturing Manager" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:2387 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:2385 msgid "Manufacturing Quantity is mandatory" msgstr "" @@ -28520,12 +28533,12 @@ msgstr "" #. Option for the 'Purpose' (Select) field in DocType 'Stock Entry Type' #: erpnext/setup/setup_wizard/operations/install_fixtures.py:114 #: erpnext/stock/doctype/stock_entry/stock_entry.json -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1228 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1226 #: erpnext/stock/doctype/stock_entry_type/stock_entry_type.json msgid "Material Consumption for Manufacture" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.js:577 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:579 msgid "Material Consumption is not set in Manufacturing Settings." msgstr "" @@ -28612,8 +28625,8 @@ msgstr "" #: erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py:36 #: erpnext/stock/doctype/delivery_note_item/delivery_note_item.json #: erpnext/stock/doctype/material_request/material_request.json -#: erpnext/stock/doctype/material_request/material_request.py:426 -#: erpnext/stock/doctype/material_request/material_request.py:476 +#: erpnext/stock/doctype/material_request/material_request.py:434 +#: erpnext/stock/doctype/material_request/material_request.py:484 #: erpnext/stock/doctype/pick_list/pick_list.json #: erpnext/stock/doctype/pick_list_item/pick_list_item.json #: erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -28697,11 +28710,15 @@ msgstr "" msgid "Material Request Type" msgstr "" -#: erpnext/selling/doctype/sales_order/sales_order.py:1836 +#: erpnext/selling/doctype/sales_order/sales_order.py:1122 +msgid "Material Request already created for the ordered quantity" +msgstr "" + +#: erpnext/selling/doctype/sales_order/sales_order.py:1832 msgid "Material Request not created, as quantity for Raw Materials already available." msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:137 +#: erpnext/stock/doctype/material_request/material_request.py:145 msgid "Material Request of maximum {0} can be made for Item {1} against Sales Order {2}" msgstr "" @@ -28835,7 +28852,7 @@ msgid "Materials are already received against the {0} {1}" msgstr "" #: erpnext/manufacturing/doctype/job_card/job_card.py:181 -#: erpnext/manufacturing/doctype/job_card/job_card.py:836 +#: erpnext/manufacturing/doctype/job_card/job_card.py:835 msgid "Materials needs to be transferred to the work in progress warehouse for the job card {0}" msgstr "" @@ -28926,11 +28943,11 @@ msgstr "" msgid "Maximum Payment Amount" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3872 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3870 msgid "Maximum Samples - {0} can be retained for Batch {1} and Item {2}." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3863 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3861 msgid "Maximum Samples - {0} have already been retained for Batch {1} and Item {2} in Batch {3}." msgstr "" @@ -28985,7 +29002,7 @@ msgstr "" msgid "Megawatt" msgstr "" -#: erpnext/stock/stock_ledger.py:2015 +#: erpnext/stock/stock_ledger.py:2019 msgid "Mention Valuation Rate in the Item master." msgstr "" @@ -29118,7 +29135,7 @@ msgid "Microsecond" msgstr "" #: erpnext/setup/setup_wizard/operations/install_fixtures.py:310 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:422 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:427 msgid "Middle Income" msgstr "" @@ -29352,14 +29369,14 @@ msgstr "" msgid "Mismatch" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1451 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1452 msgid "Missing" msgstr "" #: erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py:97 #: erpnext/accounts/doctype/pos_profile/pos_profile.py:200 #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:597 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2424 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2422 #: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:3030 #: erpnext/assets/doctype/asset_category/asset_category.py:116 msgid "Missing Account" @@ -29386,7 +29403,7 @@ msgstr "" msgid "Missing Finance Book" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1682 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1680 msgid "Missing Finished Good" msgstr "" @@ -29394,7 +29411,7 @@ msgstr "" msgid "Missing Formula" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:993 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:991 msgid "Missing Item" msgstr "" @@ -29410,6 +29427,10 @@ msgstr "" msgid "Missing Serial No Bundle" msgstr "" +#: erpnext/stock/doctype/pick_list/pick_list.py:170 +msgid "Missing Warehouse" +msgstr "" + #: erpnext/stock/doctype/delivery_trip/delivery_trip.js:154 msgid "Missing email template for dispatch. Please set one in Delivery Settings." msgstr "" @@ -29434,8 +29455,8 @@ msgstr "" msgid "Mobile: " msgstr "" -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:211 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:241 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:216 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:248 #: erpnext/accounts/report/purchase_register/purchase_register.py:201 #: erpnext/accounts/report/sales_register/sales_register.py:224 msgid "Mode Of Payment" @@ -29658,11 +29679,11 @@ msgstr "" msgid "Multiple Loyalty Programs found for Customer {}. Please select manually." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1196 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1194 msgid "Multiple POS Opening Entry" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:346 +#: erpnext/accounts/doctype/pricing_rule/utils.py:348 msgid "Multiple Price Rules exists with same criteria, please resolve conflict by assigning priority. Price Rules: {0}" msgstr "" @@ -29688,7 +29709,7 @@ msgstr "" msgid "Multiple fiscal years exist for the date {0}. Please set company in Fiscal Year" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1689 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1687 msgid "Multiple items cannot be marked as finished item" msgstr "" @@ -29812,7 +29833,7 @@ msgid "Natural Gas" msgstr "" #: erpnext/setup/setup_wizard/data/sales_stage.txt:3 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:434 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:439 msgid "Needs Analysis" msgstr "" @@ -29821,21 +29842,21 @@ msgstr "" msgid "Negative Batch Report" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:623 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:624 msgid "Negative Quantity is not allowed" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1532 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1537 #: erpnext/stock/serial_batch_bundle.py:1528 msgid "Negative Stock Error" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:628 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:629 msgid "Negative Valuation Rate is not allowed" msgstr "" #: erpnext/setup/setup_wizard/data/sales_stage.txt:8 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:439 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:444 msgid "Negotiation/Review" msgstr "" @@ -30090,10 +30111,10 @@ msgstr "" #: erpnext/buying/doctype/supplier_quotation/supplier_quotation.json #: erpnext/selling/doctype/quotation/quotation.json #: erpnext/selling/doctype/sales_order/sales_order.json -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:92 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:100 #: erpnext/selling/page/point_of_sale/pos_item_cart.js:522 #: erpnext/selling/page/point_of_sale/pos_item_cart.js:526 -#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:156 +#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:157 #: erpnext/stock/doctype/delivery_note/delivery_note.json #: erpnext/stock/doctype/purchase_receipt/purchase_receipt.json #: erpnext/templates/includes/order/order_taxes.html:5 @@ -30363,7 +30384,7 @@ msgstr "" msgid "No Account Data row found" msgstr "" -#: erpnext/setup/doctype/company/test_company.py:98 +#: erpnext/setup/doctype/company/test_company.py:94 msgid "No Account matched these filters: {}" msgstr "" @@ -30376,7 +30397,7 @@ msgstr "" msgid "No Answer" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2529 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2527 msgid "No Customer found for Inter Company Transactions which represents company {0}" msgstr "" @@ -30440,7 +30461,7 @@ msgstr "" msgid "No Permission" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:786 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:787 msgid "No Purchase Orders were created" msgstr "" @@ -30450,7 +30471,7 @@ msgid "No Records for these settings." msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:337 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1107 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1105 msgid "No Remarks" msgstr "" @@ -30470,7 +30491,7 @@ msgstr "" msgid "No Summary" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2513 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2511 msgid "No Supplier found for Inter Company Transactions which represents company {0}" msgstr "" @@ -30494,12 +30515,12 @@ msgstr "" msgid "No Unreconciled Payments found for this party" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:783 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:784 #: erpnext/subcontracting/doctype/subcontracting_inward_order/subcontracting_inward_order.py:249 msgid "No Work Orders were created" msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:826 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:829 #: erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py:860 msgid "No accounting entries for the following warehouses" msgstr "" @@ -30573,7 +30594,7 @@ msgstr "" msgid "No matches occurred via auto reconciliation" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1034 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1036 msgid "No material request created" msgstr "" @@ -30655,7 +30676,7 @@ msgstr "" msgid "No open Material Requests found for the given criteria." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1190 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1188 msgid "No open POS Opening Entry found for POS Profile {0}." msgstr "" @@ -30729,7 +30750,7 @@ msgstr "" msgid "No rows with zero document count found" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:805 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:806 msgid "No stock ledger entries were created. Please set the quantity or valuation rate for the items properly and try again." msgstr "" @@ -30744,7 +30765,7 @@ msgstr "" msgid "No values" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2577 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2575 msgid "No {0} found for Inter Company Transactions." msgstr "" @@ -30785,7 +30806,7 @@ msgstr "" msgid "Non Profit" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1584 +#: erpnext/manufacturing/doctype/bom/bom.py:1590 msgid "Non stock items" msgstr "" @@ -30798,7 +30819,7 @@ msgstr "" msgid "Non-Zeros" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:557 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:558 msgid "None of the items have any change in quantity or value." msgstr "" @@ -30949,8 +30970,8 @@ msgstr "" #. Label of the notes (Text Editor) field in DocType 'Project' #. Label of the sb_01 (Section Break) field in DocType 'Quality Review' #. Label of the notes (Small Text) field in DocType 'Manufacturer' -#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:8 -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:40 +#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:12 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:44 #: erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.json #: erpnext/crm/doctype/contract_fulfilment_checklist/contract_fulfilment_checklist.json #: erpnext/crm/doctype/lead/lead.json @@ -30958,7 +30979,7 @@ msgstr "" #: erpnext/crm/doctype/prospect/prospect.json #: erpnext/projects/doctype/project/project.json #: erpnext/quality_management/doctype/quality_review/quality_review.json -#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:9 +#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:14 #: erpnext/stock/doctype/manufacturer/manufacturer.json #: erpnext/www/book_appointment/index.html:55 msgid "Notes" @@ -31300,7 +31321,7 @@ msgstr "" msgid "Once the Work Order is Closed. It can't be resumed." msgstr "" -#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:16 +#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:39 msgid "One customer can be part of only single Loyalty Program." msgstr "" @@ -31392,7 +31413,7 @@ msgstr "" msgid "Only one operation can have 'Is Final Finished Good' checked when 'Track Semi Finished Goods' is enabled." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1242 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1240 msgid "Only one {0} entry can be created against the Work Order {1}" msgstr "" @@ -31658,7 +31679,7 @@ msgid "Opening Invoice Tool" msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:1647 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1993 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1991 msgid "Opening Invoice has rounding adjustment of {0}.

      '{1}' account is required to post these values. Please set it in Company: {2}.

      Or, '{3}' can be enabled to not post any rounding adjustment." msgstr "" @@ -31746,7 +31767,7 @@ msgstr "" msgid "Operating Cost Per BOM Quantity" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1671 +#: erpnext/manufacturing/doctype/bom/bom.py:1677 msgid "Operating Cost as per Work Order / BOM" msgstr "" @@ -31841,11 +31862,11 @@ msgstr "" msgid "Operation {0} added multiple times in the work order {1}" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1229 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1228 msgid "Operation {0} does not belong to the work order {1}" msgstr "" -#: erpnext/manufacturing/doctype/workstation/workstation.py:433 +#: erpnext/manufacturing/doctype/workstation/workstation.py:430 msgid "Operation {0} longer than any available working hours in workstation {1}, break down the operation into multiple operations" msgstr "" @@ -32164,7 +32185,7 @@ msgstr "" msgid "Ordered Qty" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.js:179 +#: erpnext/manufacturing/doctype/production_plan/production_plan.js:205 msgid "Ordered Qty: Quantity ordered for purchase, but not received." msgstr "" @@ -32314,7 +32335,7 @@ msgstr "" msgid "Out of Order" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:568 +#: erpnext/stock/doctype/pick_list/pick_list.py:603 msgid "Out of Stock" msgstr "" @@ -32330,7 +32351,7 @@ msgstr "" msgid "Out of stock" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1203 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1201 #: erpnext/selling/page/point_of_sale/pos_controller.js:208 msgid "Outdated POS Opening Entry" msgstr "" @@ -32403,7 +32424,7 @@ msgstr "" msgid "Outstanding Amt" msgstr "" -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:44 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:48 msgid "Outstanding Cheques and Deposits to clear" msgstr "" @@ -32436,7 +32457,7 @@ msgstr "" msgid "Over Billing Allowance (%)" msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:1314 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:1317 msgid "Over Billing Allowance exceeded for Purchase Receipt Item {0} ({1}) by {2}%" msgstr "" @@ -32458,7 +32479,7 @@ msgstr "" msgid "Over Receipt" msgstr "" -#: erpnext/controllers/status_updater.py:476 +#: erpnext/controllers/status_updater.py:479 msgid "Over Receipt/Delivery of {0} {1} ignored for item {2} because you have {3} role." msgstr "" @@ -32478,7 +32499,7 @@ msgstr "" msgid "Over Withheld" msgstr "" -#: erpnext/controllers/status_updater.py:478 +#: erpnext/controllers/status_updater.py:481 msgid "Overbilling of {0} {1} ignored for item {2} because you have {3} role." msgstr "" @@ -32740,11 +32761,11 @@ msgstr "" msgid "POS Invoices can't be added when Sales Invoice is enabled" msgstr "" -#: erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py:662 +#: erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py:672 msgid "POS Invoices will be consolidated in a background process" msgstr "" -#: erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py:664 +#: erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py:674 msgid "POS Invoices will be unconsolidated in a background process" msgstr "" @@ -32764,7 +32785,7 @@ msgstr "" msgid "POS Opening Entry" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1204 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1202 msgid "POS Opening Entry - {0} is outdated. Please close the POS and create a new POS Opening Entry." msgstr "" @@ -32785,7 +32806,7 @@ msgstr "" msgid "POS Opening Entry Exists" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1189 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1187 msgid "POS Opening Entry Missing" msgstr "" @@ -32821,7 +32842,7 @@ msgstr "" msgid "POS Profile" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1197 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1195 msgid "POS Profile - {0} has multiple open POS Opening Entries. Please close or cancel the existing entries before proceeding." msgstr "" @@ -32839,11 +32860,11 @@ msgstr "" msgid "POS Profile doesn't match {}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1157 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1155 msgid "POS Profile is mandatory to mark this invoice as POS Transaction." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1386 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1384 msgid "POS Profile required to make POS Entry" msgstr "" @@ -33032,7 +33053,7 @@ msgstr "" #: erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py:165 #: erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py:201 #: erpnext/accounts/report/pos_register/pos_register.py:209 -#: erpnext/selling/page/point_of_sale/pos_payment.js:691 +#: erpnext/selling/page/point_of_sale/pos_payment.js:697 #: erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py:56 #: erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py:277 msgid "Paid Amount" @@ -33078,7 +33099,7 @@ msgid "Paid To Account Type" msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:327 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1153 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1151 msgid "Paid amount + Write Off Amount can not be greater than Grand Total" msgstr "" @@ -33290,7 +33311,7 @@ msgstr "" msgid "Partial Material Transferred" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1176 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1174 msgid "Partial Payment in POS Transactions are not allowed." msgstr "" @@ -33811,7 +33832,7 @@ msgstr "" #: erpnext/accounts/report/accounts_payable/accounts_payable.js:39 #: erpnext/accounts/report/accounts_receivable/accounts_receivable.py:1206 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:204 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:209 #: erpnext/accounts/report/purchase_register/purchase_register.py:194 #: erpnext/accounts/report/purchase_register/purchase_register.py:235 msgid "Payable Account" @@ -33892,14 +33913,14 @@ msgstr "" #. Payments' #: erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.json #: erpnext/accounts/doctype/bank_transaction_payments/bank_transaction_payments.json -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:70 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:74 #: erpnext/accounts/report/cheques_and_deposits_incorrectly_cleared/cheques_and_deposits_incorrectly_cleared.py:132 #: erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py:81 msgid "Payment Document" msgstr "" -#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:23 -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:64 +#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:26 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:68 #: erpnext/accounts/report/cheques_and_deposits_incorrectly_cleared/cheques_and_deposits_incorrectly_cleared.py:126 #: erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py:75 msgid "Payment Document Type" @@ -33942,7 +33963,7 @@ msgstr "" #: erpnext/accounts/doctype/payment_order/payment_order.js:27 #: erpnext/accounts/doctype/payment_order/payment_order.json #: erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html:12 -#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:29 +#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:32 #: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html:8 #: erpnext/accounts/workspace/invoicing/invoicing.json #: erpnext/workspace_sidebar/invoicing.json @@ -34039,7 +34060,7 @@ msgstr "" #: erpnext/accounts/report/pos_register/pos_register.js:50 #: erpnext/accounts/report/pos_register/pos_register.py:126 #: erpnext/accounts/report/pos_register/pos_register.py:216 -#: erpnext/selling/page/point_of_sale/pos_payment.js:22 +#: erpnext/selling/page/point_of_sale/pos_payment.js:25 msgid "Payment Method" msgstr "" @@ -34410,6 +34431,10 @@ msgstr "" msgid "Payment methods are mandatory. Please add at least one payment method." msgstr "" +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:3034 +msgid "Payment methods refreshed. Please review before proceeding." +msgstr "" + #: erpnext/accounts/doctype/pos_invoice/pos_invoice.js:466 #: erpnext/selling/page/point_of_sale/pos_payment.js:366 msgid "Payment of {0} received successfully." @@ -34461,7 +34486,7 @@ msgstr "" #: erpnext/buying/doctype/supplier/supplier_dashboard.py:12 #: erpnext/desktop_icon/payments.json #: erpnext/selling/doctype/customer/customer_dashboard.py:21 -#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:19 +#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:30 #: erpnext/workspace_sidebar/invoicing.json #: erpnext/workspace_sidebar/payments.json msgid "Payments" @@ -34540,7 +34565,7 @@ msgid "Pending Qty" msgstr "" #: erpnext/buying/report/subcontracted_item_to_be_received/subcontracted_item_to_be_received.py:55 -#: erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py:44 +#: erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py:45 msgid "Pending Quantity" msgstr "" @@ -34660,7 +34685,7 @@ msgid "Percentage you are allowed to transfer more against the quantity ordered. msgstr "" #: erpnext/setup/setup_wizard/data/sales_stage.txt:6 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:437 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:442 msgid "Perception Analysis" msgstr "" @@ -34907,7 +34932,7 @@ msgstr "" msgid "Pick List" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:231 +#: erpnext/stock/doctype/pick_list/pick_list.py:266 msgid "Pick List Incomplete" msgstr "" @@ -35159,7 +35184,7 @@ msgstr "" msgid "Planned Qty" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.js:179 +#: erpnext/manufacturing/doctype/production_plan/production_plan.js:199 msgid "Planned Qty: Quantity, for which, Work Order has been raised, but is pending to be manufactured." msgstr "" @@ -35226,7 +35251,7 @@ msgstr "" msgid "Plants and Machineries" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:565 +#: erpnext/stock/doctype/pick_list/pick_list.py:600 msgid "Please Restock Items and Update the Pick List to continue. To discontinue, cancel the Pick List." msgstr "" @@ -35313,7 +35338,7 @@ msgstr "" msgid "Please attach CSV file" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:3167 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:3173 msgid "Please cancel and amend the Payment Entry" msgstr "" @@ -35335,7 +35360,7 @@ msgstr "" msgid "Please check Multi Currency option to allow accounts with other currency" msgstr "" -#: erpnext/accounts/deferred_revenue.py:542 +#: erpnext/accounts/deferred_revenue.py:543 msgid "Please check Process Deferred Accounting {0} and submit manually after resolving errors." msgstr "" @@ -35432,7 +35457,7 @@ msgstr "" msgid "Please enable Applicable on Purchase Order and Applicable on Booking Actual Expenses" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:282 +#: erpnext/stock/doctype/pick_list/pick_list.py:317 msgid "Please enable Use Old Serial / Batch Fields to make_bundle" msgstr "" @@ -35444,7 +35469,7 @@ msgstr "" msgid "Please enable {0} in the {1}." msgstr "" -#: erpnext/controllers/selling_controller.py:854 +#: erpnext/controllers/selling_controller.py:857 msgid "Please enable {} in {} to allow same item in multiple rows" msgstr "" @@ -35456,20 +35481,20 @@ msgstr "" msgid "Please ensure that the {0} account {1} is a Payable account. You can change the account type to Payable or select a different account." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1013 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1011 msgid "Please ensure {} account is a Balance Sheet account." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1023 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1021 msgid "Please ensure {} account {} is a Receivable account." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:701 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:699 msgid "Please enter Difference Account or set default Stock Adjustment Account for company {0}" msgstr "" #: erpnext/accounts/doctype/pos_invoice/pos_invoice.py:554 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1288 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1286 msgid "Please enter Account for Change Amount" msgstr "" @@ -35477,11 +35502,11 @@ msgstr "" msgid "Please enter Approving Role or Approving User" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:678 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:679 msgid "Please enter Batch No" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:971 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:972 msgid "Please enter Cost Center" msgstr "" @@ -35493,7 +35518,7 @@ msgstr "" msgid "Please enter Employee Id of this sales person" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:980 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:981 msgid "Please enter Expense Account" msgstr "" @@ -35502,7 +35527,7 @@ msgstr "" msgid "Please enter Item Code to get Batch Number" msgstr "" -#: erpnext/public/js/controllers/transaction.js:3066 +#: erpnext/public/js/controllers/transaction.js:3069 msgid "Please enter Item Code to get batch no" msgstr "" @@ -35542,7 +35567,7 @@ msgstr "" msgid "Please enter Root Type for account- {0}" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:680 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:681 msgid "Please enter Serial No" msgstr "" @@ -35559,7 +35584,7 @@ msgid "Please enter Warehouse and Date" msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:662 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1284 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1282 msgid "Please enter Write Off Account" msgstr "" @@ -35619,7 +35644,7 @@ msgstr "" msgid "Please enter the phone number first" msgstr "" -#: erpnext/controllers/buying_controller.py:1187 +#: erpnext/controllers/buying_controller.py:1184 msgid "Please enter the {schedule_date}." msgstr "" @@ -35734,7 +35759,7 @@ msgstr "" msgid "Please select Apply Discount On" msgstr "" -#: erpnext/selling/doctype/sales_order/sales_order.py:1784 +#: erpnext/selling/doctype/sales_order/sales_order.py:1780 msgid "Please select BOM against item {0}" msgstr "" @@ -35822,11 +35847,11 @@ msgstr "" msgid "Please select Posting Date first" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1237 +#: erpnext/manufacturing/doctype/bom/bom.py:1243 msgid "Please select Price List" msgstr "" -#: erpnext/selling/doctype/sales_order/sales_order.py:1786 +#: erpnext/selling/doctype/sales_order/sales_order.py:1782 msgid "Please select Qty against item {0}" msgstr "" @@ -35846,7 +35871,7 @@ msgstr "" msgid "Please select Stock Asset Account" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1606 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1604 msgid "Please select Subcontracting Order instead of Purchase Order {0}" msgstr "" @@ -35854,20 +35879,20 @@ msgstr "" msgid "Please select Unrealized Profit / Loss account or add default Unrealized Profit / Loss account account for company {0}" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1492 +#: erpnext/manufacturing/doctype/bom/bom.py:1498 msgid "Please select a BOM" msgstr "" #: erpnext/accounts/party.py:417 -#: erpnext/stock/doctype/pick_list/pick_list.py:1617 +#: erpnext/stock/doctype/pick_list/pick_list.py:1656 msgid "Please select a Company" msgstr "" #: erpnext/accounts/doctype/payment_entry/payment_entry.js:268 -#: erpnext/manufacturing/doctype/bom/bom.js:687 +#: erpnext/manufacturing/doctype/bom/bom.js:688 #: erpnext/manufacturing/doctype/bom/bom.py:276 #: erpnext/public/js/controllers/accounts.js:277 -#: erpnext/public/js/controllers/transaction.js:3365 +#: erpnext/public/js/controllers/transaction.js:3368 msgid "Please select a Company first." msgstr "" @@ -35891,7 +35916,7 @@ msgstr "" msgid "Please select a Warehouse" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1570 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1569 msgid "Please select a Work Order first." msgstr "" @@ -35960,7 +35985,7 @@ msgstr "" msgid "Please select at least one row with difference value" msgstr "" -#: erpnext/public/js/controllers/transaction.js:519 +#: erpnext/public/js/controllers/transaction.js:520 msgid "Please select at least one schedule." msgstr "" @@ -36070,7 +36095,7 @@ msgstr "" msgid "Please set Account" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1884 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1882 msgid "Please set Account for Change Amount" msgstr "" @@ -36201,7 +36226,7 @@ msgstr "" msgid "Please set both the Tax ID and Fiscal Code on Company {0}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2421 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2419 msgid "Please set default Cash or Bank account in Mode of Payment {0}" msgstr "" @@ -36250,11 +36275,11 @@ msgstr "" msgid "Please set one of the following:" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:647 +#: erpnext/assets/doctype/asset/asset.py:645 msgid "Please set opening number of booked depreciations" msgstr "" -#: erpnext/public/js/controllers/transaction.js:2753 +#: erpnext/public/js/controllers/transaction.js:2756 msgid "Please set recurring after saving" msgstr "" @@ -36270,11 +36295,11 @@ msgstr "" msgid "Please set the Item Code first" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1633 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1632 msgid "Please set the Target Warehouse in the Job Card" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1637 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1636 msgid "Please set the WIP Warehouse in the Job Card" msgstr "" @@ -36348,7 +36373,7 @@ msgstr "" msgid "Please specify at least one attribute in the Attributes table" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:618 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:619 msgid "Please specify either Quantity or Valuation Rate or both" msgstr "" @@ -36482,7 +36507,9 @@ msgstr "" #. Label of the posting_date (Date) field in DocType 'Process Statement Of #. Accounts' #. Label of the posting_date (Date) field in DocType 'Process Subscription' +#. Label of the posting_date (Date) field in DocType 'Purchase Invoice' #. Label of the posting_date (Date) field in DocType 'Repost Payment Ledger' +#. Label of the posting_date (Date) field in DocType 'Sales Invoice' #. Label of the posting_date (Date) field in DocType 'Asset Capitalization' #. Label of the posting_date (Date) field in DocType 'Job Card' #. Label of the posting_date (Date) field in DocType 'Master Production @@ -36517,21 +36544,23 @@ msgstr "" #: erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.json #: erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json #: erpnext/accounts/doctype/process_subscription/process_subscription.json +#: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json #: erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.json +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.json #: erpnext/accounts/report/accounts_payable/accounts_payable.js:16 #: erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js:15 #: erpnext/accounts/report/accounts_receivable/accounts_receivable.js:18 #: erpnext/accounts/report/accounts_receivable/accounts_receivable.py:1189 #: erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js:15 -#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:35 +#: erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py:38 #: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html:7 -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:61 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:65 #: erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py:66 #: erpnext/accounts/report/cheques_and_deposits_incorrectly_cleared/cheques_and_deposits_incorrectly_cleared.py:151 #: erpnext/accounts/report/general_ledger/general_ledger.py:679 #: erpnext/accounts/report/gross_profit/gross_profit.py:300 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:176 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:193 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:181 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:200 #: erpnext/accounts/report/payment_ledger/payment_ledger.py:143 #: erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py:94 #: erpnext/accounts/report/pos_register/pos_register.py:172 @@ -36581,7 +36610,7 @@ msgstr "" msgid "Posting Date cannot be future date" msgstr "" -#: erpnext/public/js/controllers/transaction.js:1105 +#: erpnext/public/js/controllers/transaction.js:1108 msgid "Posting Date will change to today's date as Edit Posting Date and Time is unchecked. Are you sure want to proceed?" msgstr "" @@ -36644,7 +36673,7 @@ msgstr "" msgid "Posting Time" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:2335 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:2333 msgid "Posting date and posting time is mandatory" msgstr "" @@ -36920,7 +36949,7 @@ msgstr "" msgid "Price List Currency" msgstr "" -#: erpnext/stock/get_item_details.py:1278 +#: erpnext/stock/get_item_details.py:1315 msgid "Price List Currency not selected" msgstr "" @@ -37133,11 +37162,11 @@ msgstr "" msgid "Pricing Rule Item Group" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:44 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:71 msgid "Pricing Rule is first selected based on 'Apply On' field, which can be Item, Item Group or Brand." msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:40 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:48 msgid "Pricing Rule is made to overwrite Price List / define discount percentage, based on some criteria." msgstr "" @@ -37199,7 +37228,7 @@ msgstr "" msgid "Pricing Rules" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:46 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:79 msgid "Pricing Rules are further filtered based on quantity." msgstr "" @@ -37420,7 +37449,7 @@ msgstr "" msgid "Process Loss" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1220 +#: erpnext/manufacturing/doctype/bom/bom.py:1226 msgid "Process Loss Percentage cannot be greater than 100" msgstr "" @@ -37795,20 +37824,17 @@ msgstr "" #. Label of the production_plan_sub_assembly_item (Data) field in DocType #. 'Purchase Order Item' #. Name of a DocType +#. Label of the production_plan_sub_assembly_item (Data) field in DocType 'Work +#. Order' #. Label of the production_plan_sub_assembly_item (Data) field in DocType #. 'Subcontracting Order Item' #: erpnext/buying/doctype/purchase_order_item/purchase_order_item.json #: erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.json +#: erpnext/manufacturing/doctype/work_order/work_order.json #: erpnext/subcontracting/doctype/subcontracting_order_item/subcontracting_order_item.json msgid "Production Plan Sub Assembly Item" msgstr "" -#. Label of the production_plan_sub_assembly_item (Data) field in DocType 'Work -#. Order' -#: erpnext/manufacturing/doctype/work_order/work_order.json -msgid "Production Plan Sub-assembly Item" -msgstr "" - #. Name of a report #: erpnext/manufacturing/doctype/production_plan/production_plan.js:110 #: erpnext/manufacturing/report/production_plan_summary/production_plan_summary.json @@ -38062,7 +38088,7 @@ msgstr "" msgid "Projected Quantity" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.js:179 +#: erpnext/manufacturing/doctype/production_plan/production_plan.js:184 msgid "Projected Quantity Formula" msgstr "" @@ -38167,7 +38193,7 @@ msgid "Proposal Writing" msgstr "" #: erpnext/setup/setup_wizard/data/sales_stage.txt:7 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:438 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:443 msgid "Proposal/Price Quote" msgstr "" @@ -38208,7 +38234,7 @@ msgid "Prospect {0} already exists" msgstr "" #: erpnext/setup/setup_wizard/data/sales_stage.txt:1 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:432 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:437 msgid "Prospecting" msgstr "" @@ -38457,8 +38483,8 @@ msgstr "" msgid "Purchase Invoice cannot be made against an existing asset {0}" msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:446 -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:460 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:449 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:463 msgid "Purchase Invoice {0} is already submitted" msgstr "" @@ -38490,7 +38516,7 @@ msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js:145 #: erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json #: erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:232 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:237 #: erpnext/accounts/report/purchase_register/purchase_register.py:216 #: erpnext/buying/doctype/purchase_order/purchase_order.json #: erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json @@ -38681,7 +38707,7 @@ msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js:632 #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js:49 #: erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:239 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:244 #: erpnext/accounts/report/purchase_register/purchase_register.py:223 #: erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.js:22 #: erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py:21 @@ -38893,7 +38919,7 @@ msgstr "" msgid "Purpose" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:515 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:516 msgid "Purpose must be one of {0}" msgstr "" @@ -38958,7 +38984,7 @@ msgstr "" #: erpnext/controllers/trends.py:268 erpnext/controllers/trends.py:280 #: erpnext/controllers/trends.py:285 #: erpnext/crm/doctype/opportunity_item/opportunity_item.json -#: erpnext/manufacturing/doctype/bom/bom.js:1085 +#: erpnext/manufacturing/doctype/bom/bom.js:1086 #: erpnext/manufacturing/doctype/bom_creator_item/bom_creator_item.json #: erpnext/manufacturing/doctype/bom_item/bom_item.json #: erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json @@ -39078,7 +39104,7 @@ msgstr "" #. Label of the for_quantity (Float) field in DocType 'Job Card' #. Label of the qty (Float) field in DocType 'Work Order' -#: erpnext/manufacturing/doctype/bom/bom.js:366 +#: erpnext/manufacturing/doctype/bom/bom.js:367 #: erpnext/manufacturing/doctype/job_card/job_card.json #: erpnext/manufacturing/doctype/work_order/work_order.json #: erpnext/manufacturing/report/process_loss_report/process_loss_report.py:82 @@ -39158,7 +39184,7 @@ msgstr "" msgid "Qty of Finished Goods Item" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:612 +#: erpnext/stock/doctype/pick_list/pick_list.py:647 msgid "Qty of Finished Goods Item should be greater than 0." msgstr "" @@ -39192,7 +39218,7 @@ msgid "Qty to Fetch" msgstr "" #: erpnext/manufacturing/doctype/job_card/job_card.js:304 -#: erpnext/manufacturing/doctype/job_card/job_card.py:872 +#: erpnext/manufacturing/doctype/job_card/job_card.py:871 msgid "Qty to Manufacture" msgstr "" @@ -39221,7 +39247,7 @@ msgstr "" #: erpnext/crm/doctype/lead/lead.json #: erpnext/setup/doctype/employee_education/employee_education.json #: erpnext/setup/setup_wizard/data/sales_stage.txt:2 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:433 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:438 msgid "Qualification" msgstr "" @@ -39423,17 +39449,17 @@ msgstr "" msgid "Quality Inspection Template Name" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:781 +#: erpnext/manufacturing/doctype/job_card/job_card.py:780 msgid "Quality Inspection is required for the item {0} before completing the job card {1}" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:792 -#: erpnext/manufacturing/doctype/job_card/job_card.py:801 +#: erpnext/manufacturing/doctype/job_card/job_card.py:791 +#: erpnext/manufacturing/doctype/job_card/job_card.py:800 msgid "Quality Inspection {0} is not submitted for the item: {1}" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:811 -#: erpnext/manufacturing/doctype/job_card/job_card.py:820 +#: erpnext/manufacturing/doctype/job_card/job_card.py:810 +#: erpnext/manufacturing/doctype/job_card/job_card.py:819 msgid "Quality Inspection {0} is rejected for the item: {1}" msgstr "" @@ -39569,7 +39595,7 @@ msgstr "" #: erpnext/buying/report/purchase_analytics/purchase_analytics.js:28 #: erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py:213 #: erpnext/manufacturing/doctype/blanket_order_item/blanket_order_item.json -#: erpnext/manufacturing/doctype/bom/bom.js:453 +#: erpnext/manufacturing/doctype/bom/bom.js:454 #: erpnext/manufacturing/doctype/bom/bom.json #: erpnext/manufacturing/doctype/bom_creator/bom_creator.js:69 #: erpnext/manufacturing/doctype/bom_creator/bom_creator.json @@ -39581,7 +39607,7 @@ msgstr "" #: erpnext/public/js/utils/serial_no_batch_selector.js:486 #: erpnext/selling/doctype/quotation_item/quotation_item.json #: erpnext/selling/doctype/sales_order_item/sales_order_item.json -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:46 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:51 #: erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py:42 #: erpnext/selling/report/sales_analytics/sales_analytics.js:44 #: erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py:67 @@ -39591,7 +39617,7 @@ msgstr "" #: erpnext/stock/doctype/material_request_item/material_request_item.json #: erpnext/stock/doctype/packing_slip_item/packing_slip_item.json #: erpnext/stock/doctype/pick_list_item/pick_list_item.json -#: erpnext/stock/doctype/stock_entry/stock_entry.js:726 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:728 #: erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json #: erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json #: erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py:36 @@ -39689,7 +39715,7 @@ msgstr "" msgid "Quantity and Warehouse" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:202 +#: erpnext/stock/doctype/material_request/material_request.py:210 msgid "Quantity cannot be greater than {0} for Item {1}" msgstr "" @@ -39734,7 +39760,7 @@ msgstr "" msgid "Quantity to Manufacture" msgstr "" -#: erpnext/manufacturing/doctype/work_order/work_order.py:2587 +#: erpnext/manufacturing/doctype/work_order/work_order.py:2592 msgid "Quantity to Manufacture can not be zero for the operation {0}" msgstr "" @@ -40003,8 +40029,8 @@ msgstr "" #: erpnext/accounts/doctype/share_transfer/share_transfer.json #: erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html:92 #: erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py:78 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:261 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:313 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:266 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:320 #: erpnext/accounts/report/share_ledger/share_ledger.py:56 #: erpnext/assets/doctype/asset_capitalization_service_item/asset_capitalization_service_item.json #: erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -40341,8 +40367,8 @@ msgstr "" #. Label of the materials_section (Section Break) field in DocType 'BOM' #. Label of the section_break_8 (Section Break) field in DocType 'Job Card' #. Label of the mr_items (Table) field in DocType 'Production Plan' -#: erpnext/manufacturing/doctype/bom/bom.js:406 -#: erpnext/manufacturing/doctype/bom/bom.js:1058 +#: erpnext/manufacturing/doctype/bom/bom.js:407 +#: erpnext/manufacturing/doctype/bom/bom.js:1059 #: erpnext/manufacturing/doctype/bom/bom.json #: erpnext/manufacturing/doctype/job_card/job_card.json #: erpnext/manufacturing/doctype/production_plan/production_plan.json @@ -40372,7 +40398,7 @@ msgstr "" msgid "Raw Materials Consumption" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:318 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:319 msgid "Raw Materials Missing" msgstr "" @@ -40610,7 +40636,7 @@ msgstr "" #: erpnext/accounts/report/accounts_receivable/accounts_receivable.js:68 #: erpnext/accounts/report/accounts_receivable/accounts_receivable.py:1204 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:234 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:241 #: erpnext/accounts/report/sales_register/sales_register.py:217 #: erpnext/accounts/report/sales_register/sales_register.py:271 msgid "Receivable Account" @@ -40764,11 +40790,11 @@ msgstr "" #: erpnext/selling/page/point_of_sale/pos_controller.js:260 #: erpnext/selling/page/point_of_sale/pos_controller.js:270 -#: erpnext/selling/page/point_of_sale/pos_past_order_list.js:17 +#: erpnext/selling/page/point_of_sale/pos_past_order_list.js:19 msgid "Recent Orders" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:891 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:913 msgid "Recent Transactions" msgstr "" @@ -40970,7 +40996,7 @@ msgstr "" msgid "Ref Code" msgstr "" -#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:97 +#: erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py:101 msgid "Ref Date" msgstr "" @@ -40978,7 +41004,7 @@ msgstr "" msgid "Reference #{0} dated {1}" msgstr "" -#: erpnext/public/js/controllers/transaction.js:2866 +#: erpnext/public/js/controllers/transaction.js:2869 msgid "Reference Date for Early Payment Discount" msgstr "" @@ -41140,7 +41166,7 @@ msgstr "" msgid "Refresh Plaid Link" msgstr "" -#: erpnext/stock/reorder_item.py:402 +#: erpnext/stock/reorder_item.py:391 msgid "Regards," msgstr "" @@ -41365,11 +41391,11 @@ msgstr "" msgid "Remove Zero Counts" msgstr "" -#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:9 +#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:21 msgid "Remove item if charges is not applicable to that item" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:564 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:565 msgid "Removed items with no change in quantity or value." msgstr "" @@ -41413,9 +41439,9 @@ msgstr "" msgid "Renaming it is only allowed via parent company {0}, to avoid mismatch." msgstr "" -#: erpnext/manufacturing/doctype/workstation/test_workstation.py:80 -#: erpnext/manufacturing/doctype/workstation/test_workstation.py:91 -#: erpnext/manufacturing/doctype/workstation/test_workstation.py:118 +#: erpnext/manufacturing/doctype/workstation/test_workstation.py:78 +#: erpnext/manufacturing/doctype/workstation/test_workstation.py:89 +#: erpnext/manufacturing/doctype/workstation/test_workstation.py:116 #: erpnext/patches/v16_0/make_workstation_operating_components.py:49 #: erpnext/setup/setup_wizard/operations/install_fixtures.py:316 msgid "Rent" @@ -41813,16 +41839,18 @@ msgstr "" #. Item' #. Label of the requested_qty (Float) field in DocType 'Sales Order Item' #. Label of the indented_qty (Float) field in DocType 'Bin' +#. Label of the requested_qty (Float) field in DocType 'Packed Item' #: erpnext/manufacturing/doctype/job_card/job_card.json #: erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json #: erpnext/selling/doctype/sales_order_item/sales_order_item.json #: erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py:44 #: erpnext/stock/doctype/bin/bin.json +#: erpnext/stock/doctype/packed_item/packed_item.json #: erpnext/stock/report/stock_projected_qty/stock_projected_qty.py:155 msgid "Requested Qty" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.js:179 +#: erpnext/manufacturing/doctype/production_plan/production_plan.js:202 msgid "Requested Qty: Quantity requested for purchase, but not ordered." msgstr "" @@ -42072,7 +42100,7 @@ msgstr "" msgid "Reserved Qty for Production Plan" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.js:179 +#: erpnext/manufacturing/doctype/production_plan/production_plan.js:211 msgid "Reserved Qty for Production: Raw materials quantity to make manufacturing items." msgstr "" @@ -42081,7 +42109,7 @@ msgstr "" msgid "Reserved Qty for Subcontract" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.js:179 +#: erpnext/manufacturing/doctype/production_plan/production_plan.js:214 msgid "Reserved Qty for Subcontract: Raw materials quantity to make subcontracted items." msgstr "" @@ -42089,7 +42117,7 @@ msgstr "" msgid "Reserved Qty should be greater than Delivered Qty." msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.js:179 +#: erpnext/manufacturing/doctype/production_plan/production_plan.js:208 msgid "Reserved Qty: Quantity ordered for sale, but not delivered." msgstr "" @@ -42101,7 +42129,7 @@ msgstr "" msgid "Reserved Quantity for Production" msgstr "" -#: erpnext/stock/stock_ledger.py:2284 +#: erpnext/stock/stock_ledger.py:2287 msgid "Reserved Serial No." msgstr "" @@ -42117,13 +42145,13 @@ msgstr "" #: erpnext/stock/doctype/pick_list/pick_list.js:170 #: erpnext/stock/report/reserved_stock/reserved_stock.json #: erpnext/stock/report/stock_balance/stock_balance.py:572 -#: erpnext/stock/stock_ledger.py:2268 +#: erpnext/stock/stock_ledger.py:2271 #: erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js:205 #: erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js:333 msgid "Reserved Stock" msgstr "" -#: erpnext/stock/stock_ledger.py:2313 +#: erpnext/stock/stock_ledger.py:2316 msgid "Reserved Stock for Batch" msgstr "" @@ -42526,7 +42554,7 @@ msgstr "" msgid "Return Raw Material to Customer" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1527 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1525 msgid "Return invoice of asset cancelled" msgstr "" @@ -42546,7 +42574,7 @@ msgstr "" #. Option for the 'Tracking Status' (Select) field in DocType 'Shipment' #. Option for the 'Status' (Select) field in DocType 'Subcontracting Inward #. Order' -#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:138 +#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:139 #: erpnext/stock/doctype/shipment/shipment.json #: erpnext/subcontracting/doctype/subcontracting_inward_order/subcontracting_inward_order.json msgid "Returned" @@ -42602,6 +42630,10 @@ msgstr "" msgid "Returned Qty in Stock UOM" msgstr "" +#: erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py:44 +msgid "Returned Quantity" +msgstr "" + #: erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py:101 msgid "Returned exchange rate is neither integer not float." msgstr "" @@ -43052,12 +43084,12 @@ msgid "Row #1: Sequence ID must be 1 for Operation {0}." msgstr "" #: erpnext/accounts/doctype/pos_invoice/pos_invoice.py:563 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2076 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2074 msgid "Row #{0} (Payment Table): Amount must be negative" msgstr "" #: erpnext/accounts/doctype/pos_invoice/pos_invoice.py:561 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2071 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2069 msgid "Row #{0} (Payment Table): Amount must be positive" msgstr "" @@ -43171,7 +43203,7 @@ msgstr "" msgid "Row #{0}: Cannot set Rate if the billed amount is greater than the amount for Item {1}." msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1110 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1109 msgid "Row #{0}: Cannot transfer more than Required Qty {1} for Item {2} against Job Card {3}" msgstr "" @@ -43254,7 +43286,7 @@ msgstr "" msgid "Row #{0}: Default BOM not found for FG Item {1}" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:683 +#: erpnext/assets/doctype/asset/asset.py:681 msgid "Row #{0}: Depreciation Start Date is required" msgstr "" @@ -43289,7 +43321,7 @@ msgstr "" msgid "Row #{0}: Finished Good Item {1} must be a sub-contracted item" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:471 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:472 msgid "Row #{0}: Finished Good must be {1}" msgstr "" @@ -43310,7 +43342,7 @@ msgstr "" msgid "Row #{0}: For {1}, you can select reference document only if account gets debited" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:666 +#: erpnext/assets/doctype/asset/asset.py:664 msgid "Row #{0}: Frequency of Depreciation must be greater than zero" msgstr "" @@ -43318,7 +43350,7 @@ msgstr "" msgid "Row #{0}: From Date cannot be before To Date" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:862 +#: erpnext/manufacturing/doctype/job_card/job_card.py:861 msgid "Row #{0}: From Time and To Time fields are required" msgstr "" @@ -43326,7 +43358,7 @@ msgstr "" msgid "Row #{0}: Item added" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1537 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1535 msgid "Row #{0}: Item {1} cannot be transferred more than {2} against {3} {4}" msgstr "" @@ -43354,7 +43386,7 @@ msgstr "" msgid "Row #{0}: Item {1} is not a Customer Provided Item." msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:761 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:762 msgid "Row #{0}: Item {1} is not a Serialized/Batched Item. It cannot have a Serial No/Batch No against it." msgstr "" @@ -43383,11 +43415,11 @@ msgstr "" msgid "Row #{0}: Journal Entry {1} does not have account {2} or already matched against another voucher" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:677 +#: erpnext/assets/doctype/asset/asset.py:675 msgid "Row #{0}: Next Depreciation Date cannot be before Available-for-use Date" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:672 +#: erpnext/assets/doctype/asset/asset.py:670 msgid "Row #{0}: Next Depreciation Date cannot be before Purchase Date" msgstr "" @@ -43399,11 +43431,11 @@ msgstr "" msgid "Row #{0}: Only {1} available to reserve for the Item {2}" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:640 +#: erpnext/assets/doctype/asset/asset.py:638 msgid "Row #{0}: Opening Accumulated Depreciation must be less than or equal to {1}" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:870 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:868 msgid "Row #{0}: Operation {1} is not completed for {2} qty of finished goods in Work Order {3}. Please update operation status via Job Card {4}." msgstr "" @@ -43412,11 +43444,11 @@ msgstr "" msgid "Row #{0}: Overconsumption of Customer Provided Item {1} against Work Order {2} is not allowed in the Subcontracting Inward process." msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1049 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1051 msgid "Row #{0}: Please select Item Code in Assembly Items" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1052 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1054 msgid "Row #{0}: Please select the BOM No in Assembly Items" msgstr "" @@ -43424,7 +43456,7 @@ msgstr "" msgid "Row #{0}: Please select the Finished Good Item against which this Customer Provided Item will be used." msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1046 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1048 msgid "Row #{0}: Please select the Sub Assembly Warehouse" msgstr "" @@ -43564,7 +43596,7 @@ msgstr "" msgid "Row #{0}: Set Supplier for item {1}" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1056 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1058 msgid "Row #{0}: Since 'Track Semi Finished Goods' is enabled, the BOM {1} cannot be used for Sub Assembly Items" msgstr "" @@ -43580,19 +43612,15 @@ msgstr "" msgid "Row #{0}: Source Warehouse {1} for item {2} must be same as Source Warehouse {3} in the Work Order." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1017 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1015 msgid "Row #{0}: Source and Target Warehouse cannot be the same for Material Transfer" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1039 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1037 msgid "Row #{0}: Source, Target Warehouse and Inventory Dimensions cannot be the exact same for Material Transfer" msgstr "" #: erpnext/manufacturing/doctype/workstation/workstation.py:105 -msgid "Row #{0}: Start Time and End Time are required" -msgstr "" - -#: erpnext/manufacturing/doctype/workstation/workstation.py:108 msgid "Row #{0}: Start Time must be before End Time" msgstr "" @@ -43633,7 +43661,7 @@ msgstr "" msgid "Row #{0}: Stock not available to reserve for the Item {1} in Warehouse {2}." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1270 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1268 msgid "Row #{0}: Stock quantity {1} ({2}) for item {3} cannot exceed {4}" msgstr "" @@ -43649,15 +43677,15 @@ msgstr "" msgid "Row #{0}: The warehouse {1} is not a child warehouse of a group warehouse {2}" msgstr "" -#: erpnext/manufacturing/doctype/workstation/workstation.py:181 +#: erpnext/manufacturing/doctype/workstation/workstation.py:178 msgid "Row #{0}: Timings conflicts with row {1}" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:653 +#: erpnext/assets/doctype/asset/asset.py:651 msgid "Row #{0}: Total Number of Depreciations cannot be less than or equal to Opening Number of Booked Depreciations" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:662 +#: erpnext/assets/doctype/asset/asset.py:660 msgid "Row #{0}: Total Number of Depreciations must be greater than zero" msgstr "" @@ -43733,7 +43761,7 @@ msgstr "" msgid "Row #{idx}: {from_warehouse_field} and {to_warehouse_field} cannot be same." msgstr "" -#: erpnext/controllers/buying_controller.py:1179 +#: erpnext/controllers/buying_controller.py:1176 msgid "Row #{idx}: {schedule_date} cannot be before {transaction_date}." msgstr "" @@ -43777,7 +43805,7 @@ msgstr "" msgid "Row #{}: You cannot add positive quantities in a return invoice. Please remove item {} to complete the return." msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:198 +#: erpnext/stock/doctype/pick_list/pick_list.py:233 msgid "Row #{}: item {} has been picked already." msgstr "" @@ -43798,15 +43826,15 @@ msgstr "" msgid "Row No {0}: Warehouse is required. Please set a Default Warehouse for Item {1} and Company {2}" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:729 +#: erpnext/manufacturing/doctype/job_card/job_card.py:728 msgid "Row {0} : Operation is required against the raw material item {1}" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:228 +#: erpnext/stock/doctype/pick_list/pick_list.py:263 msgid "Row {0} picked quantity is less than the required quantity, additional {1} {2} required." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1561 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1559 msgid "Row {0}# Item {1} not found in 'Raw Materials Supplied' table in {2} {3}" msgstr "" @@ -43838,11 +43866,11 @@ msgstr "" msgid "Row {0}: Allocated amount {1} must be less than or equal to remaining payment amount {2}" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1222 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1220 msgid "Row {0}: As {1} is enabled, raw materials cannot be added to {2} entry. Use {3} entry to consume raw materials." msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:888 +#: erpnext/stock/doctype/material_request/material_request.py:854 msgid "Row {0}: Bill of Materials not found for the Item {1}" msgstr "" @@ -43880,7 +43908,7 @@ msgstr "" msgid "Row {0}: Debit entry can not be linked with a {1}" msgstr "" -#: erpnext/controllers/selling_controller.py:876 +#: erpnext/controllers/selling_controller.py:879 msgid "Row {0}: Delivery Warehouse ({1}) and Customer Warehouse ({2}) can not be same" msgstr "" @@ -43901,11 +43929,11 @@ msgstr "" msgid "Row {0}: Exchange Rate is mandatory" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:611 +#: erpnext/assets/doctype/asset/asset.py:609 msgid "Row {0}: Expected Value After Useful Life cannot be negative" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:614 +#: erpnext/assets/doctype/asset/asset.py:612 msgid "Row {0}: Expected Value After Useful Life must be less than Net Purchase Amount" msgstr "" @@ -43958,7 +43986,7 @@ msgstr "" msgid "Row {0}: Item Tax template updated as per validity and rate applied" msgstr "" -#: erpnext/controllers/selling_controller.py:641 +#: erpnext/controllers/selling_controller.py:644 msgid "Row {0}: Item rate has been updated as per valuation rate since its an internal stock transfer" msgstr "" @@ -43978,6 +44006,10 @@ msgstr "" msgid "Row {0}: Item {1}'s quantity cannot be higher than the available quantity." msgstr "" +#: erpnext/manufacturing/doctype/bom/bom.py:1209 +msgid "Row {0}: Operation time should be greater than 0 for operation {1}" +msgstr "" + #: erpnext/stock/doctype/delivery_note/delivery_note.py:614 msgid "Row {0}: Packed Qty must be equal to {1} Qty." msgstr "" @@ -44046,7 +44078,7 @@ msgstr "" msgid "Row {0}: Qty cannot be greater than {1} for the Item {2}." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:562 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:563 msgid "Row {0}: Qty in Stock UOM can not be zero." msgstr "" @@ -44058,7 +44090,7 @@ msgstr "" msgid "Row {0}: Quantity cannot be negative." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:944 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:942 msgid "Row {0}: Quantity not available for {4} in warehouse {1} at posting time of the entry ({2} {3})" msgstr "" @@ -44070,7 +44102,7 @@ msgstr "" msgid "Row {0}: Shift cannot be changed since the depreciation has already been processed" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1574 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1572 msgid "Row {0}: Subcontracted Item is mandatory for the raw material {1}" msgstr "" @@ -44086,7 +44118,7 @@ msgstr "" msgid "Row {0}: The entire expense amount for account {1} in {2} has already been allocated." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:608 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:609 msgid "Row {0}: The item {1}, quantity must be positive number" msgstr "" @@ -44098,14 +44130,22 @@ msgstr "" msgid "Row {0}: To set {1} periodicity, difference between from and to date must be greater than or equal to {2}" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3364 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3362 msgid "Row {0}: Transferred quantity cannot be greater than the requested quantity." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:556 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:557 msgid "Row {0}: UOM Conversion Factor is mandatory" msgstr "" +#: erpnext/stock/doctype/pick_list/pick_list.py:169 +msgid "Row {0}: Warehouse is required" +msgstr "" + +#: erpnext/stock/doctype/pick_list/pick_list.py:178 +msgid "Row {0}: Warehouse {1} is linked to company {2}. Please select a warehouse belonging to company {3}." +msgstr "" + #: erpnext/manufacturing/doctype/bom/bom.py:1203 #: erpnext/manufacturing/doctype/work_order/work_order.py:415 msgid "Row {0}: Workstation or Workstation Type is mandatory for an operation {1}" @@ -44609,7 +44649,7 @@ msgstr "" #: erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json #: erpnext/accounts/doctype/sales_invoice/sales_invoice.js:278 #: erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:277 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:284 #: erpnext/accounts/report/sales_register/sales_register.py:238 #: erpnext/buying/doctype/purchase_order_item/purchase_order_item.json #: erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json @@ -44757,7 +44797,7 @@ msgstr "" msgid "Sales Order {0} already exists against Customer's Purchase Order {1}. To allow multiple Sales Orders, Enable {2} in {3}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1400 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1398 msgid "Sales Order {0} is not submitted" msgstr "" @@ -45167,7 +45207,7 @@ msgstr "" msgid "Same Item" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:600 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:601 msgid "Same item and warehouse combination already entered." msgstr "" @@ -45199,12 +45239,12 @@ msgstr "" #. Label of the sample_size (Float) field in DocType 'Quality Inspection' #: erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py:93 -#: erpnext/public/js/controllers/transaction.js:2923 +#: erpnext/public/js/controllers/transaction.js:2926 #: erpnext/stock/doctype/quality_inspection/quality_inspection.json msgid "Sample Size" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3854 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3852 msgid "Sample quantity {0} cannot be more than received quantity {1}" msgstr "" @@ -45338,7 +45378,7 @@ msgstr "" msgid "Scheduler is Inactive. Can't trigger jobs now." msgstr "" -#: erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py:671 +#: erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py:681 msgid "Scheduler is inactive. Cannot enqueue job." msgstr "" @@ -45678,7 +45718,7 @@ msgstr "" msgid "Select Items based on Delivery Date" msgstr "" -#: erpnext/public/js/controllers/transaction.js:2962 +#: erpnext/public/js/controllers/transaction.js:2965 msgid "Select Items for Quality Inspection" msgstr "" @@ -45795,10 +45835,6 @@ msgstr "" msgid "Select a Supplier" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.js:419 -msgid "Select a Supplier from the Default Suppliers of the items below. On selection, a Purchase Order will be made against items belonging to the selected Supplier only." -msgstr "" - #: erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js:161 msgid "Select a company" msgstr "" @@ -45811,7 +45847,7 @@ msgstr "" msgid "Select an account to print in account currency" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:19 +#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:21 msgid "Select an invoice to load summary data" msgstr "" @@ -45819,7 +45855,7 @@ msgstr "" msgid "Select an item from each set to be used in the Sales Order." msgstr "" -#: erpnext/stock/doctype/item/item.js:746 +#: erpnext/stock/doctype/item/item.js:747 msgid "Select at least one value from each of the attributes." msgstr "" @@ -45841,7 +45877,7 @@ msgstr "" msgid "Select item group" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:433 +#: erpnext/manufacturing/doctype/bom/bom.js:434 msgid "Select template item" msgstr "" @@ -45858,7 +45894,7 @@ msgstr "" msgid "Select the Item to be manufactured." msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:965 +#: erpnext/manufacturing/doctype/bom/bom.js:966 msgid "Select the Item to be manufactured. The Item name, UoM, Company, and Currency will be fetched automatically." msgstr "" @@ -45879,11 +45915,11 @@ msgstr "" msgid "Select the date and your timezone" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:984 +#: erpnext/manufacturing/doctype/bom/bom.js:985 msgid "Select the raw materials (Items) required to manufacture the Item" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:488 +#: erpnext/manufacturing/doctype/bom/bom.js:489 msgid "Select variant item code for the template item {0}" msgstr "" @@ -45907,7 +45943,7 @@ msgstr "" msgid "Selected POS Opening Entry should be open." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2572 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2570 msgid "Selected Price List should have buying and selling fields checked." msgstr "" @@ -45957,7 +45993,7 @@ msgstr "" msgid "Sell quantity cannot exceed the asset quantity" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1413 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1411 msgid "Sell quantity cannot exceed the asset quantity. Asset {0} has only {1} item(s)." msgstr "" @@ -46014,7 +46050,7 @@ msgstr "" #: erpnext/selling/doctype/selling_settings/selling_settings.json #: erpnext/selling/workspace/selling/selling.json #: erpnext/setup/workspace/erpnext_settings/erpnext_settings.json -#: erpnext/stock/doctype/stock_settings/stock_settings.py:244 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:260 #: erpnext/workspace_sidebar/erpnext_settings.json msgid "Selling Settings" msgstr "" @@ -46072,7 +46108,7 @@ msgid "Send Emails to Suppliers" msgstr "" #. Label of the send_sms (Button) field in DocType 'SMS Center' -#: erpnext/public/js/controllers/transaction.js:689 +#: erpnext/public/js/controllers/transaction.js:692 #: erpnext/selling/doctype/sms_center/sms_center.json msgid "Send SMS" msgstr "" @@ -46208,7 +46244,7 @@ msgstr "" #: erpnext/manufacturing/doctype/job_card/job_card.json #: erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.js:74 #: erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py:114 -#: erpnext/public/js/controllers/transaction.js:2936 +#: erpnext/public/js/controllers/transaction.js:2939 #: erpnext/public/js/utils/serial_no_batch_selector.js:421 #: erpnext/selling/doctype/installation_note_item/installation_note_item.json #: erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -46269,7 +46305,7 @@ msgstr "" msgid "Serial No Range" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:2596 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:2601 msgid "Serial No Reserved" msgstr "" @@ -46326,7 +46362,7 @@ msgstr "" msgid "Serial No and Batch Traceability" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1141 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1146 msgid "Serial No is mandatory" msgstr "" @@ -46355,7 +46391,7 @@ msgstr "" msgid "Serial No {0} does not exist" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:3362 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:3391 msgid "Serial No {0} does not exists" msgstr "" @@ -46409,11 +46445,11 @@ msgstr "" msgid "Serial Nos and Batches" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1882 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1887 msgid "Serial Nos are created successfully" msgstr "" -#: erpnext/stock/stock_ledger.py:2274 +#: erpnext/stock/stock_ledger.py:2277 msgid "Serial Nos are reserved in Stock Reservation Entries, you need to unreserve them before proceeding." msgstr "" @@ -46490,11 +46526,11 @@ msgstr "" msgid "Serial and Batch Bundle" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:2104 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:2109 msgid "Serial and Batch Bundle created" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:2176 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:2181 msgid "Serial and Batch Bundle updated" msgstr "" @@ -46865,12 +46901,12 @@ msgid "Service Stop Date" msgstr "" #: erpnext/accounts/deferred_revenue.py:45 -#: erpnext/public/js/controllers/transaction.js:1772 +#: erpnext/public/js/controllers/transaction.js:1775 msgid "Service Stop Date cannot be after Service End Date" msgstr "" #: erpnext/accounts/deferred_revenue.py:42 -#: erpnext/public/js/controllers/transaction.js:1769 +#: erpnext/public/js/controllers/transaction.js:1772 msgid "Service Stop Date cannot be before Service Start Date" msgstr "" @@ -46894,7 +46930,7 @@ msgstr "" #. Label of the set_basic_rate_manually (Check) field in DocType 'Stock Entry #. Detail' -#: erpnext/stock/doctype/stock_entry/stock_entry.py:298 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:299 #: erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json msgid "Set Basic Rate Manually" msgstr "" @@ -46976,7 +47012,7 @@ msgstr "" msgid "Set Posting Date" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:1011 +#: erpnext/manufacturing/doctype/bom/bom.js:1012 msgid "Set Process Loss Item Quantity" msgstr "" @@ -47099,7 +47135,7 @@ msgstr "" msgid "Set fieldname from which you want to fetch the data from the parent form." msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:1001 +#: erpnext/manufacturing/doctype/bom/bom.js:1002 msgid "Set quantity of process loss item:" msgstr "" @@ -47129,15 +47165,21 @@ msgstr "" msgid "Set this if the customer is a Public Administration company." msgstr "" -#: erpnext/assets/doctype/asset/asset.py:900 +#. Description of the 'Close Issue After Days' (Int) field in DocType 'Support +#. Settings' +#: erpnext/support/doctype/support_settings/support_settings.json +msgid "Set this value to 0 to disable the feature." +msgstr "" + +#: erpnext/assets/doctype/asset/asset.py:898 msgid "Set {0} in asset category {1} for company {2}" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1233 +#: erpnext/assets/doctype/asset/asset.py:1231 msgid "Set {0} in asset category {1} or company {2}" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1230 +#: erpnext/assets/doctype/asset/asset.py:1228 msgid "Set {0} in company {1}" msgstr "" @@ -47918,7 +47960,7 @@ msgstr "" msgid "Simultaneous" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:689 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:687 msgid "Since there is a process loss of {0} units for the finished good {1}, you should reduce the quantity by {0} units for the finished good {1} in the Items Table." msgstr "" @@ -48010,7 +48052,7 @@ msgstr "" msgid "Sold" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:86 +#: erpnext/selling/page/point_of_sale/pos_past_order_summary.js:89 msgid "Sold by" msgstr "" @@ -48027,15 +48069,15 @@ msgstr "" msgid "Something went wrong please try again" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:755 +#: erpnext/accounts/doctype/pricing_rule/utils.py:757 msgid "Sorry, this coupon code is no longer valid" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:753 +#: erpnext/accounts/doctype/pricing_rule/utils.py:755 msgid "Sorry, this coupon code's validity has expired" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:751 +#: erpnext/accounts/doctype/pricing_rule/utils.py:753 msgid "Sorry, this coupon code's validity has not started" msgstr "" @@ -48103,7 +48145,7 @@ msgstr "" #. Label of the s_warehouse (Link) field in DocType 'Stock Entry Detail' #: erpnext/accounts/doctype/pos_invoice/pos_invoice.json #: erpnext/accounts/doctype/sales_invoice/sales_invoice.json -#: erpnext/manufacturing/doctype/bom/bom.js:460 +#: erpnext/manufacturing/doctype/bom/bom.js:461 #: erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json #: erpnext/manufacturing/doctype/bom_item/bom_item.json #: erpnext/manufacturing/doctype/bom_operation/bom_operation.json @@ -48117,7 +48159,7 @@ msgstr "" #: erpnext/selling/doctype/sales_order_item/sales_order_item.json #: erpnext/stock/dashboard/item_dashboard.js:227 #: erpnext/stock/doctype/material_request_item/material_request_item.json -#: erpnext/stock/doctype/stock_entry/stock_entry.js:717 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:719 #: erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json msgid "Source Warehouse" msgstr "" @@ -48145,7 +48187,7 @@ msgstr "" msgid "Source and Target Location cannot be same" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:818 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:816 msgid "Source and target warehouse cannot be same for row {0}" msgstr "" @@ -48158,9 +48200,9 @@ msgstr "" msgid "Source of Funds (Liabilities)" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:784 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:801 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:808 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:782 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:799 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:806 msgid "Source warehouse is mandatory for row {0}" msgstr "" @@ -48199,7 +48241,7 @@ msgid "Spending for Account {0} ({1}) between {2} and {3} has already exceeded t msgstr "" #: erpnext/assets/doctype/asset/asset.js:689 -#: erpnext/stock/doctype/batch/batch.js:91 +#: erpnext/stock/doctype/batch/batch.js:102 #: erpnext/stock/doctype/batch/batch.js:183 #: erpnext/support/doctype/issue/issue.js:114 msgid "Split" @@ -48225,6 +48267,7 @@ msgstr "" msgid "Split From" msgstr "" +#: erpnext/support/doctype/issue/issue.js:91 #: erpnext/support/doctype/issue/issue.js:102 msgid "Split Issue" msgstr "" @@ -48233,7 +48276,7 @@ msgstr "" msgid "Split Qty" msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1372 +#: erpnext/assets/doctype/asset/asset.py:1370 msgid "Split Quantity must be less than Asset Quantity" msgstr "" @@ -48300,7 +48343,8 @@ msgid "Stale Days should start from 1." msgstr "" #: erpnext/setup/setup_wizard/operations/defaults_setup.py:70 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:476 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:485 +#: erpnext/tests/utils.py:297 msgid "Standard Buying" msgstr "" @@ -48313,8 +48357,9 @@ msgid "Standard Rated Expenses" msgstr "" #: erpnext/setup/setup_wizard/operations/defaults_setup.py:70 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:484 -#: erpnext/stock/doctype/item/item.py:267 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:493 +#: erpnext/stock/doctype/item/item.py:267 erpnext/tests/utils.py:305 +#: erpnext/tests/utils.py:2494 msgid "Standard Selling" msgstr "" @@ -48607,7 +48652,7 @@ msgstr "" msgid "Stock Details" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:912 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:910 msgid "Stock Entries already created for Work Order {0}: {1}" msgstr "" @@ -48666,7 +48711,7 @@ msgstr "" msgid "Stock Entry Type" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:1436 +#: erpnext/stock/doctype/pick_list/pick_list.py:1475 msgid "Stock Entry has been already created against this Pick List" msgstr "" @@ -48674,7 +48719,7 @@ msgstr "" msgid "Stock Entry {0} created" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1496 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1495 msgid "Stock Entry {0} has created" msgstr "" @@ -48718,7 +48763,7 @@ msgstr "" msgid "Stock Ledger" msgstr "" -#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:9 +#: erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js:30 msgid "Stock Ledger Entries and GL Entries are reposted for the selected Purchase Receipts" msgstr "" @@ -48832,8 +48877,8 @@ msgstr "" #. Label of the stock_qty (Float) field in DocType 'BOM Item' #. Label of the stock_qty (Float) field in DocType 'Delivery Schedule Item' #. Label of the stock_qty (Float) field in DocType 'Material Request Item' -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:252 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:304 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:257 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:311 #: erpnext/manufacturing/doctype/bom_creator_item/bom_creator_item.json #: erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json #: erpnext/manufacturing/doctype/bom_item/bom_item.json @@ -48920,7 +48965,7 @@ msgstr "" #: erpnext/stock/doctype/pick_list/pick_list.js:167 #: erpnext/stock/doctype/pick_list/pick_list.js:172 #: erpnext/stock/doctype/stock_entry/stock_entry_dashboard.py:12 -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:738 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:739 #: erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py:674 #: erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py:1237 #: erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py:1644 @@ -48930,9 +48975,9 @@ msgstr "" #: erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py:1699 #: erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py:1716 #: erpnext/stock/doctype/stock_settings/stock_settings.json -#: erpnext/stock/doctype/stock_settings/stock_settings.py:201 -#: erpnext/stock/doctype/stock_settings/stock_settings.py:213 -#: erpnext/stock/doctype/stock_settings/stock_settings.py:227 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:217 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:229 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:243 #: erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js:182 #: erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js:195 #: erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js:207 @@ -48946,7 +48991,7 @@ msgid "Stock Reservation Entries Cancelled" msgstr "" #: erpnext/controllers/subcontracting_inward_controller.py:1003 -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:2236 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:2238 #: erpnext/manufacturing/doctype/work_order/work_order.py:2124 #: erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py:1777 msgid "Stock Reservation Entries Created" @@ -49095,8 +49140,8 @@ msgstr "" #: erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json #: erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json #: erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:254 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:306 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:259 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:313 #: erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.json #: erpnext/buying/doctype/purchase_order_item/purchase_order_item.json #: erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json @@ -49258,11 +49303,11 @@ msgstr "" msgid "Stock cannot be reserved in the group warehouse {0}." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1228 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1226 msgid "Stock cannot be updated against the following Delivery Notes: {0}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1297 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1295 msgid "Stock cannot be updated because the invoice contains a drop shipping item. Please disable 'Update Stock' or remove the drop shipping item." msgstr "" @@ -49319,8 +49364,8 @@ msgstr "" #: erpnext/setup/doctype/company/company.py:384 #: erpnext/setup/setup_wizard/operations/defaults_setup.py:33 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:528 -#: erpnext/stock/doctype/item/item.py:304 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:537 +#: erpnext/stock/doctype/item/item.py:304 erpnext/tests/utils.py:270 msgid "Stores" msgstr "" @@ -50070,7 +50115,7 @@ msgstr "" #: erpnext/accounts/doctype/tax_rule/tax_rule.json #: erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py:60 #: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js:34 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:184 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:189 #: erpnext/accounts/report/purchase_register/purchase_register.js:21 #: erpnext/accounts/report/purchase_register/purchase_register.py:171 #: erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py:29 @@ -50125,7 +50170,7 @@ msgstr "" msgid "Supplier" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:50 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:98 msgid "Supplier > Supplier Type" msgstr "" @@ -50310,7 +50355,7 @@ msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json #: erpnext/accounts/report/accounts_receivable/accounts_receivable.py:1220 #: erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py:156 -#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:191 +#: erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py:196 #: erpnext/accounts/report/purchase_register/purchase_register.py:177 #: erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py:35 #: erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.js:73 @@ -50834,7 +50879,7 @@ msgstr "" #: erpnext/stock/dashboard/item_dashboard.js:234 #: erpnext/stock/doctype/delivery_note_item/delivery_note_item.json #: erpnext/stock/doctype/material_request_item/material_request_item.json -#: erpnext/stock/doctype/stock_entry/stock_entry.js:723 +#: erpnext/stock/doctype/stock_entry/stock_entry.js:725 #: erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json msgid "Target Warehouse" msgstr "" @@ -50862,7 +50907,7 @@ msgstr "" msgid "Target Warehouse is required before Submit" msgstr "" -#: erpnext/controllers/selling_controller.py:882 +#: erpnext/controllers/selling_controller.py:885 msgid "Target Warehouse is set for some items but the customer is not an internal customer." msgstr "" @@ -50870,9 +50915,9 @@ msgstr "" msgid "Target Warehouse {0} must be same as Delivery Warehouse {1} in the Subcontracting Inward Order Item." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:790 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:797 -#: erpnext/stock/doctype/stock_entry/stock_entry.py:812 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:788 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:795 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:810 msgid "Target warehouse is mandatory for row {0}" msgstr "" @@ -51549,7 +51594,7 @@ msgstr "" msgid "Television" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:412 +#: erpnext/manufacturing/doctype/bom/bom.js:413 msgid "Template Item" msgstr "" @@ -51784,7 +51829,7 @@ msgstr "" #: erpnext/accounts/report/gross_profit/gross_profit.py:436 #: erpnext/accounts/report/inactive_sales_items/inactive_sales_items.js:8 #: erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py:21 -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:252 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:259 #: erpnext/accounts/report/sales_register/sales_register.py:209 #: erpnext/crm/doctype/lead/lead.json #: erpnext/crm/doctype/opportunity/opportunity.json @@ -51924,11 +51969,11 @@ msgstr "" msgid "The Payment Term at row {0} is possibly a duplicate." msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:306 +#: erpnext/stock/doctype/pick_list/pick_list.py:341 msgid "The Pick List having Stock Reservation Entries cannot be updated. If you need to make changes, we recommend canceling the existing Stock Reservation Entries before updating the Pick List." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:2611 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:2609 msgid "The Process Loss Qty has reset as per job cards Process Loss Qty" msgstr "" @@ -51936,15 +51981,15 @@ msgstr "" msgid "The Sales Person is linked with {0}" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:172 +#: erpnext/stock/doctype/pick_list/pick_list.py:207 msgid "The Serial No at Row #{0}: {1} is not available in warehouse {2}." msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:2593 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:2598 msgid "The Serial No {0} is reserved against the {1} {2} and cannot be used for any other transaction." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1744 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1742 msgid "The Serial and Batch Bundle {0} is not valid for this transaction. The 'Type of Transaction' should be 'Outward' instead of 'Inward' in Serial and Batch Bundle {0}" msgstr "" @@ -51970,7 +52015,7 @@ msgstr "" msgid "The batch {0} is already reserved in {1} {2}. So, cannot proceed with the {3} {4}, which is created against the {5} {6}." msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1302 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1301 msgid "The completed quantity {0} of an operation {1} cannot be greater than the completed quantity {2} of a previous operation {3}." msgstr "" @@ -52035,7 +52080,7 @@ msgstr "" msgid "The following assets have failed to automatically post depreciation entries: {0}" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:270 +#: erpnext/stock/doctype/pick_list/pick_list.py:305 msgid "The following batches are expired, please restock them:
      {0}" msgstr "" @@ -52065,7 +52110,7 @@ msgstr "" msgid "The following rows are duplicates:" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:898 +#: erpnext/stock/doctype/material_request/material_request.py:864 msgid "The following {0} were created: {1}" msgstr "" @@ -52078,7 +52123,7 @@ msgstr "" msgid "The holiday on {0} is not between From Date and To Date" msgstr "" -#: erpnext/controllers/buying_controller.py:1246 +#: erpnext/controllers/buying_controller.py:1243 msgid "The item {item} is not marked as {type_of} item. You can enable it as {type_of} item from its Item master." msgstr "" @@ -52086,15 +52131,15 @@ msgstr "" msgid "The items {0} and {1} are present in the following {2} :" msgstr "" -#: erpnext/controllers/buying_controller.py:1239 +#: erpnext/controllers/buying_controller.py:1236 msgid "The items {items} are not marked as {type_of} item. You can enable them as {type_of} item from their Item masters." msgstr "" -#: erpnext/manufacturing/doctype/workstation/workstation.py:549 +#: erpnext/manufacturing/doctype/workstation/workstation.py:546 msgid "The job card {0} is in {1} state and you cannot complete." msgstr "" -#: erpnext/manufacturing/doctype/workstation/workstation.py:543 +#: erpnext/manufacturing/doctype/workstation/workstation.py:540 msgid "The job card {0} is in {1} state and you cannot start it again." msgstr "" @@ -52225,7 +52270,7 @@ msgstr "" msgid "The stock for the item {0} in the {1} warehouse was negative on the {2}. You should create a positive entry {3} before the date {4} and time {5} to post the correct valuation rate. For more details, please read the documentation." msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:732 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:733 msgid "The stock has been reserved for the following Items and Warehouses, un-reserve the same to {0} the Stock Reconciliation:

      {1}" msgstr "" @@ -52239,19 +52284,19 @@ msgstr "" msgid "The system will create a Sales Invoice or a POS Invoice from the POS interface based on this setting. For high-volume transactions, it is recommended to use POS Invoice." msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1027 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1028 msgid "The task has been enqueued as a background job. In case there is any issue on processing in background, the system will add a comment about the error on this Stock Reconciliation and revert to the Draft stage" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1038 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1039 msgid "The task has been enqueued as a background job. In case there is any issue on processing in background, the system will add a comment about the error on this Stock Reconciliation and revert to the Submitted stage" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:341 +#: erpnext/stock/doctype/material_request/material_request.py:349 msgid "The total Issue / Transfer quantity {0} in Material Request {1} cannot be greater than allowed requested quantity {2} for Item {3}" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:348 +#: erpnext/stock/doctype/material_request/material_request.py:356 msgid "The total Issue / Transfer quantity {0} in Material Request {1} cannot be greater than requested quantity {2} for Item {3}" msgstr "" @@ -52299,11 +52344,11 @@ msgstr "" msgid "The warehouse where your Items will be transferred when you begin production. Group Warehouse can also be selected as a Work in Progress warehouse." msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:875 +#: erpnext/manufacturing/doctype/job_card/job_card.py:874 msgid "The {0} ({1}) must be equal to {2} ({3})" msgstr "" -#: erpnext/public/js/controllers/transaction.js:3404 +#: erpnext/public/js/controllers/transaction.js:3408 msgid "The {0} contains Unit Price Items." msgstr "" @@ -52311,7 +52356,7 @@ msgstr "" msgid "The {0} prefix '{1}' already exists. Please change the Serial No Series, otherwise you will get a Duplicate Entry error." msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:904 +#: erpnext/stock/doctype/material_request/material_request.py:870 msgid "The {0} {1} created successfully" msgstr "" @@ -52319,15 +52364,15 @@ msgstr "" msgid "The {0} {1} does not match with the {0} {2} in the {3} {4}" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:978 +#: erpnext/manufacturing/doctype/job_card/job_card.py:977 msgid "The {0} {1} is used to calculate the valuation cost for the finished good {2}." msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:44 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:74 msgid "Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Type, Campaign, Sales Partner etc." msgstr "" -#: erpnext/assets/doctype/asset/asset.py:729 +#: erpnext/assets/doctype/asset/asset.py:727 msgid "There are active maintenance or repairs against the asset. You must complete all of them before cancelling the asset." msgstr "" @@ -52343,7 +52388,7 @@ msgstr "" msgid "There are no Failed transactions" msgstr "" -#: erpnext/setup/demo.py:108 +#: erpnext/setup/demo.py:120 msgid "There are no active Fiscal Years for which Demo Data can be generated." msgstr "" @@ -52359,7 +52404,7 @@ msgstr "" msgid "There aren't any item variants for the selected item" msgstr "" -#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:10 +#: erpnext/accounts/doctype/loyalty_program/loyalty_program.js:21 msgid "There can be multiple tiered collection factor based on the total spent. But the conversion factor for redemption will always be same for all the tier." msgstr "" @@ -52383,7 +52428,7 @@ msgstr "" msgid "There is no batch found against the {0}: {1}" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:1681 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:1679 msgid "There must be atleast 1 Finished Good in this Stock Entry" msgstr "" @@ -52430,7 +52475,7 @@ msgstr "" msgid "This Purchase Order has been fully subcontracted." msgstr "" -#: erpnext/selling/doctype/sales_order/sales_order.py:2054 +#: erpnext/selling/doctype/sales_order/sales_order.py:2050 msgid "This Sales Order has been fully subcontracted." msgstr "" @@ -52454,7 +52499,7 @@ msgstr "" msgid "This covers all scorecards tied to this Setup" msgstr "" -#: erpnext/controllers/status_updater.py:460 +#: erpnext/controllers/status_updater.py:463 msgid "This document is over limit by {0} {1} for item {4}. Are you making another {3} against the same {2}?" msgstr "" @@ -52587,7 +52632,7 @@ msgstr "" msgid "This schedule was created when Asset {0} was repaired through Asset Repair {1}." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1504 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1502 msgid "This schedule was created when Asset {0} was restored due to Sales Invoice {1} cancellation." msgstr "" @@ -52599,7 +52644,7 @@ msgstr "" msgid "This schedule was created when Asset {0} was restored." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1500 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1498 msgid "This schedule was created when Asset {0} was returned through Sales Invoice {1}." msgstr "" @@ -52607,11 +52652,11 @@ msgstr "" msgid "This schedule was created when Asset {0} was scrapped." msgstr "" -#: erpnext/assets/doctype/asset/asset.py:1507 +#: erpnext/assets/doctype/asset/asset.py:1505 msgid "This schedule was created when Asset {0} was {1} into new Asset {2}." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1476 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1474 msgid "This schedule was created when Asset {0} was {1} through Sales Invoice {2}." msgstr "" @@ -52655,7 +52700,7 @@ msgstr "" msgid "This will restrict user access to other employee records" msgstr "" -#: erpnext/controllers/selling_controller.py:883 +#: erpnext/controllers/selling_controller.py:886 msgid "This {} will be treated as material transfer." msgstr "" @@ -52766,7 +52811,7 @@ msgstr "" msgid "Time in mins." msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:854 +#: erpnext/manufacturing/doctype/job_card/job_card.py:853 msgid "Time logs are required for {0} {1}" msgstr "" @@ -53094,7 +53139,7 @@ msgstr "" msgid "To Warehouse (Optional)" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:979 +#: erpnext/manufacturing/doctype/bom/bom.js:980 msgid "To add Operations tick the 'With Operations' checkbox." msgstr "" @@ -53102,11 +53147,11 @@ msgstr "" msgid "To add subcontracted Item's raw materials if include exploded items is disabled." msgstr "" -#: erpnext/controllers/status_updater.py:453 +#: erpnext/controllers/status_updater.py:456 msgid "To allow over billing, update \"Over Billing Allowance\" in Accounts Settings or the Item." msgstr "" -#: erpnext/controllers/status_updater.py:449 +#: erpnext/controllers/status_updater.py:452 msgid "To allow over receipt / delivery, update \"Over Receipt/Delivery Allowance\" in Stock Settings or the Item." msgstr "" @@ -53161,7 +53206,7 @@ msgstr "" msgid "To merge, following properties must be same for both items" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:42 +#: erpnext/accounts/doctype/pricing_rule/pricing_rule.js:59 msgid "To not apply Pricing Rule in a particular transaction, all applicable Pricing Rules should be disabled." msgstr "" @@ -53438,7 +53483,7 @@ msgstr "" #. Label of the total_completed_qty (Float) field in DocType 'Job Card' #: erpnext/manufacturing/doctype/job_card/job_card.json -#: erpnext/manufacturing/doctype/job_card/job_card.py:871 +#: erpnext/manufacturing/doctype/job_card/job_card.py:870 #: erpnext/manufacturing/report/job_card_summary/job_card_summary.py:174 msgid "Total Completed Qty" msgstr "" @@ -53589,7 +53634,7 @@ msgstr "" msgid "Total Issues" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:92 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:96 msgid "Total Items" msgstr "" @@ -53677,7 +53722,7 @@ msgstr "" msgid "Total Order Value" msgstr "" -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:621 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:628 msgid "Total Other Charges" msgstr "" @@ -53847,7 +53892,7 @@ msgstr "" msgid "Total Tasks" msgstr "" -#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:614 +#: erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py:621 #: erpnext/accounts/report/purchase_register/purchase_register.py:263 msgid "Total Tax" msgstr "" @@ -54280,7 +54325,7 @@ msgstr "" msgid "Transaction from which tax is withheld" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:847 +#: erpnext/manufacturing/doctype/job_card/job_card.py:846 msgid "Transaction not allowed against stopped Work Order {0}" msgstr "" @@ -54309,7 +54354,7 @@ msgstr "" msgid "Transactions against the Company already exist! Chart of Accounts can only be imported for a Company with no transactions." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1161 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1159 msgid "Transactions using Sales Invoice in POS are disabled." msgstr "" @@ -54776,7 +54821,7 @@ msgstr "" msgid "UOM Conversion Factor" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1461 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1463 msgid "UOM Conversion factor ({0} -> {1}) not found for item: {2}" msgstr "" @@ -54789,7 +54834,7 @@ msgstr "" msgid "UOM Name" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:3776 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:3774 msgid "UOM conversion factor required for UOM: {0} in Item: {1}" msgstr "" @@ -54853,7 +54898,7 @@ msgstr "" msgid "Unable to fetch DocType details. Please contact system administrator." msgstr "" -#: erpnext/setup/utils.py:182 +#: erpnext/setup/utils.py:149 msgid "Unable to find exchange rate for {0} to {1} for key date {2}. Please create a Currency Exchange record manually" msgstr "" @@ -55195,7 +55240,7 @@ msgstr "" msgid "Update Account Number / Name" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_payment.js:22 +#: erpnext/selling/page/point_of_sale/pos_payment.js:32 msgid "Update Additional Information" msgstr "" @@ -55443,7 +55488,7 @@ msgid "Upon submission of the Sales Order, Work Order, or Production Plan, the s msgstr "" #: erpnext/setup/setup_wizard/operations/install_fixtures.py:311 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:423 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:428 msgid "Upper Income" msgstr "" @@ -55534,7 +55579,7 @@ msgstr "" #. Label of the use_multi_level_bom (Check) field in DocType 'Work Order' #. Label of the use_multi_level_bom (Check) field in DocType 'Stock Entry' -#: erpnext/manufacturing/doctype/bom/bom.js:394 +#: erpnext/manufacturing/doctype/bom/bom.js:395 #: erpnext/manufacturing/doctype/work_order/work_order.json #: erpnext/stock/doctype/stock_entry/stock_entry.json msgid "Use Multi-Level BOM" @@ -55652,7 +55697,7 @@ msgstr "" msgid "User Resolution Time" msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:594 +#: erpnext/accounts/doctype/pricing_rule/utils.py:596 msgid "User has not applied rule on the invoice {0}" msgstr "" @@ -55965,11 +56010,11 @@ msgstr "" msgid "Valuation Rate (In / Out)" msgstr "" -#: erpnext/stock/stock_ledger.py:2018 +#: erpnext/stock/stock_ledger.py:2022 msgid "Valuation Rate Missing" msgstr "" -#: erpnext/stock/stock_ledger.py:1996 +#: erpnext/stock/stock_ledger.py:2000 msgid "Valuation Rate for the Item {0}, is required to do accounting entries for {1} {2}." msgstr "" @@ -55977,7 +56022,7 @@ msgstr "" msgid "Valuation Rate is mandatory if Opening Stock entered" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:784 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:785 msgid "Valuation Rate required for Item {0} at row {1}" msgstr "" @@ -55987,7 +56032,7 @@ msgstr "" msgid "Valuation and Total" msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1004 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:1005 msgid "Valuation rate for customer provided items has been set to zero." msgstr "" @@ -56048,7 +56093,7 @@ msgid "Value Or Qty" msgstr "" #: erpnext/setup/setup_wizard/data/sales_stage.txt:4 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:435 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:440 msgid "Value Proposition" msgstr "" @@ -56163,8 +56208,8 @@ msgstr "" msgid "Variant Field" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:348 -#: erpnext/manufacturing/doctype/bom/bom.js:427 +#: erpnext/manufacturing/doctype/bom/bom.js:349 +#: erpnext/manufacturing/doctype/bom/bom.js:428 msgid "Variant Item" msgstr "" @@ -56394,7 +56439,7 @@ msgstr "" msgid "View attachments" msgstr "" -#: erpnext/public/js/call_popup/call_popup.js:186 +#: erpnext/public/js/call_popup/call_popup.js:192 msgid "View call log" msgstr "" @@ -56535,7 +56580,7 @@ msgstr "" msgid "Voucher No" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1381 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1386 msgid "Voucher No is mandatory" msgstr "" @@ -56666,7 +56711,7 @@ msgstr "" msgid "WIP Work Orders" msgstr "" -#: erpnext/manufacturing/doctype/workstation/test_workstation.py:127 +#: erpnext/manufacturing/doctype/workstation/test_workstation.py:125 #: erpnext/patches/v16_0/make_workstation_operating_components.py:50 #: erpnext/setup/setup_wizard/operations/install_fixtures.py:317 msgid "Wages" @@ -56779,7 +56824,7 @@ msgstr "" msgid "Warehouse not found against the account {0}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1218 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1216 #: erpnext/stock/doctype/delivery_note/delivery_note.py:444 msgid "Warehouse required for stock Item {0}" msgstr "" @@ -56926,7 +56971,7 @@ msgstr "" msgid "Warning: Another {0} # {1} exists against stock entry {2}" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.js:556 +#: erpnext/stock/doctype/material_request/material_request.js:534 msgid "Warning: Material Requested Qty is less than Minimum Order Qty" msgstr "" @@ -57201,7 +57246,7 @@ msgstr "" msgid "When creating an Item, entering a value for this field will automatically create an Item Price at the backend." msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:295 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:296 msgid "When there are multiple finished goods ({0}) in a Repack stock entry, the basic rate for all finished goods must be set manually. To set rate manually, enable the checkbox 'Set Basic Rate Manually' in the respective finished good row." msgstr "" @@ -57356,7 +57401,7 @@ msgstr "" #: erpnext/selling/doctype/sales_order/sales_order.js:1050 #: erpnext/stock/doctype/material_request/material_request.js:216 #: erpnext/stock/doctype/material_request/material_request.json -#: erpnext/stock/doctype/material_request/material_request.py:905 +#: erpnext/stock/doctype/material_request/material_request.py:871 #: erpnext/stock/doctype/pick_list/pick_list.json #: erpnext/stock/doctype/serial_no/serial_no.json #: erpnext/stock/doctype/stock_entry/stock_entry.json @@ -57427,7 +57472,7 @@ msgstr "" msgid "Work Order Summary Report" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:911 +#: erpnext/stock/doctype/material_request/material_request.py:877 msgid "Work Order cannot be created for following reason:
      {0}" msgstr "" @@ -57435,8 +57480,8 @@ msgstr "" msgid "Work Order cannot be raised against a Item Template" msgstr "" -#: erpnext/manufacturing/doctype/work_order/work_order.py:2451 -#: erpnext/manufacturing/doctype/work_order/work_order.py:2531 +#: erpnext/manufacturing/doctype/work_order/work_order.py:2456 +#: erpnext/manufacturing/doctype/work_order/work_order.py:2536 msgid "Work Order has been {0}" msgstr "" @@ -57448,12 +57493,12 @@ msgstr "" msgid "Work Order {0} created" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:862 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:860 msgid "Work Order {0}: Job Card not found for the operation {1}" msgstr "" #: erpnext/manufacturing/report/job_card_summary/job_card_summary.js:56 -#: erpnext/stock/doctype/material_request/material_request.py:899 +#: erpnext/stock/doctype/material_request/material_request.py:865 msgid "Work Orders" msgstr "" @@ -57601,7 +57646,7 @@ msgstr "" msgid "Workstation Working Hour" msgstr "" -#: erpnext/manufacturing/doctype/workstation/workstation.py:453 +#: erpnext/manufacturing/doctype/workstation/workstation.py:450 msgid "Workstation is closed on the following dates as per Holiday List: {0}" msgstr "" @@ -57790,7 +57835,7 @@ msgstr "" msgid "You are not authorized to set Frozen value" msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:477 +#: erpnext/stock/doctype/pick_list/pick_list.py:512 msgid "You are picking more than required quantity for the item {0}. Check if there is any other pick list created for the sales order {1}." msgstr "" @@ -57806,7 +57851,7 @@ msgstr "" msgid "You can also set default CWIP account in Company {}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1016 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1014 msgid "You can change the parent account to a Balance Sheet account or select a different account." msgstr "" @@ -57839,7 +57884,7 @@ msgstr "" msgid "You can use {0} to reconcile against {1} later." msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1314 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1313 msgid "You can't make any changes to Job Card since Work Order is closed." msgstr "" @@ -57851,7 +57896,7 @@ msgstr "" msgid "You can't redeem Loyalty Points having more value than the Total Amount." msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:735 +#: erpnext/manufacturing/doctype/bom/bom.js:736 msgid "You cannot change the rate if BOM is mentioned against any Item." msgstr "" @@ -57939,7 +57984,7 @@ msgstr "" msgid "You have been invited to collaborate on the project {0}." msgstr "" -#: erpnext/stock/doctype/stock_settings/stock_settings.py:239 +#: erpnext/stock/doctype/stock_settings/stock_settings.py:255 msgid "You have enabled {0} and {1} in {2}. This can lead to prices from the default price list being inserted in the transaction price list." msgstr "" @@ -57985,7 +58030,7 @@ msgid "Your email has been verified and your appointment has been scheduled" msgstr "" #: erpnext/patches/v11_0/add_default_dispatch_notification_template.py:22 -#: erpnext/setup/setup_wizard/operations/install_fixtures.py:337 +#: erpnext/setup/setup_wizard/operations/install_fixtures.py:342 msgid "Your order is out for delivery!" msgstr "" @@ -58018,7 +58063,7 @@ msgstr "" msgid "Zero Rated" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:562 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:563 msgid "Zero quantity" msgstr "" @@ -58027,7 +58072,7 @@ msgstr "" msgid "Zip File" msgstr "" -#: erpnext/stock/reorder_item.py:382 +#: erpnext/stock/reorder_item.py:374 msgid "[Important] [ERPNext] Auto Reorder Errors" msgstr "" @@ -58035,7 +58080,7 @@ msgstr "" msgid "`Allow Negative rates for Items`" msgstr "" -#: erpnext/stock/stock_ledger.py:2010 +#: erpnext/stock/stock_ledger.py:2014 msgid "after" msgstr "" @@ -58051,11 +58096,11 @@ msgstr "" msgid "as Title" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.js:1003 +#: erpnext/manufacturing/doctype/bom/bom.js:1004 msgid "as a percentage of finished item quantity" msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1513 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1518 msgid "as of {0}" msgstr "" @@ -58076,7 +58121,7 @@ msgid "cannot be greater than 100" msgstr "" #: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py:334 -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1104 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1102 msgid "dated {0}" msgstr "" @@ -58093,7 +58138,7 @@ msgstr "" msgid "development" msgstr "" -#: erpnext/selling/page/point_of_sale/pos_item_cart.js:450 +#: erpnext/selling/page/point_of_sale/pos_item_cart.js:451 msgid "discount applied" msgstr "" @@ -58225,7 +58270,7 @@ msgstr "" msgid "per hour" msgstr "" -#: erpnext/stock/stock_ledger.py:2011 +#: erpnext/stock/stock_ledger.py:2015 msgid "performing either one below:" msgstr "" @@ -58254,7 +58299,7 @@ msgstr "" msgid "received from" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1478 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1476 msgid "returned" msgstr "" @@ -58289,7 +58334,7 @@ msgstr "" msgid "sandbox" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1478 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1476 msgid "sold" msgstr "" @@ -58297,8 +58342,8 @@ msgstr "" msgid "subscription is already cancelled." msgstr "" -#: erpnext/controllers/status_updater.py:463 -#: erpnext/controllers/status_updater.py:482 +#: erpnext/controllers/status_updater.py:466 +#: erpnext/controllers/status_updater.py:485 msgid "target_ref_field" msgstr "" @@ -58316,7 +58361,7 @@ msgstr "" msgid "to" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:3169 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:3175 msgid "to unallocate the amount of this Return Invoice before cancelling it." msgstr "" @@ -58375,7 +58420,7 @@ msgstr "" msgid "{0} Budget for Account {1} against {2} {3} is {4}. It will be exceeded by {5}." msgstr "" -#: erpnext/accounts/doctype/pricing_rule/utils.py:770 +#: erpnext/accounts/doctype/pricing_rule/utils.py:772 msgid "{0} Coupon used are {1}. Allowed quantity is exhausted" msgstr "" @@ -58387,7 +58432,7 @@ msgstr "" msgid "{0} Number {1} is already used in {2} {3}" msgstr "" -#: erpnext/manufacturing/doctype/bom/bom.py:1629 +#: erpnext/manufacturing/doctype/bom/bom.py:1635 msgid "{0} Operating Cost for operation {1}" msgstr "" @@ -58395,7 +58440,7 @@ msgstr "" msgid "{0} Operations: {1}" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:220 +#: erpnext/stock/doctype/material_request/material_request.py:228 msgid "{0} Request for {1}" msgstr "" @@ -58415,7 +58460,7 @@ msgstr "" msgid "{0} account is not of type {1}" msgstr "" -#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:512 +#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.py:515 msgid "{0} account not found while submitting purchase receipt" msgstr "" @@ -58464,9 +58509,9 @@ msgstr "" msgid "{0} cannot be zero" msgstr "" -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:916 -#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1032 -#: erpnext/stock/doctype/pick_list/pick_list.py:1258 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:918 +#: erpnext/manufacturing/doctype/production_plan/production_plan.py:1034 +#: erpnext/stock/doctype/pick_list/pick_list.py:1297 #: erpnext/subcontracting/doctype/subcontracting_inward_order/subcontracting_inward_order.py:322 msgid "{0} created" msgstr "" @@ -58555,7 +58600,7 @@ msgstr "" msgid "{0} is in Draft. Submit it before creating the Asset." msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1133 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:1131 msgid "{0} is mandatory for Item {1}" msgstr "" @@ -58572,7 +58617,7 @@ msgstr "" msgid "{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}." msgstr "" -#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1737 +#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py:1742 msgid "{0} is not a CSV file." msgstr "" @@ -58584,7 +58629,7 @@ msgstr "" msgid "{0} is not a group node. Please select a group node as parent cost center" msgstr "" -#: erpnext/stock/doctype/stock_entry/stock_entry.py:614 +#: erpnext/stock/doctype/stock_entry/stock_entry.py:615 msgid "{0} is not a stock Item" msgstr "" @@ -58608,11 +58653,11 @@ msgstr "" msgid "{0} is not running. Cannot trigger events for this Document" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:655 +#: erpnext/stock/doctype/material_request/material_request.py:652 msgid "{0} is not the default supplier for any items." msgstr "" -#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2953 +#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2948 msgid "{0} is on hold till {1}" msgstr "" @@ -58648,7 +58693,7 @@ msgstr "" msgid "{0} must be negative in return document" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2369 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2367 msgid "{0} not allowed to transact with {1}. Please change the Company or add the Company in the 'Allowed To Transact With'-Section in the Customer record." msgstr "" @@ -58668,15 +58713,15 @@ msgstr "" msgid "{0} qty of Item {1} is being received into Warehouse {2} with capacity {3}." msgstr "" -#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:722 +#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:723 msgid "{0} units are reserved for Item {1} in Warehouse {2}, please un-reserve the same to {3} the Stock Reconciliation." msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:1016 +#: erpnext/stock/doctype/pick_list/pick_list.py:1052 msgid "{0} units of Item {1} is not available in any of the warehouses." msgstr "" -#: erpnext/stock/doctype/pick_list/pick_list.py:1009 +#: erpnext/stock/doctype/pick_list/pick_list.py:1045 msgid "{0} units of Item {1} is not available in any of the warehouses. Other Pick Lists exist for this item." msgstr "" @@ -58684,16 +58729,16 @@ msgstr "" msgid "{0} units of {1} are required in {2} with the inventory dimension: {3} on {4} {5} for {6} to complete the transaction." msgstr "" -#: erpnext/stock/stock_ledger.py:1683 erpnext/stock/stock_ledger.py:2160 -#: erpnext/stock/stock_ledger.py:2174 +#: erpnext/stock/stock_ledger.py:1686 erpnext/stock/stock_ledger.py:2163 +#: erpnext/stock/stock_ledger.py:2177 msgid "{0} units of {1} needed in {2} on {3} {4} for {5} to complete this transaction." msgstr "" -#: erpnext/stock/stock_ledger.py:2261 erpnext/stock/stock_ledger.py:2306 +#: erpnext/stock/stock_ledger.py:2264 erpnext/stock/stock_ledger.py:2309 msgid "{0} units of {1} needed in {2} on {3} {4} to complete this transaction." msgstr "" -#: erpnext/stock/stock_ledger.py:1677 +#: erpnext/stock/stock_ledger.py:1680 msgid "{0} units of {1} needed in {2} to complete this transaction." msgstr "" @@ -58721,7 +58766,7 @@ msgstr "" msgid "{0} will be set as the {1} in subsequently scanned items" msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:987 +#: erpnext/manufacturing/doctype/job_card/job_card.py:986 msgid "{0} {1}" msgstr "" @@ -58743,7 +58788,7 @@ msgstr "" #: erpnext/accounts/doctype/payment_entry/payment_entry.py:613 #: erpnext/accounts/doctype/payment_entry/payment_entry.py:666 -#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2695 +#: erpnext/accounts/doctype/payment_entry/payment_entry.py:2690 msgid "{0} {1} does not exist" msgstr "" @@ -58761,11 +58806,11 @@ msgstr "" #: erpnext/buying/doctype/purchase_order/purchase_order.py:435 #: erpnext/selling/doctype/sales_order/sales_order.py:598 -#: erpnext/stock/doctype/material_request/material_request.py:247 +#: erpnext/stock/doctype/material_request/material_request.py:255 msgid "{0} {1} has been modified. Please refresh." msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:274 +#: erpnext/stock/doctype/material_request/material_request.py:282 msgid "{0} {1} has not been submitted so the action cannot be completed" msgstr "" @@ -58786,11 +58831,11 @@ msgstr "" msgid "{0} {1} is cancelled or closed" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:426 +#: erpnext/stock/doctype/material_request/material_request.py:434 msgid "{0} {1} is cancelled or stopped" msgstr "" -#: erpnext/stock/doctype/material_request/material_request.py:264 +#: erpnext/stock/doctype/material_request/material_request.py:272 msgid "{0} {1} is cancelled so the action cannot be completed" msgstr "" @@ -58919,8 +58964,8 @@ msgstr "" msgid "{0}'s {1} cannot be after {2}'s Expected End Date." msgstr "" -#: erpnext/manufacturing/doctype/job_card/job_card.py:1286 -#: erpnext/manufacturing/doctype/job_card/job_card.py:1294 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1285 +#: erpnext/manufacturing/doctype/job_card/job_card.py:1293 msgid "{0}, complete the operation {1} before the operation {2}." msgstr "" @@ -58984,7 +59029,7 @@ msgstr "" msgid "{}" msgstr "" -#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2135 +#: erpnext/accounts/doctype/sales_invoice/sales_invoice.py:2133 msgid "{} can't be cancelled since the Loyalty Points earned has been redeemed. First cancel the {} No {}" msgstr "" From 5f9533f0899c1194db910f85696b978dc7e7bc22 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 06:52:45 +0000 Subject: [PATCH 209/217] fix: PO should not be required for internal transfers (backport #53681) (#53684) Co-authored-by: Mihir Kandoi fix: PO should not be required for internal transfers (#53681) --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 185a06b4ea6..ace574727c7 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -329,7 +329,10 @@ class PurchaseReceipt(BuyingController): ) def po_required(self): - if frappe.db.get_single_value("Buying Settings", "po_required") == "Yes": + if ( + frappe.db.get_single_value("Buying Settings", "po_required") == "Yes" + and not self.is_internal_transfer() + ): for d in self.get("items"): if not d.purchase_order: frappe.throw(_("Purchase Order number required for Item {0}").format(d.item_code)) From 2a471978592c04eb9a8b3f65f0be2e9569d0deef Mon Sep 17 00:00:00 2001 From: nishkagosalia Date: Thu, 19 Mar 2026 18:28:21 +0530 Subject: [PATCH 210/217] chore: Adding new argument in status updater to skip qty validation (cherry picked from commit dcd05090893a25c50026d5bcf67f91c84fd43737) --- erpnext/controllers/status_updater.py | 4 +-- .../purchase_receipt/purchase_receipt.py | 1 + .../purchase_receipt/test_purchase_receipt.py | 35 +++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index fe0f8a831aa..3ce079a62a6 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -267,8 +267,8 @@ class StatusUpdater(Document): self.global_amount_allowance = None for args in self.status_updater: - if "target_ref_field" not in args: - # if target_ref_field is not specified, the programmer does not want to validate qty / amount + if "target_ref_field" not in args or args.get("validate_qty") is False: + # if target_ref_field is not specified or validate_qty is explicitly set to False, skip validation continue items_to_validate = [] diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index ace574727c7..3e342222d99 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -186,6 +186,7 @@ class PurchaseReceipt(BuyingController): "target_ref_field": "stock_qty", "source_field": "stock_qty", "percent_join_field": "material_request", + "validate_qty": False, }, { "source_dt": "Purchase Receipt Item", diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 3772c051b75..74cdfb38f78 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -14,6 +14,7 @@ from erpnext.controllers.accounts_controller import InvalidQtyError from erpnext.controllers.buying_controller import QtyMismatchError from erpnext.stock import get_warehouse_account_map from erpnext.stock.doctype.item.test_item import create_item, make_item +from erpnext.stock.doctype.material_request.material_request import make_purchase_order from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice from erpnext.stock.doctype.serial_and_batch_bundle.serial_and_batch_bundle import ( SerialNoDuplicateError, @@ -33,6 +34,40 @@ class TestPurchaseReceipt(ERPNextTestSuite): frappe.local.future_sle = {} self.load_test_records("Purchase Receipt") + def test_purchase_receipt_skips_validation(self): + """ + Test that validation is skipped when over delivery receipt allowance is reduced after PO submission + and PR can be submitted with higher qty than MR. + """ + item = create_item("Test item for validation") + mr = frappe.new_doc("Material Request") + mr.material_request_type = "Purchase" + mr.company = "_Test Company" + mr.price_list = "_Test Price List" + mr.append( + "items", + { + "item_code": item.name, + "item_name": item.item_name, + "item_group": item.item_group, + "schedule_date": add_days(today(), 1), + "qty": 100, + "uom": item.stock_uom, + }, + ) + mr.insert() + mr.submit() + frappe.db.set_value("Item", item.name, "over_delivery_receipt_allowance", 200) + po = make_purchase_order(mr.name) + po.supplier = "_Test Supplier" + po.items[0].qty = 300 + po.save() + po.submit() + frappe.db.set_value("Item", item.name, "over_delivery_receipt_allowance", 20) + pr = make_purchase_receipt(qty=300, item_code=item.name, do_not_save=True) + pr.save() + pr.submit() + def test_purchase_receipt_qty(self): pr = make_purchase_receipt(qty=0, rejected_qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): From 9805745a66cb2a27d465de466cd9d62fc2b82082 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 14:38:07 +0530 Subject: [PATCH 211/217] fix: shipping rule applied twice on non stock items (backport #53655) (#53687) Co-authored-by: Mihir Kandoi fix: shipping rule applied twice on non stock items (#53655) --- .../accounts/doctype/shipping_rule/shipping_rule.py | 4 +++- erpnext/controllers/accounts_controller.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py index d9b7b0a408f..3ec11364afa 100644 --- a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py @@ -152,7 +152,9 @@ class ShippingRule(Document): frappe.throw(_("Shipping rule only applicable for Buying")) shipping_charge["doctype"] = "Purchase Taxes and Charges" - shipping_charge["category"] = "Valuation and Total" + shipping_charge["category"] = ( + "Valuation and Total" if doc.get_stock_items() or doc.get_asset_items() else "Total" + ) shipping_charge["add_deduct_tax"] = "Add" existing_shipping_charge = doc.get("taxes", filters=shipping_charge) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 43eaffa786b..24819c3ee19 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -2289,6 +2289,16 @@ class AccountsController(TransactionBase): return stock_items + def get_asset_items(self): + asset_items = [] + item_codes = list(set(item.item_code for item in self.get("items"))) + if item_codes: + asset_items = frappe.db.get_values( + "Item", {"name": ["in", item_codes], "is_fixed_asset": 1}, pluck="name", cache=True + ) + + return asset_items + def calculate_total_advance_from_ledger(self): adv = frappe.qb.DocType("Advance Payment Ledger Entry") return ( From 9787777cbddeb76b90ae976e5f318724b9d80907 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 09:15:08 +0000 Subject: [PATCH 212/217] fix(trends): added validation for `period_based_on` filter (backport #53690) (#53692) Co-authored-by: diptanilsaha fix(trends): added validation for `period_based_on` filter (#53690) --- erpnext/controllers/trends.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py index 476bde248cc..bc4e2b346d4 100644 --- a/erpnext/controllers/trends.py +++ b/erpnext/controllers/trends.py @@ -55,6 +55,14 @@ def validate_filters(filters): if filters.get("based_on") == filters.get("group_by"): frappe.throw(_("'Based On' and 'Group By' can not be same")) + if filters.get("period_based_on") and filters.period_based_on not in ["bill_date", "posting_date"]: + frappe.throw( + msg=_("{0} can be either {1} or {2}.").format( + frappe.bold("Period based On"), frappe.bold("Posting Date"), frappe.bold("Billing Date") + ), + title=_("Invalid Filter"), + ) + def get_data(filters, conditions): data = [] From 0d9af60f8aa52f6c244adb16a04e6580ab6f1be9 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 10:14:52 +0000 Subject: [PATCH 213/217] fix(manufacturing): update non-stock item dict (backport #53689) (#53699) Co-authored-by: Sudharsanan Ashok <135326972+Sudharsanan11@users.noreply.github.com> fix(manufacturing): update non-stock item dict (#53689) --- erpnext/manufacturing/doctype/bom/bom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index efcbc5fa9b9..58fce82c208 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -1558,13 +1558,14 @@ def add_non_stock_items_cost(stock_entry, work_order, expense_account, job_card= if work_order and not job_card: table = "exploded_items" if work_order.get("use_multi_level_bom") else "items" - items = {} + items = frappe._dict() for d in bom.get(table): # Phantom item is exploded, so its cost is considered via its components if d.get("is_phantom_item"): continue - items.setdefault(d.item_code, d.amount) + items.setdefault(d.item_code, 0) + items[d.item_code] += flt(d.amount) non_stock_items = frappe.get_all( "Item", From cd1dfeeab300f81bfba5461cf1c4bfaa81472fae Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 10:56:15 +0000 Subject: [PATCH 214/217] fix: check for `submit` permissions instead of `write` permissions when updating status (backport #53697) (#53703) Co-authored-by: diptanilsaha fix: check for `submit` permissions instead of `write` permissions when updating status (#53697) --- erpnext/buying/doctype/purchase_order/purchase_order.py | 2 +- erpnext/selling/doctype/sales_order/sales_order.py | 2 +- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 22e731a336c..a0daeca51f2 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -889,7 +889,7 @@ def get_list_context(context=None): @frappe.whitelist() def update_status(status, name): - po = frappe.get_lazy_doc("Purchase Order", name, check_permission="write") + po = frappe.get_lazy_doc("Purchase Order", name, check_permission="submit") po.update_status(status) po.update_delivered_qty_in_sales_order() diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 35ff3c054fd..dcf2ed1ad9b 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -1803,7 +1803,7 @@ def make_work_orders(items, sales_order, company, project=None): @frappe.whitelist() def update_status(status, name): - so = frappe.get_doc("Sales Order", name, check_permission="write") + so = frappe.get_doc("Sales Order", name, check_permission="submit") so.update_status(status) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 3e342222d99..e78faa9511a 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -1581,7 +1581,7 @@ def make_purchase_return(source_name, target_doc=None): @frappe.whitelist() def update_purchase_receipt_status(docname, status): - pr = frappe.get_lazy_doc("Purchase Receipt", docname, check_permission="write") + pr = frappe.get_lazy_doc("Purchase Receipt", docname, check_permission="submit") pr.update_status(status) From 604739d1dca4a9c5bd0117c33c47a40d04d97fa4 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 23 Mar 2026 16:29:47 +0530 Subject: [PATCH 215/217] fix: batch validation for subcontracting receipt (cherry picked from commit b8d201658ac805858b5be8838cd1bcf952dfd90b) --- erpnext/controllers/subcontracting_controller.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py index 5a276d574d4..6d886bd9ecf 100644 --- a/erpnext/controllers/subcontracting_controller.py +++ b/erpnext/controllers/subcontracting_controller.py @@ -1087,6 +1087,12 @@ class SubcontractingController(StockController): if self.doctype not in ["Purchase Invoice", "Purchase Receipt", "Subcontracting Receipt"]: return + if ( + frappe.db.get_single_value("Buying Settings", "backflush_raw_materials_of_subcontract_based_on") + == "BOM" + ): + return + for row in self.get(self.raw_material_table): key = (row.rm_item_code, row.main_item_code, row.get(self.subcontract_data.order_field)) if not self.__transferred_items or not self.__transferred_items.get(key): From 638373e1801a5d0a53ad18230cd53bb4c793eea2 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 15:59:49 +0000 Subject: [PATCH 216/217] chore: skip semgrep check for `db.commit` in `BootStrapTestData` (backport #53715) (#53717) Co-authored-by: diptanilsaha --- erpnext/tests/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 551fe8017aa..9485eb9af42 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -190,7 +190,7 @@ class BootStrapTestData: if not frappe.db.exists("Supplier Scorecard Standing", {"name": x.get("standing_name")}): frappe.get_doc(x).insert() - frappe.db.commit() + frappe.db.commit() # nosemgrep def make_master_data(self): self.make_fiscal_year() @@ -244,7 +244,7 @@ class BootStrapTestData: self.update_stock_settings() self.update_system_settings() - frappe.db.commit() + frappe.db.commit() # nosemgrep # custom doctype # DDL commands have implicit commit From d16adb157979b1c8ed350a5eb7d8731ce3415ca4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:14:22 +0000 Subject: [PATCH 217/217] chore(test_item_group): removed unused function `_print_tree` (backport #53716) (#53719) Co-authored-by: diptanilsaha --- erpnext/setup/doctype/item_group/test_item_group.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py index 20884664704..4724ac8c449 100644 --- a/erpnext/setup/doctype/item_group/test_item_group.py +++ b/erpnext/setup/doctype/item_group/test_item_group.py @@ -231,8 +231,3 @@ class TestItemGroup(ERPNextTestSuite): return no_of_children return get_no_of_children([item_group], 0) - - def _print_tree(self): - import json - - print(json.dumps(frappe.db.sql("select name, lft, rgt from `tabItem Group` order by lft"), indent=1))