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] 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