fix(batch): fetch company on splitting the batch (#19558)
This commit is contained in:
parent
d00c59830e
commit
06c8129574
@ -185,9 +185,17 @@ def get_batches_by_oldest(item_code, warehouse):
|
|||||||
def split_batch(batch_no, item_code, warehouse, qty, new_batch_id=None):
|
def split_batch(batch_no, item_code, warehouse, qty, new_batch_id=None):
|
||||||
"""Split the batch into a new batch"""
|
"""Split the batch into a new batch"""
|
||||||
batch = frappe.get_doc(dict(doctype='Batch', item=item_code, batch_id=new_batch_id)).insert()
|
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(
|
stock_entry = frappe.get_doc(dict(
|
||||||
doctype='Stock Entry',
|
doctype='Stock Entry',
|
||||||
purpose='Repack',
|
purpose='Repack',
|
||||||
|
company=company,
|
||||||
items=[
|
items=[
|
||||||
dict(
|
dict(
|
||||||
item_code=item_code,
|
item_code=item_code,
|
||||||
|
Loading…
Reference in New Issue
Block a user