fix: #18624
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 084f84b..9d37df0 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -598,6 +598,7 @@
'item_code': d.item_code,
'via_stock_ledger': False,
'company': self.company,
+ 'supplier': self.supplier,
'actual_qty': d.qty,
'purchase_document_type': self.doctype,
'purchase_document_no': self.name,
@@ -625,6 +626,7 @@
'asset_category': item_data.get('asset_category'),
'location': row.asset_location,
'company': self.company,
+ 'supplier': self.supplier,
'purchase_date': self.posting_date,
'calculate_depreciation': 1,
'purchase_receipt_amount': purchase_amount,
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index 409a864..19eb398 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -362,6 +362,7 @@
sr.batch_no = args.get('batch_no')
sr.location = args.get('location')
sr.company = args.get('company')
+ sr.supplier = args.get('supplier')
if sr.sales_order and args.get('voucher_type') == "Stock Entry" \
and not args.get('actual_qty', 0) > 0:
sr.sales_order = None
@@ -396,10 +397,12 @@
sr.via_stock_ledger = args.get('via_stock_ledger') or True
sr.asset = args.get('asset')
sr.location = args.get('location')
+
if args.get('purchase_document_type'):
sr.purchase_document_type = args.get('purchase_document_type')
sr.purchase_document_no = args.get('purchase_document_no')
+ sr.supplier = args.get('supplier')
sr.insert()
if args.get('warehouse'):