Skip to content

Commit

Permalink
Merge pull request #20 from umarless/pragati_nirjay
Browse files Browse the repository at this point in the history
Pragati nirjay
  • Loading branch information
pragatihybrow authored Dec 4, 2024
2 parents a76f3d6 + 6667f7e commit 1954db5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions nirjay_customization/override/delivery_note.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from frappe.model.document import Document
import frappe

def create_stock_entry(doc, method):
stock_entry = frappe.new_doc("Stock Entry")
stock_entry.stock_entry_type = "Material Issue"
stock_entry.purpose = "Material Issue"
stock_entry.company = doc.company
stock_entry.from_warehouse = doc.set_warehouse


for item in doc.custom_carton_details:
item_uom = item.uom
item_qty = item.ply or 0
item_warehouse = item.source_warehouse or doc.set_warehouse

stock_entry.append("items", {
"item_code": item.item_codes,
"qty": item_qty,
"transfer_qty" : item_qty,
"uom": item_uom,
"stock_uom": item_uom,
"conversion_factor": 1,
"basic_rate": item.rate_per_box,
"warehouse": item_warehouse,
})

stock_entry.insert()
stock_entry.submit()

frappe.msgprint(f"Stock Entry {stock_entry.name} has been created.")

0 comments on commit 1954db5

Please sign in to comment.