fix(batch): fetch company on splitting the batch (#19558)
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index f609a0b..3e890b4 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -185,9 +185,17 @@
def split_batch(batch_no, item_code, warehouse, qty, new_batch_id=None):
"""Split the batch into a new batch"""
batch = frappe.get_doc(dict(doctype='Batch', item=item_code, batch_id=new_batch_id)).insert()
+
+ company = frappe.db.get_value('Stock Ledger Entry', dict(
+ item_code=item_code,
+ batch_no=batch_no,
+ warehouse=warehouse
+ ), ['company'])
+
stock_entry = frappe.get_doc(dict(
doctype='Stock Entry',
purpose='Repack',
+ company=company,
items=[
dict(
item_code=item_code,