From 501d48be5bba19dd13ef555704cbf10b08e6a4a5 Mon Sep 17 00:00:00 2001 From: Myuddin khatri Date: Tue, 18 May 2021 10:37:33 +0530 Subject: [PATCH] fix: added docstring to purchase_receipt.py and stock_entry.py --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 3 ++- erpnext/stock/doctype/stock_entry/stock_entry.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index ac8422d41f38..a345b3a8c5c9 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -217,9 +217,10 @@ def get_current_stock(self): d.current_stock = bin and flt(bin[0]['actual_qty']) or 0 def update_batch_with_supplier(self): - # update batch doc with supplier if batch doc don't have supplier + # update batch doc with supplier for item in self.items: batch_supplier = frappe.db.get_value("Batch", item.batch_no, "supplier") + # set supplier in batch doc if it does not exist in batch doc if not batch_supplier: frappe.db.set_value("Batch", item.batch_no, "supplier", self.supplier) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 66f8f4957761..8fd94b86870e 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -691,12 +691,14 @@ def update_stock_ledger(self): self.make_sl_entries(sl_entries, self.amended_from and 'Yes' or 'No') def update_batch_with_customer_provided_item(self): - # update batch doc with provided by customer if batch doc don't have provided by customer + # update batch doc with provided by customer + # set provided by customer in batch doc if stock entry type is "Material Receipt" if self.stock_entry_type == "Material Receipt": for item in self.items: item_data = frappe.db.get_values("Item", item.item_code, ["is_customer_provided_item", "has_batch_no"], as_dict=1) if item_data[0].is_customer_provided_item and item_data[0].has_batch_no and item.batch_no and item.material_request: batch_provided_by_customer = frappe.db.get_value("Batch", item.batch_no, "provided_by_customer") + # set provided by customer if it does not exist in batch doc if not batch_provided_by_customer: customer = frappe.db.get_value("Material Request", item.material_request, "customer") frappe.db.set_value("Batch", item.batch_no, "provided_by_customer", customer)