Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added comments to purchase_receipt.py and stock_entry.py #1279

Merged
merged 2 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +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
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
3 changes: 3 additions & 0 deletions erpnext/stock/doctype/stock_entry/stock_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +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
# 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