Skip to content

Commit

Permalink
feat: Created Design Request From Design Analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashna-v committed Oct 11, 2023
1 parent a8ba6ed commit 25b0c64
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
15 changes: 11 additions & 4 deletions aumms/aumms/doctype/design_analysis/design_analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ frappe.ui.form.on('Design Analysis', {
filters: {
"is_purity_uom":1
}
}
}
});
},
design_request: function(frm) {
Expand Down Expand Up @@ -173,11 +173,18 @@ frappe.ui.form.on('Design Analysis', {
}
else{
if(frm.doc.dr_required_check){
console.log("required");
frappe.call({
method: 'aumms.aumms.doctype.design_analysis.design_analysis.create_design_request',
args: {
design_analysis: frm.doc.name
}
})
}
else{
frappe.msgprint("Please fill the verified item table")
frm.scroll_to_field('verified_item');
frm.scroll_to_field('verified_item');
if(frm.doc.verified_item.length<1){
frappe.msgprint("Please fill the verified item table");
}
}
}
},
Expand Down
19 changes: 10 additions & 9 deletions aumms/aumms/doctype/design_analysis/design_analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"item_code",
"item_group",
"purity",
"phoneno",
"mobile_no",
"section_break_rgobr",
"column_break_y3jbr",
"section_break_qqgnh",
Expand Down Expand Up @@ -115,24 +115,25 @@
"options": "Item",
"read_only": 1
},
{
"fetch_from": "customer_name.mobile_no",
"fetch_if_empty": 1,
"fieldname": "phoneno",
"fieldtype": "Data",
"label": "Phone.No"
},
{
"default": "0",
"fieldname": "dr_required_check",
"fieldtype": "Check",
"hidden": 1,
"label": "DR Required Check",
"read_only": 1
},
{
"fetch_from": "customer_name.mobile_no",
"fetch_if_empty": 1,
"fieldname": "mobile_no",
"fieldtype": "Data",
"label": "Phone.No"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-10-07 18:20:51.635310",
"modified": "2023-10-11 16:50:52.012565",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "Design Analysis",
Expand Down
16 changes: 14 additions & 2 deletions aumms/aumms/doctype/design_analysis/design_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,17 @@ def supervisor_user_query(doctype, txt, searchfield, start, page_len, filters):
u.name like %s
""", ("%" + txt + "%"))



@frappe.whitelist()
def create_design_request(design_analysis):
doc = frappe.get_doc('Design Analysis', design_analysis)
if doc.dr_required_check == 1:
for design_detail in doc.design_details:
if design_detail.dr_required == 1:
design_request = frappe.new_doc('Design Request')
design_request.customer = doc.customer_name
design_request.mobile_no = doc.mobile_no
design_request.design_title = design_detail.material
design_request.delivery_date = frappe.utils.today()
design_request.flags.ignore_mandatory = True
design_request.save(ignore_permissions=True)
frappe.msgprint("Design Request Created for the material {}".format(design_request.design_title), indicator="green", alert=1)

0 comments on commit 25b0c64

Please sign in to comment.