Skip to content

Commit 2ccac6c

Browse files
fix: ignore cost center (backport #53063) (#53614)
Co-authored-by: Sowmya <106989392+SowmyaArunachalam@users.noreply.github.com> fix: ignore cost center (#53063)
1 parent 17f8aa9 commit 2ccac6c

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

erpnext/accounts/doctype/sales_invoice/sales_invoice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2777,7 +2777,7 @@ def update_item(source, target, source_parent):
27772777
"doctype": target_doctype,
27782778
"postprocess": update_details,
27792779
"set_target_warehouse": "set_from_warehouse",
2780-
"field_no_map": ["taxes_and_charges", "set_warehouse", "shipping_address"],
2780+
"field_no_map": ["taxes_and_charges", "set_warehouse", "shipping_address", "cost_center"],
27812781
},
27822782
doctype + " Item": item_field_map,
27832783
},

erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4805,6 +4805,33 @@ def test_zero_valuation_for_standalone_credit_note_with_expired_batch(self):
48054805

48064806
self.assertEqual(stock_ledger_entry.incoming_rate, 0.0)
48074807

4808+
def test_inter_company_transaction_cost_center(self):
4809+
si = create_sales_invoice(
4810+
company="Wind Power LLC",
4811+
customer="_Test Internal Customer",
4812+
debit_to="Debtors - WP",
4813+
warehouse="Stores - WP",
4814+
income_account="Sales - WP",
4815+
expense_account="Cost of Goods Sold - WP",
4816+
parent_cost_center="Main - WP",
4817+
cost_center="Main - WP",
4818+
currency="USD",
4819+
do_not_save=1,
4820+
)
4821+
4822+
si.selling_price_list = "_Test Price List Rest of the World"
4823+
si.submit()
4824+
4825+
cost_center = frappe.db.get_value("Company", "_Test Company 1", "cost_center")
4826+
frappe.db.set_value("Company", "_Test Company 1", "cost_center", None)
4827+
4828+
target_doc = make_inter_company_transaction("Sales Invoice", si.name)
4829+
4830+
self.assertEqual(target_doc.cost_center, None)
4831+
self.assertEqual(target_doc.items[0].cost_center, None)
4832+
4833+
frappe.db.set_value("Company", "_Test Company 1", "cost_center", cost_center)
4834+
48084835

48094836
def make_item_for_si(item_code, properties=None):
48104837
from erpnext.stock.doctype.item.test_item import make_item

0 commit comments

Comments
 (0)