-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: Quality Inspection Rejection issue fixed #606
Conversation
Pull Request Test Coverage Report for Build 2397
💛 - Coveralls |
@@ -63,12 +63,23 @@ frappe.ui.form.on("Quality Inspection", { | |||
frappe.ui.form.on("Quality Inspection Reading", { | |||
status: function (frm, cdt, cdn) { | |||
let row = locals[cdt][cdn]; | |||
let not_rejected = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be:
let not_rejected = true; | |
let rejected = false; |
Seems like that'll be more readable
else { | ||
frm.doc.readings.forEach(reading => { | ||
if (reading.status === "Rejected") { | ||
not_rejected = false; | ||
} | ||
}); | ||
if (not_rejected) { | ||
frm.set_value("status", "Accepted"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should happen on the server side as well
@@ -68,10 +68,14 @@ def validate_certificate_of_analysis(self): | |||
frappe.throw(_("Please attach a Certificate of Analysis")) | |||
|
|||
def validate_reading_status(self): | |||
rejected = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rejected = False | |
self.status = "Accepted" |
for reading in self.readings: | ||
if reading.status == 'Rejected': | ||
self.status = "Rejected" | ||
return | ||
rejected = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rejected = True |
if not rejected: | ||
self.status = "Accepted" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not rejected: | |
self.status = "Accepted" |
else { | ||
frm.doc.readings.forEach(reading => { | ||
if (reading.status === "Rejected") { | ||
rejected = true; | ||
} | ||
}); | ||
if (!rejected) { | ||
frm.set_value("status", "Accepted"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else { | |
frm.doc.readings.forEach(reading => { | |
if (reading.status === "Rejected") { | |
rejected = true; | |
} | |
}); | |
if (!rejected) { | |
frm.set_value("status", "Accepted"); | |
} | |
} | |
let status = "Accepted"; | |
frm.doc.readings.forEach(reading => { | |
if (reading.status === "Rejected") { | |
status = "Rejected"; | |
} | |
}); | |
frm.set_value("status", status); |
… qi-rejection-issue
…erpnext into qi-rejection-issue
Co-authored-by: Himanshu <himanshuwarekar@yahoo.com>
TASK
Reported Isssue
PR Reference