Skip to content

Commit

Permalink
Merge pull request #191 from efeone/create_stock_entry_from_da
Browse files Browse the repository at this point in the history
feat: Create stock entry on creating BOM
  • Loading branch information
muhammadmp authored Nov 16, 2023
2 parents 57b3088 + a97f092 commit 9d14f19
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 9 additions & 2 deletions aumms/aumms/doctype/aumms_settings/aumms_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"metal_ledger_uom",
"old_gold_item",
"column_break_2",
"metal_ledger_purity"
"metal_ledger_purity",
"default_warehouse"
],
"fields": [
{
Expand Down Expand Up @@ -40,12 +41,18 @@
"fieldtype": "Link",
"label": "Old Gold Item",
"options": "AuMMS Item"
},
{
"fieldname": "default_warehouse",
"fieldtype": "Link",
"label": "Default Warehouse",
"options": "Warehouse"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2023-08-04 10:11:36.992374",
"modified": "2023-11-15 12:10:31.006443",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "AuMMS Settings",
Expand Down
13 changes: 13 additions & 0 deletions aumms/aumms/doctype/design_analysis/design_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,21 @@ def create_bom_function(doctype, docname,assign_to):
"doctype": bom.doctype,
"name": bom.name
})
s_warehouse = frappe.get_single("AuMMS Settings").get("default_warehouse")
t_warehouse = frappe.get_value("Smith", {"email" : assign_to}, "warehouse")
stock_entry = frappe.new_doc("Stock Entry")
stock_entry.stock_entry_type = "Material Transfer"
for row in doc.verified_item:
items_row = stock_entry.append('items')
items_row.item_code = row.item
items_row.s_warehouse = s_warehouse
items_row.t_warehouse = t_warehouse
items_row.qty = row.quantity
items_row.allow_zero_valuation_rate = 1
stock_entry.submit()
frappe.db.commit()
frappe.msgprint("BOM Created", indicator="green", alert=1)
frappe.msgprint("Stock Entry Created", indicator="green", alert=1)
#Send system notification and email to assignee
subject = "New BOM request received"
content = "You've been assigned a new BOM for work order creation. Please review it at your earliest convenience."
Expand Down

0 comments on commit 9d14f19

Please sign in to comment.