From c15cc8fc28f33968ad64ceae80c8509ec7b80488 Mon Sep 17 00:00:00 2001 From: thefalconx33 Date: Tue, 24 Sep 2019 18:49:16 +0530 Subject: [PATCH] fix: #18624 --- erpnext/controllers/buying_controller.py | 2 ++ erpnext/stock/doctype/serial_no/serial_no.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 084f84b1f9..9d37df0406 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -598,6 +598,7 @@ class BuyingController(StockController): '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 @@ class BuyingController(StockController): '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 409a864678..19eb398130 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -362,6 +362,7 @@ def auto_make_serial_nos(args): 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 @@ def make_serial_no(serial_no, args): 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'):