Skip to content

Commit

Permalink
Merge pull request #183 from efeone/dr_status_change
Browse files Browse the repository at this point in the history
Update the status of linked design request according to design analysis
  • Loading branch information
muhammadmp authored Nov 10, 2023
2 parents fdd3cb2 + 83c4c7e commit 63b184f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 35 deletions.
47 changes: 26 additions & 21 deletions aumms/aumms/doctype/design_analysis/design_analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,25 @@ let create_bom_button = function(frm){
}
}

let request_for_verification = function(frm){
if(frm.doc.dr_required_check){
frappe.call({
method: 'aumms.aumms.doctype.design_analysis.design_analysis.create_design_request',
args: {
design_analysis: frm.doc.name
},
callback: (r) => {
frm.reload_doc()
},
})
}
else{
frm.scroll_to_field('verified_item');
if(frm.doc.verified_item.length<1){
frappe.msgprint("Please fill the verified item table");
let request_for_verification = function (frm) {
if (frm.doc.dr_required_check) {
frappe.call({
method: 'aumms.aumms.doctype.design_analysis.design_analysis.create_design_request',
args: {
design_analysis: frm.doc.name
},
callback: (r) => {
frm.set_value("status", "Request For Verification");
frm.save();
},
})
}
else {
frm.scroll_to_field('verified_item');
if (frm.doc.verified_item.length < 1) {
frappe.msgprint("Please fill the verified item table");
}
}
}
}

let request_for_approval = function(frm){
Expand Down Expand Up @@ -170,8 +171,10 @@ let make_request_for_approval = function (frm) {
},
freeze: true,
callback: (r) => {
frm.reload_doc();
d.hide()
frm.set_value("assigned_person", assign_to)
frm.set_value("status", "Request For Approval");
frm.save();
d.hide();
}
});
}
Expand Down Expand Up @@ -202,7 +205,7 @@ let approve_design_analysis = function(frm) {
callback: (r) => {
if (r.message) {
frm.set_value('aumms_item', r.message);
frm.set_value("status","Approved")
frm.set_value("status","Approved");
frm.save();
console.log('AuMMS Item Created:', r.message);

Expand Down Expand Up @@ -313,7 +316,9 @@ function create_bom(frm) {
},
freeze: true,
callback: (r) => {
frm.reload_doc();
frm.set_value("bom_created", 1);
frm.set_value("status", "BOM Created");
frm.save();
bom_dia.hide();
}
});
Expand Down
15 changes: 6 additions & 9 deletions aumms/aumms/doctype/design_analysis/design_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ class DesignAnalysis(Document):
def autoname(self):
if self.customer_name:
self.name = self.customer_name + '-' + self.item_code + '-' + frappe.utils.today()
def on_update(self):
design_request_doc = frappe.get_doc("Design Request", self.design_request)
design_request_doc.status = self.status
design_request_doc.save()
frappe.db.commit()

@frappe.whitelist()
def create_bom_function(doctype, docname,assign_to):
Expand All @@ -24,14 +29,12 @@ def create_bom_function(doctype, docname,assign_to):
bom_row.qty = row.quantity
bom.flags.ignore_mandatory = True
bom.save(ignore_permissions=True)
frappe.db.set_value(doctype, docname, 'bom_created', 1)
assign_to_list = [assign_to]
add_assign({
"assign_to": assign_to_list,
"doctype": bom.doctype,
"name": bom.name
})
frappe.db.set_value(doctype, docname, 'status','BOM Created')
frappe.db.commit()
frappe.msgprint("BOM Created", indicator="green", alert=1)
#Send system notification and email to assignee
Expand Down Expand Up @@ -119,9 +122,6 @@ def create_design_request(design_analysis):
design_request.delivery_date = frappe.utils.today()
design_request.flags.ignore_mandatory = True
design_request.save(ignore_permissions=True)
if doc.status == 'Draft':
frappe.db.set_value("Design Analysis", design_analysis, 'status', 'Request For Verification')
doc.reload()
frappe.msgprint("Design Request Created for the material {}".format(design_request.design_title), indicator="green", alert=1)

@frappe.whitelist()
Expand All @@ -131,7 +131,4 @@ def assign_design_analysis(doctype, docname, assign_to):
"assign_to": assign_to_list,
"doctype": doctype,
"name": docname
})
frappe.db.set_value(doctype, docname, 'assigned_person', assign_to)
frappe.db.set_value(doctype, docname, 'status','Request For Approval')
frappe.db.commit()
})
13 changes: 8 additions & 5 deletions aumms/aumms/doctype/design_request/design_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"customer",
"customer_name",
"mobile_no",
"status",
"column_break_ey72q",
"design_title",
"expected_weight",
Expand All @@ -21,8 +22,7 @@
"tab_break_gwdao",
"attachment",
"image",
"amended_from",
"status"
"amended_from"
],
"fields": [
{
Expand Down Expand Up @@ -128,16 +128,19 @@
"label": "Expected Weight"
},
{
"allow_on_submit": 1,
"fieldname": "status",
"fieldtype": "Data",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Status"
"label": "Status",
"options": "Draft\nRequest For Verification\nRequest For Approval\nApproved\nHold\nRejected\nBOM Created\nWorkorder Created",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-11-07 15:47:10.811032",
"modified": "2023-11-09 11:21:15.789726",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "Design Request",
Expand Down

0 comments on commit 63b184f

Please sign in to comment.