Skip to content

Commit

Permalink
fix: added docstring to purchase_receipt.py and stock_entry.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Myuddin khatri committed May 18, 2021
1 parent 2bdbdc0 commit 501d48b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion erpnext/stock/doctype/stock_entry/stock_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 501d48b

Please sign in to comment.