refactor: QMS refactor initial bringup

This commit is contained in:
Himanshu Warekar 2019-05-29 00:05:58 +05:30
parent e7b8400fc7
commit 775e9e423a
79 changed files with 1427 additions and 4518 deletions

View File

@ -1,29 +0,0 @@
// Copyright (c) 2018, Frappe and contributors
// For license information, please see license.txt
frappe.ui.form.on('Customer Feedback', {
onload: function(frm){
frm.set_value("date", frappe.datetime.get_today());
$(".grid-add-row").hide();
frm.refresh();
},
template: function(frm){ // Used to fetch the parameters of the selected feedback template
frm.fields_dict.feedback.grid.remove_all();
if(frm.doc.template){
frappe.call({
"method": "frappe.client.get",
args: {
doctype: "Customer Feedback Template",
name: frm.doc.template
},
callback: function (data) {
for (var i = 0; i < data.message.feedback_parameter.length; i++ ){
frm.add_child("feedback");
frm.fields_dict.feedback.get_value()[i].parameter = data.message.feedback_parameter[i].parameter;
}
frm.refresh();
}
});
}
}
});

View File

@ -1,259 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "QMS-FDBK-.#####",
"beta": 0,
"creation": "2018-10-02 12:23:38.437696",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Customer",
"length": 0,
"no_copy": 0,
"options": "Customer",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "template",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Template",
"length": 0,
"no_copy": 0,
"options": "Customer Feedback Template",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "feedback_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Feedback",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "template.feedback_values",
"fieldname": "feedback",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "feedback",
"length": 0,
"no_copy": 0,
"options": "Customer Feedback Table",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-12 14:39:18.044191",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Customer Feedback",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -1,12 +0,0 @@
from frappe import _
def get_data():
return {
'fieldname': 'feedback',
'transactions': [
{
'label': _('Action'),
'items': ['Quality Action']
}
],
}

View File

@ -1,11 +0,0 @@
frappe.listview_settings['Customer Feedback'] = {
add_fields: ["action"],
get_indicator: function(doc) {
if(doc.action == "No Action") {
return [__("No Action"), "green", "action,=,No Action"];
}
else if(doc.action == "Action Initialised") {
return [__("Action Initialised"), "red", "action,=,Action Initialised"];
}
}
};

View File

@ -1,23 +0,0 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Customer Feedback", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Customer Survey
() => frappe.tests.make('Customer Feedback', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.quality_management.doctype.customer_feedback_template.test_customer_feedback_template import create_template
class TestCustomerFeedback(unittest.TestCase):
def test_customer_feedback(self):
create_template()
test_create_feedback = create_feedback()
test_get_feedback = get_feedback()
self.assertEquals(test_create_feedback.name, test_get_feedback.name)
def create_feedback():
feedback = frappe.get_doc({
"doctype": "Customer Feedback",
"template": "FDBK-TMPL-_Test Customer Feedback Template",
"date": ""+ frappe.utils.nowdate() +""
})
feedback_exist = frappe.get_list("Customer Feedback", filters={"date": ""+ feedback.date +""}, limit=1)
if len(feedback_exist) == 0:
feedback.insert()
return feedback
else:
return feedback_exist[0]
def get_feedback():
feedback = frappe.get_list("Customer Feedback", limit=1)
return feedback[0]

View File

@ -1,142 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-10-15 15:36:27.193355",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "parameter",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Parameter",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "rating",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Rating",
"length": 0,
"no_copy": 0,
"options": "1\n2\n3\n4\n5",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "qualitative_feedback",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Qualitative Feedback",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-11-01 14:29:03.273927",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Customer Feedback Table",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -1,5 +0,0 @@
// Copyright (c) 2018, Frappe and contributors
// For license information, please see license.txt
frappe.ui.form.on('Customer Feedback Template', {
});

View File

@ -1,259 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "format:FDBK-TMPL-{template}",
"beta": 0,
"creation": "2018-10-18 15:11:26.215480",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "template",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Template",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "scope",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Scope",
"length": 0,
"no_copy": 0,
"options": "Company\nDepartment",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.scope == 'Department'",
"fieldname": "department",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Department",
"length": 0,
"no_copy": 0,
"options": "Department",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "feedback_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Feedback",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "feedback_parameter",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Feedback",
"length": 0,
"no_copy": 0,
"options": "Customer Feedback Template Table",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-01 14:27:07.935761",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Customer Feedback Template",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -1,9 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class CustomerFeedbackTemplate(Document):
pass

View File

@ -1,23 +0,0 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Customer Feedback Template", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Customer Feedback Template
() => frappe.tests.make('Customer Feedback Template', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestCustomerFeedbackTemplate(unittest.TestCase):
def test_customer_feedback_template(self):
test_create_template = create_template()
test_get_template = get_template()
self.assertEquals(test_get_template.name, test_create_template.name)
def create_template():
template = frappe.get_doc({
"doctype": "Customer Feedback Template",
"template": "_Test Customer Feedback Template",
"scope": "Company",
"feedback_parameter": [
{
"parameter": "_Test Customer Feedback Template Parameter",
}
]
})
template_exist = frappe.get_list("Customer Feedback Template", filters={"template": ""+ template.template +""}, fields=["name"], limit=1)
if len(template_exist) == 0:
template.insert()
return template
else:
return template_exist[0]
def get_template():
template = frappe.get_list("Customer Feedback Template", filters={"template": "_Test Customer Feedback Template"}, limit=1)
return template[0]

View File

@ -1,75 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-10-18 15:23:03.854925",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "parameter",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Parameter",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-11-01 14:28:50.626709",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Customer Feedback Template Table",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -5,83 +5,28 @@ frappe.ui.form.on('Quality Action', {
onload: function(frm) { onload: function(frm) {
frm.set_value("date", frappe.datetime.get_today()); frm.set_value("date", frappe.datetime.get_today());
frm.refresh(); frm.refresh();
$(".grid-add-row").hide();
if (frm.doc.review){
frm.set_value("type", "Quality Review");
}
else{
frm.set_value("type", "Customer Feedback");
}
}, },
review: function(frm){ document_name: function(frm){
frm.fields_dict.description.grid.remove_all(); frappe.call({
if(frm.doc.review){ "method": "frappe.client.get",
var problems = ""; args: {
frappe.call({ doctype: frm.doc.document_type,
"method": "frappe.client.get", name: frm.doc.document_name
args: { },
doctype: "Quality Review", callback: function(data){
name: frm.doc.review frm.fields_dict.resolutions.grid.remove_all();
}, let objectives = [];
callback: function (data) { if(frm.doc.document_type === "Quality Review"){
for (var i = 0; i < data.message.values.length; i++){ for(var i in data.message.reviews) objectives.push(data.message.reviews[i].review);
if (data.message.values[i].achieved < data.message.values[i].target){ } else {
problems += data.message.values[i].objective +"-"+ data.message.values[i].achieved + " " + data.message.values[i].unit + "\n"; for(var i in data.message.parameters) objectives.push(data.message.parameters[i].feedback);
}
}
problems= problems.replace(/\n$/, "").split("\n");
for (i = 0; i < problems.length; i++){
frm.add_child("description");
frm.fields_dict.description.get_value()[i].problem = problems[i];
}
frm.refresh();
} }
}); for (var objective in objectives){
frappe.call({ frm.add_child("resolutions");
"method": "frappe.client.get", frm.fields_dict.resolutions.get_value()[objective].problem = objectives[objective];
args: {
doctype: "Quality Goal",
name: frm.doc.goal
},
callback: function (data) {
frm.doc.procedure = data.message.procedure;
frm.refresh();
} }
}); frm.refresh();
} }
else{ });
frm.doc.goal = '';
frm.doc.procedure = '';
frm.refresh();
}
}, },
feedback: function(frm) {
frm.fields_dict.description.grid.remove_all();
if(frm.doc.feedback){
frappe.call({
"method": "frappe.client.get",
args: {
doctype: "Customer Feedback",
name: frm.doc.feedback
},
callback: function(data){
for (var i = 0; i < data.message.feedback.length; i++ ){
frm.add_child("description");
frm.fields_dict.description.get_value()[i].problem = data.message.feedback[i].parameter +"-"+ data.message.feedback[i].qualitative_feedback;
}
frm.refresh();
}
});
}
},
type: function(frm){
if(frm.doc.description){
frm.fields_dict.description.grid.remove_all();
frm.doc.review = '';
frm.doc.feedback = '';
frm.doc.goal = '';
frm.doc.procedure = '';
frm.refresh();
}
}
}); });

View File

@ -1,493 +1,125 @@
{ {
"allow_copy": 0, "autoname": "format:ACTN-{#####}",
"allow_events_in_timeline": 0, "creation": "2018-10-02 11:40:43.666100",
"allow_guest_to_view": 0, "doctype": "DocType",
"allow_import": 0, "editable_grid": 1,
"allow_rename": 0, "engine": "InnoDB",
"autoname": "format:QMS-ACTN-{#####}", "field_order": [
"beta": 0, "corrective_preventive",
"creation": "2018-10-02 11:40:43.666100", "document_type",
"custom": 0, "goal",
"docstatus": 0, "cb_00",
"doctype": "DocType", "date",
"document_type": "", "document_name",
"editable_grid": 1, "procedure",
"engine": "InnoDB", "status",
"sb_00",
"resolutions"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "depends_on": "eval:doc.type == 'Quality Review'",
"allow_in_quick_entry": 0, "fetch_from": "review.goal",
"allow_on_submit": 0, "fieldname": "goal",
"bold": 0, "fieldtype": "Link",
"collapsible": 0, "label": "Goal",
"columns": 0, "options": "Quality Goal",
"fieldname": "action", "read_only": 1
"fieldtype": "Select", },
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Corrective/Preventive",
"length": 0,
"no_copy": 0,
"options": "Corrective\nPreventive",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "date",
"allow_in_quick_entry": 0, "fieldtype": "Date",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Date",
"collapsible": 0, "read_only": 1
"columns": 0, },
"depends_on": "eval:doc.type == 'Quality Review'",
"fieldname": "review",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Review",
"length": 0,
"no_copy": 0,
"options": "Quality Review",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "depends_on": "eval:doc.type == 'Quality Review'",
"allow_in_quick_entry": 0, "fieldname": "procedure",
"allow_on_submit": 0, "fieldtype": "Link",
"bold": 0, "label": "Procedure",
"collapsible": 0, "options": "Quality Procedure",
"columns": 0, "read_only": 1
"depends_on": "eval:doc.type == 'Customer Feedback'", },
"fieldname": "feedback",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Feedback",
"length": 0,
"no_copy": 0,
"options": "Customer Feedback",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "default": "Open",
"allow_in_quick_entry": 0, "fieldname": "status",
"allow_on_submit": 0, "fieldtype": "Select",
"bold": 0, "in_list_view": 1,
"collapsible": 0, "label": "Status",
"columns": 0, "options": "Open\nClosed"
"depends_on": "eval:doc.type == 'Quality Review'", },
"fetch_from": "review.goal",
"fieldname": "goal",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Quality Goal",
"length": 0,
"no_copy": 0,
"options": "Quality Goal",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "document_name",
"allow_in_quick_entry": 0, "fieldtype": "Dynamic Link",
"allow_on_submit": 0, "label": "Document Name",
"bold": 0, "options": "document_type"
"collapsible": 0, },
"columns": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "document_type",
"allow_in_quick_entry": 0, "fieldtype": "Select",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Document Type",
"collapsible": 0, "options": "Quality Review\nQuality Feedback",
"columns": 0, "reqd": 1
"fieldname": "type", },
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Type",
"length": 0,
"no_copy": 0,
"options": "Quality Review\nCustomer Feedback",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "default": "Corrective",
"allow_in_quick_entry": 0, "fieldname": "corrective_preventive",
"allow_on_submit": 0, "fieldtype": "Select",
"bold": 0, "in_list_view": 1,
"collapsible": 0, "label": "Corrective/Preventive",
"columns": 0, "options": "Corrective\nPreventive",
"fieldname": "date", "reqd": 1
"fieldtype": "Date", },
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "cb_00",
"allow_in_quick_entry": 0, "fieldtype": "Column Break"
"allow_on_submit": 0, },
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.type == 'Quality Review'",
"fetch_from": "",
"fieldname": "procedure",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Procedure",
"length": 0,
"no_copy": 0,
"options": "Quality Procedure",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "sb_00",
"allow_in_quick_entry": 0, "fieldtype": "Section Break",
"allow_on_submit": 0, "label": "Resolution"
"bold": 0, },
"collapsible": 0,
"columns": 0,
"fieldname": "status_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "resolutions",
"allow_in_quick_entry": 0, "fieldtype": "Table",
"allow_on_submit": 0, "label": "Resolutions",
"bold": 0, "options": "Quality Action Resolution"
"collapsible": 0,
"columns": 0,
"default": "Under Review",
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 0,
"options": "Under Review\nClose",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_10",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "problem_resolution",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "description",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Action Description",
"length": 0,
"no_copy": 0,
"options": "Quality Action Table",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "modified": "2019-05-28 13:10:44.092497",
"hide_heading": 0, "modified_by": "Administrator",
"hide_toolbar": 0, "module": "Quality Management",
"idx": 0, "name": "Quality Action",
"image_view": 0, "owner": "Administrator",
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-12 14:27:07.724362",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Action",
"name_case": "",
"owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "create": 1,
"cancel": 0, "delete": 1,
"create": 1, "email": 1,
"delete": 1, "export": 1,
"email": 1, "print": 1,
"export": 1, "read": 1,
"if_owner": 0, "report": 1,
"import": 0, "role": "System Manager",
"permlevel": 0, "share": 1,
"print": 1, "write": 1
"read": 1, },
"report": 1, {
"role": "System Manager", "create": 1,
"set_user_permissions": 0, "delete": 1,
"share": 1, "email": 1,
"submit": 0, "export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "All",
"share": 1,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0, "sort_field": "modified",
"read_only": 0, "sort_order": "DESC",
"read_only_onload": 0, "track_changes": 1
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
} }

View File

@ -3,18 +3,8 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class QualityAction(Document): class QualityAction(Document):
def validate(self): pass
status_flag = ''
for value in self.description:
if value.resolution == None:
value.status = 'Open'
status_flag = 'Under Review'
else:
value.status = 'Close'
if status_flag == 'Under Review':
self.status = 'Under Review'
else:
self.status = 'Close'

View File

@ -1,11 +0,0 @@
frappe.listview_settings['Quality Action'] = {
add_fields: ["status"],
get_indicator: function(doc) {
if(doc.status == "Planned") {
return [__("Planned"), "green", "status,=,Planned"];
}
else{
return [__("Under Review"), "red", "status,=,Under Review"];
}
}
};

View File

@ -19,28 +19,28 @@ class TestQualityAction(unittest.TestCase):
create_review() create_review()
test_create_action = create_action() test_create_action = create_action()
test_get_action = get_action() test_get_action = get_action()
self.assertEquals(test_create_action.name, test_get_action.name)
self.assertEquals(test_create_action.goal, test_get_action.goal) self.assertEquals(test_create_action, test_get_action)
def create_action(): def create_action():
review = frappe.get_list("Quality Review", limit=1) review = frappe.db.exists("Quality Review", {"goal": "GOAL-_Test Quality Goal"})
action = frappe.get_doc({ action = frappe.get_doc({
'doctype': 'Quality Action', "doctype": "Quality Action",
'action': 'Corrective', "action": "Corrective",
'type': 'Quality Review', "document_type": "Quality Review",
'review': ''+ review[0].name +'', "document_name": review,
'date': ''+ frappe.utils.nowdate() +'', "date": frappe.utils.nowdate(),
'goal': '_Test Quality Goal', "goal": "GOAL-_Test Quality Goal",
'procedure': '_Test Quality Procedure' "procedure": "PRC-_Test Quality Procedure"
}) })
action_exist = frappe.get_list("Quality Action", filters={"review": ""+ review[0].name +""}, fields=["name", "goal"], limit=1) action_exist = frappe.db.exists("Quality Action", {"review": review})
if len(action_exist) == 0:
if not action_exist:
action.insert() action.insert()
return action return action.name
else: else:
return action_exist[0] return action_exist
def get_action(): def get_action():
review = frappe.get_list("Quality Review", limit=1) review = frappe.db.exists("Quality Review", {"goal": "GOAL-_Test Quality Goal"})
action = frappe.get_list("Quality Action", filters={"review": ""+ review[0].name +""}, fields=["name", "goal"], limit=1) return frappe.db.exists("Quality Action", {"document_name": review})
return action[0]

View File

@ -0,0 +1,40 @@
{
"creation": "2019-05-26 20:36:44.337186",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"problem",
"sb_00",
"resolution"
],
"fields": [
{
"fieldname": "problem",
"fieldtype": "Long Text",
"in_list_view": 1,
"label": "Problem"
},
{
"fieldname": "sb_00",
"fieldtype": "Section Break"
},
{
"fieldname": "resolution",
"fieldtype": "Text Editor",
"in_list_view": 1,
"label": "Resolution"
}
],
"istable": 1,
"modified": "2019-05-28 13:09:50.435323",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Action Resolution",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class QualityActionResolution(Document):
pass

View File

@ -1,205 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-10-15 15:36:53.624990",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "problem",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Problem",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "resolution",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Resolution",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 0,
"options": "Open\nClose",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "responsible",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Responsible",
"length": 0,
"no_copy": 0,
"options": "Role",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "completion_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Completion Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-11-12 14:33:46.260600",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Action Table",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -0,0 +1,25 @@
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Quality Feedback', {
refresh: function(frm) {
frm.set_value("date", frappe.datetime.get_today());
},
template: function(frm){
frappe.call({
"method": "frappe.client.get",
args: {
doctype: "Quality Feedback Template",
name: frm.doc.template
},
callback: function(data){
frm.fields_dict.parameters.grid.remove_all();
for (var i in data.message.parameters){
frm.add_child("parameters");
frm.fields_dict.parameters.get_value()[i].parameter = data.message.parameters[i].parameter;
}
frm.refresh();
}
});
}
});

View File

@ -0,0 +1,95 @@
{
"autoname": "format:FDBK-{#####}",
"creation": "2019-05-26 21:23:05.308379",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"document_type",
"template",
"cb_00",
"document_name",
"date",
"sb_00",
"parameters"
],
"fields": [
{
"fieldname": "template",
"fieldtype": "Link",
"label": "Template",
"options": "Quality Feedback Template",
"reqd": 1
},
{
"fieldname": "cb_00",
"fieldtype": "Column Break"
},
{
"fieldname": "date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Date",
"read_only": 1
},
{
"fieldname": "sb_00",
"fieldtype": "Section Break"
},
{
"fetch_from": "template.feedback_values",
"fieldname": "parameters",
"fieldtype": "Table",
"label": "Parameters",
"options": "Quality Feedback Parameter"
},
{
"fieldname": "document_type",
"fieldtype": "Select",
"label": "Type",
"options": "User\nCustomer",
"reqd": 1
},
{
"fieldname": "document_name",
"fieldtype": "Dynamic Link",
"label": "Name",
"options": "document_type",
"reqd": 1
}
],
"modified": "2019-05-28 15:16:01.161662",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Feedback",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "All",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class CustomerFeedback(Document): class QualityFeedback(Document):
pass pass

View File

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.quality_management.doctype.quality_feedback_template.test_quality_feedback_template import create_template
class TestQualityFeedback(unittest.TestCase):
def test_quality_feedback(self):
create_template()
test_create_feedback = create_feedback()
test_get_feedback = get_feedback()
self.assertEqual(test_create_feedback, test_get_feedback)
def create_feedback():
feedabck = frappe.get_doc({
"doctype": "Quality Feedback",
"template": "TMPL-_Test Feedback Template",
"date": frappe.utils.nowdate(),
"parameters": [
{
"parameter": "Test Parameter",
"rating": 3,
"feedback": "Test Feedback"
}
]
})
feedback_exists = frappe.db.exists("Quality Feedback", {"template": "TMPL-_Test Feedback Template"})
if not feedback_exists:
feedabck.insert()
return feedabck.name
else:
return feedback_exists
def get_feedback():
return frappe.db.exists("Quality Feedback", {"template": "TMPL-_Test Feedback Template"})

View File

@ -0,0 +1,57 @@
{
"creation": "2019-05-26 21:25:01.715807",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"parameter",
"cb_00",
"rating",
"sb_00",
"feedback"
],
"fields": [
{
"fieldname": "parameter",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Parameter",
"read_only": 1
},
{
"fieldname": "cb_00",
"fieldtype": "Column Break"
},
{
"default": "1",
"fieldname": "rating",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Rating",
"options": "1\n2\n3\n4\n5",
"reqd": 1
},
{
"fieldname": "sb_00",
"fieldtype": "Section Break"
},
{
"fieldname": "feedback",
"fieldtype": "Text Editor",
"in_list_view": 1,
"label": "Feedback",
"reqd": 1
}
],
"istable": 1,
"modified": "2019-05-26 21:50:48.951264",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Feedback Parameter",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class QualityFeedbackParameter(Document):
pass

View File

@ -0,0 +1,8 @@
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Quality Feedback Template', {
// refresh: function(frm) {
// }
});

View File

@ -0,0 +1,59 @@
{
"autoname": "format:TMPL-{template}",
"creation": "2019-05-26 21:17:24.283061",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"template",
"cb_00",
"sb_00",
"parameters"
],
"fields": [
{
"fieldname": "template",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Template",
"reqd": 1
},
{
"fieldname": "cb_00",
"fieldtype": "Column Break"
},
{
"fieldname": "sb_00",
"fieldtype": "Section Break"
},
{
"fieldname": "parameters",
"fieldtype": "Table",
"label": "Parameters",
"options": "Quality Feedback Template Parameter"
}
],
"modified": "2019-05-26 21:48:47.770610",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Feedback Template",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class QualityFeedbackTemplate(Document):
pass

View File

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestQualityFeedbackTemplate(unittest.TestCase):
def test_quality_feedback_template(self):
test_create_template = create_template()
test_get_template = get_template()
self.assertEqual(test_create_template, test_get_template)
def create_template():
template = frappe.get_doc({
"doctype": "Quality Feedback Template",
"template": "_Test Feedback Template",
"parameters": [
{
"parameter": "Test Parameter"
}
]
})
template_exists = frappe.db.exists("Quality Feedback Template", {"template": "_Test Feedback Template"})
if not template_exists:
template.insert()
return template.name
else:
return template_exists
def get_template():
return frappe.db.exists("Quality Feedback Template", {"template": "_Test Feedback Template"})

View File

@ -0,0 +1,28 @@
{
"creation": "2019-05-26 21:20:40.520197",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"parameter"
],
"fields": [
{
"fieldname": "parameter",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Parameter"
}
],
"istable": 1,
"modified": "2019-05-26 21:23:53.574743",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Feedback Template Parameter",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class QualityFeedbackTemplateParameter(Document):
pass

View File

@ -2,40 +2,7 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Quality Goal', { frappe.ui.form.on('Quality Goal', {
onload: function(frm){ refresh: function(frm) {
if(frm.doc.measurable == "No"){ frm.doc.created_by = frappe.session.user;
hide_target_unit(frm);
}
else{
show_target_unit(frm);
}
},
revision: function(frm) {
if(!frm.doc.revised_on){
frm.set_value("revised_on", frappe.datetime.get_today());
}
},
measurable: function(frm) {
frm.fields_dict.objective.grid.remove_all();
if(frm.doc.measurable == "No"){
hide_target_unit(frm);
}
else{
show_target_unit(frm);
}
} }
}); });
function hide_target_unit(frm){
// hides target and unit columns as the goal cannot be measured in numeric values
frm.fields_dict.objective.grid.docfields[1].hidden = 1;
frm.fields_dict.objective.grid.docfields[2].hidden = 1;
frm.refresh();
}
function show_target_unit(frm){
// shows target and unit columns as the goal can be measured in numeric values
frm.fields_dict.objective.grid.docfields[1].hidden = 0;
frm.fields_dict.objective.grid.docfields[2].hidden = 0;
frm.refresh();
}

View File

@ -1,824 +1,149 @@
{ {
"allow_copy": 0, "autoname": "format:GOAL-{goal}",
"allow_events_in_timeline": 0, "creation": "2018-10-02 12:17:41.727541",
"allow_guest_to_view": 0, "doctype": "DocType",
"allow_import": 0, "editable_grid": 1,
"allow_rename": 0, "engine": "InnoDB",
"autoname": "format:{goal}", "field_order": [
"beta": 0, "goal",
"creation": "2018-10-02 12:17:41.727541", "frequency",
"custom": 0, "created_by",
"docstatus": 0, "cb_00",
"doctype": "DocType", "procedure",
"document_type": "", "weekday",
"editable_grid": 1, "quarter",
"engine": "InnoDB", "date",
"sb_00",
"revision",
"cb_01",
"revised_on",
"sb_01",
"objectives"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "fieldname": "created_by",
"allow_in_quick_entry": 0, "fieldtype": "Link",
"allow_on_submit": 0, "label": "Created By",
"bold": 0, "options": "User",
"collapsible": 0, "read_only": 1
"columns": 0, },
"fieldname": "goal", {
"fieldtype": "Data", "default": "None",
"hidden": 0, "fieldname": "frequency",
"ignore_user_permissions": 0, "fieldtype": "Select",
"ignore_xss_filter": 0, "in_list_view": 1,
"in_filter": 0, "label": "Monitoring Frequency",
"in_global_search": 0, "options": "None\nDaily\nWeekly\nMonthly\nQuarterly"
"in_list_view": 0, },
"in_standard_filter": 0, {
"label": "Name", "fieldname": "procedure",
"length": 0, "fieldtype": "Link",
"no_copy": 0, "in_list_view": 1,
"permlevel": 0, "label": "Procedure",
"precision": "", "options": "Quality Procedure"
"print_hide": 0, },
"print_hide_if_no_value": 0, {
"read_only": 0, "depends_on": "eval:doc.frequency == 'Monthly' || doc.frequency == 'Quarterly';",
"remember_last_selected_value": 0, "fieldname": "date",
"report_hide": 0, "fieldtype": "Select",
"reqd": 1, "label": "Date",
"search_index": 0, "options": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30"
"set_only_once": 0, },
"translatable": 0, {
"default": "0",
"fieldname": "revision",
"fieldtype": "Int",
"label": "Revision",
"read_only": 1
},
{
"fieldname": "revised_on",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Revised On",
"read_only": 1
},
{
"depends_on": "eval:doc.frequency == 'Weekly';",
"fieldname": "weekday",
"fieldtype": "Select",
"label": "Weekday",
"options": "Monday\nTuesday\nWednesday\nThursday\nFriday\nSaturday"
},
{
"fieldname": "cb_00",
"fieldtype": "Column Break"
},
{
"fieldname": "sb_00",
"fieldtype": "Section Break",
"label": "Revision and Revised On"
},
{
"fieldname": "cb_01",
"fieldtype": "Column Break"
},
{
"fieldname": "sb_01",
"fieldtype": "Section Break",
"label": "Objectives"
},
{
"fieldname": "objectives",
"fieldtype": "Table",
"label": "Objectives",
"options": "Quality Goal Objective"
},
{
"fieldname": "goal",
"fieldtype": "Data",
"label": "Goal",
"reqd": 1,
"unique": 1 "unique": 1
}, },
{ {
"allow_bulk_edit": 0, "default": "January-April-July-October",
"allow_in_quick_entry": 0, "depends_on": "eval:doc.frequency == 'Quarterly';",
"allow_on_submit": 0, "fieldname": "quarter",
"bold": 0, "fieldtype": "Select",
"collapsible": 0, "label": "Quarter",
"columns": 0, "options": "January-April-July-October",
"fieldname": "created_by", "read_only": 1
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Created By",
"length": 0,
"no_copy": 0,
"options": "User",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "None",
"fieldname": "frequency",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Monitoring Frequency",
"length": 0,
"no_copy": 0,
"options": "None\nDaily\nWeekly\nMonthly\nQuarterly\nHalf Yearly\nYearly",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "January-April-July-October",
"depends_on": "eval:doc.frequency == 'Quarterly'",
"fieldname": "quarterly",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Day",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "January-July",
"depends_on": "eval:doc.frequency == 'Half Yearly'",
"fieldname": "half",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Day",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "January",
"depends_on": "eval:doc.frequency == 'Yearly'",
"fieldname": "yearly",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Day",
"length": 0,
"no_copy": 0,
"options": "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "procedure",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Procedure",
"length": 0,
"no_copy": 0,
"options": "Quality Procedure",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "scope",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Scope",
"length": 0,
"no_copy": 0,
"options": "Company\nDepartment",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.frequency == 'Daily'",
"fieldname": "daily",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Day",
"length": 0,
"no_copy": 0,
"options": "Everyday",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.frequency == 'Weekly'",
"fieldname": "weekly",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Day",
"length": 0,
"no_copy": 0,
"options": "Monday\nTuesday\nWednesday\nThursday\nFriday\nSaturday",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.frequency == 'Quarterly' || doc.frequency == 'Half Yearly' || doc.frequency == 'Yearly' || doc.frequency == 'Monthly'",
"fieldname": "date",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Date",
"length": 0,
"no_copy": 0,
"options": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.scope == 'Department'",
"fieldname": "department",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Department",
"length": 0,
"no_copy": 0,
"options": "Department",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_8",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Revision and Revised On",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "revision",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Revision",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_10",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "revised_on",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Revised On",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "measurable_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Measurable Goal",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Yes",
"fieldname": "measurable",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Measurable Goal",
"length": 0,
"no_copy": 0,
"options": "Yes\nNo",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_20",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Target and Unit are disabled",
"depends_on": "eval:doc.measurable == 'No'",
"fieldname": "measurable_display",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Measurable",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_11",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Goal Objectives",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "objective",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Objective",
"length": 0,
"no_copy": 0,
"options": "Quality Objective",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "modified": "2019-05-28 14:49:12.768863",
"hide_heading": 0, "modified_by": "Administrator",
"hide_toolbar": 0, "module": "Quality Management",
"idx": 0, "name": "Quality Goal",
"image_view": 0, "owner": "Administrator",
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-12 14:35:18.498549",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Goal",
"name_case": "",
"owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "create": 1,
"cancel": 0, "delete": 1,
"create": 1, "email": 1,
"delete": 1, "export": 1,
"email": 1, "print": 1,
"export": 1, "read": 1,
"if_owner": 0, "report": 1,
"import": 0, "role": "System Manager",
"permlevel": 0, "share": 1,
"print": 1, "write": 1
"read": 1, },
"report": 1, {
"role": "System Manager", "create": 1,
"set_user_permissions": 0, "delete": 1,
"share": 1, "email": 1,
"submit": 0, "export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "All",
"share": 1,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0, "sort_field": "modified",
"read_only": 0, "sort_order": "DESC",
"read_only_onload": 0, "track_changes": 1
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
} }

View File

@ -3,8 +3,12 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class QualityGoal(Document): class QualityGoal(Document):
pass
def validate(self):
self.revision += 1
self.revised_on = frappe.utils.today()

View File

@ -1,16 +1,12 @@
from frappe import _ from frappe import _
def get_data(): def get_data():
return { return {
'fieldname': 'goal', 'fieldname': 'goal',
'transactions': [ 'transactions': [
{ {
'label': _('Review'), 'label': _('Review'),
'items': ['Quality Review'] 'items': ['Quality Review']
}, }
{ ]
'label': _('Action'), }
'items': ['Quality Action']
}
]
}

View File

@ -14,33 +14,31 @@ class TestQualityGoal(unittest.TestCase):
create_unit() create_unit()
test_create_goal = create_goal() test_create_goal = create_goal()
test_get_goal = get_goal() test_get_goal = get_goal()
self.assertEquals(test_create_goal, test_get_goal) self.assertEquals(test_create_goal, test_get_goal)
def create_goal(): def create_goal():
goal = frappe.get_doc({ goal = frappe.get_doc({
"doctype": "Quality Goal", "doctype": "Quality Goal",
"goal": "_Test Quality Goal", "goal": "_Test Quality Goal",
"revision": "1", "procedure": "PRC-_Test Quality Procedure",
"procedure": "_Test Quality Procedure", "objectives": [
"frequency": "Daily",
"measureable": "Yes",
"objective": [
{ {
"objective": "_Test Quality Objective", "objective": "_Test Quality Objective",
"target": "4", "target": "4",
"unit": "_Test UOM" "uom": "_Test UOM"
} }
] ]
}) })
goal_exist = frappe.db.exists("Quality Goal", ""+ goal.goal +"") goal_exist = frappe.db.exists("Quality Goal", {"goal": goal.goal})
if not goal_exist: if not goal_exist:
goal.insert() goal.insert()
return goal.goal return goal
else: else:
return goal_exist return goal_exist
def get_goal(): def get_goal():
goal = frappe.db.exists("Quality Goal", "_Test Quality Goal") goal = frappe.db.exists("Quality Goal", "GOAL-_Test Quality Goal")
return goal return goal
def create_unit(): def create_unit():
@ -48,6 +46,6 @@ def create_unit():
"doctype": "UOM", "doctype": "UOM",
"uom_name": "_Test UOM", "uom_name": "_Test UOM",
}) })
unit_exist = frappe.db.exists("UOM", ""+ unit.uom_name +"") unit_exist = frappe.db.exists("UOM", unit.uom_name)
if not unit_exist: if not unit_exist:
unit.insert() unit.insert()

View File

@ -0,0 +1,51 @@
{
"autoname": "format:{####}",
"creation": "2019-05-26 15:03:43.996455",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"objective",
"cb_00",
"target",
"uom"
],
"fields": [
{
"fetch_from": "goal.objective",
"fieldname": "objective",
"fieldtype": "Text",
"in_list_view": 1,
"label": "Objective",
"reqd": 1
},
{
"fieldname": "target",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Target"
},
{
"fieldname": "uom",
"fieldtype": "Link",
"in_list_view": 1,
"label": "UOM",
"options": "UOM"
},
{
"fieldname": "cb_00",
"fieldtype": "Column Break"
}
],
"istable": 1,
"modified": "2019-05-26 16:12:54.832058",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Goal Objective",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document from frappe.model.document import Document
class CustomerFeedbackTemplateTable(Document): class QualityGoalObjective(Document):
pass pass

View File

@ -1,225 +1,93 @@
{ {
"allow_copy": 0, "autoname": "format:MTNG-{date}",
"allow_guest_to_view": 0, "creation": "2018-10-15 16:25:41.548432",
"allow_import": 0, "doctype": "DocType",
"allow_rename": 0, "editable_grid": 1,
"autoname": "format:QMS-MTN-{date}", "engine": "InnoDB",
"beta": 0, "field_order": [
"creation": "2018-10-15 16:25:41.548432", "date",
"custom": 0, "cb_00",
"docstatus": 0, "status",
"doctype": "DocType", "sb_00",
"document_type": "", "agenda",
"editable_grid": 1, "sb_01",
"engine": "InnoDB", "minutes"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "fieldname": "date",
"allow_in_quick_entry": 0, "fieldtype": "Date",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Date",
"collapsible": 0, "read_only": 1
"columns": 0, },
"fieldname": "date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Meeting Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "default": "Open",
"allow_in_quick_entry": 0, "fieldname": "status",
"allow_on_submit": 0, "fieldtype": "Select",
"bold": 0, "label": "Status",
"collapsible": 0, "options": "Open\nClose"
"columns": 0, },
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "minutes",
"allow_in_quick_entry": 0, "fieldtype": "Table",
"allow_on_submit": 0, "label": "Minutes",
"bold": 0, "options": "Quality Meeting Minutes"
"collapsible": 0, },
"columns": 0,
"default": "Open",
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 0,
"options": "Open\nClose",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "cb_00",
"allow_in_quick_entry": 0, "fieldtype": "Column Break"
"allow_on_submit": 0, },
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "minutes_break",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Minutes",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "sb_00",
"allow_in_quick_entry": 0, "fieldtype": "Section Break",
"allow_on_submit": 0, "label": "Agenda"
"bold": 0, },
"collapsible": 0, {
"columns": 0, "fieldname": "agenda",
"fieldname": "minutes", "fieldtype": "Table",
"fieldtype": "Table", "label": "Agenda",
"hidden": 0, "options": "Quality Meeting Agenda"
"ignore_user_permissions": 0, },
"ignore_xss_filter": 0, {
"in_filter": 0, "fieldname": "sb_01",
"in_global_search": 0, "fieldtype": "Section Break",
"in_list_view": 0, "label": "Minutes"
"in_standard_filter": 0,
"label": "Minutes",
"length": 0,
"no_copy": 0,
"options": "Quality Meeting Table",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "modified": "2019-05-26 23:12:23.364357",
"hide_heading": 0, "modified_by": "Administrator",
"hide_toolbar": 0, "module": "Quality Management",
"idx": 0, "name": "Quality Meeting",
"image_view": 0, "owner": "Administrator",
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-10-18 14:44:04.494395",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Meeting",
"name_case": "",
"owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "create": 1,
"cancel": 0, "delete": 1,
"create": 1, "email": 1,
"delete": 1, "export": 1,
"email": 1, "print": 1,
"export": 1, "read": 1,
"if_owner": 0, "report": 1,
"import": 0, "role": "System Manager",
"permlevel": 0, "share": 1,
"print": 1, "write": 1
"read": 1, },
"report": 1, {
"role": "System Manager", "create": 1,
"set_user_permissions": 0, "delete": 1,
"share": 1, "email": 1,
"submit": 0, "export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "All",
"share": 1,
"write": 1 "write": 1
} }
], ],
"quick_entry": 1, "quick_entry": 1,
"read_only": 0, "sort_field": "modified",
"read_only_onload": 0, "sort_order": "DESC",
"show_name_in_global_search": 0, "track_changes": 1
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
} }

View File

@ -6,13 +6,4 @@ from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document
class QualityMeeting(Document): class QualityMeeting(Document):
def validate(self): pass
problem = ''
for data in self.minutes:
if data.status == 'Open':
problem = 'set'
if problem == 'set':
self.status = 'Open'
else:
self.status = 'Close'

View File

@ -5,27 +5,41 @@ from __future__ import unicode_literals
import frappe import frappe
import unittest import unittest
from erpnext.quality_management.doctype.quality_review.test_quality_review import create_review
class TestQualityMeeting(unittest.TestCase): class TestQualityMeeting(unittest.TestCase):
def test_quality_meeting(self): def test_quality_meeting(self):
create_review()
test_create_meeting = create_meeting() test_create_meeting = create_meeting()
test_get_meeting = get_meeting() test_get_meeting = get_meeting()
self.assertEquals(test_create_meeting.name, test_get_meeting.name) self.assertEquals(test_create_meeting, test_get_meeting)
def create_meeting(): def create_meeting():
meeting = frappe.get_doc({ meeting = frappe.get_doc({
"doctype": "Quality Meeting", "doctype": "Quality Meeting",
"scope": "Company", "status": "Open",
"status": "Close", "date": frappe.utils.nowdate(),
"date": ""+ frappe.as_unicode(frappe.utils.nowdate()) +"" "agenda": [
{
"agenda": "Test Agenda"
}
],
"minutes": [
{
"document_type": "Quality Review",
"document_name": frappe.db.exists("Quality Review", {"goal": "GOAL-_Test Quality Goal"}),
"minute": "Test Minute"
}
]
}) })
meeting_exist = frappe.get_list("Quality Meeting", filters={"date": ""+ meeting.date +""}, fields=["name"], limit=1) meeting_exist = frappe.db.exists("Quality Meeting", {"date": frappe.utils.nowdate(), "status": "Open"})
if len(meeting_exist) == 0:
if not meeting_exist:
meeting.insert() meeting.insert()
return meeting return meeting.name
else: else:
return meeting_exist[0] return meeting_exist
def get_meeting(): def get_meeting():
meeting = frappe.get_list("Quality Meeting", limit=1) meeting = frappe.db.exists("Quality Meeting", {"date": frappe.utils.nowdate(), "status": "Open"})
return meeting[0] return meeting

View File

@ -0,0 +1,8 @@
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Quality Meeting Agenda', {
// refresh: function(frm) {
// }
});

View File

@ -0,0 +1,28 @@
{
"creation": "2019-05-26 20:46:57.999300",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"agenda"
],
"fields": [
{
"fieldname": "agenda",
"fieldtype": "Text Editor",
"in_list_view": 1,
"label": "Agenda"
}
],
"istable": 1,
"modified": "2019-05-26 20:49:01.328146",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Meeting Agenda",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "ASC",
"track_changes": 1
}

View File

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document from frappe.model.document import Document
class CustomerFeedbackTable(Document): class QualityMeetingAgenda(Document):
pass pass

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestQualityMeetingAgenda(unittest.TestCase):
pass

View File

@ -0,0 +1,55 @@
{
"creation": "2019-05-26 20:45:26.226428",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"document_type",
"cb_00",
"document_name",
"sb_00",
"minute"
],
"fields": [
{
"fieldname": "sb_00",
"fieldtype": "Section Break"
},
{
"fieldname": "minute",
"fieldtype": "Text Editor",
"in_list_view": 1,
"label": "Minute"
},
{
"fieldname": "document_type",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Document Type",
"options": "Quality Review\nQuality Action\nQuality Feedback",
"reqd": 1
},
{
"fieldname": "cb_00",
"fieldtype": "Column Break"
},
{
"fieldname": "document_name",
"fieldtype": "Dynamic Link",
"in_list_view": 1,
"label": "Document Name",
"options": "document_type"
}
],
"istable": 1,
"modified": "2019-05-26 22:00:24.833920",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Meeting Minutes",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document from frappe.model.document import Document
class QualityActionTable(Document): class QualityMeetingMinutes(Document):
pass pass

View File

@ -1,175 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-10-15 16:28:59.840039",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "review",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Review",
"length": 0,
"no_copy": 0,
"options": "Quality Review",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "action",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Action",
"length": 0,
"no_copy": 0,
"options": "Under Review\nPlanned",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "responsible",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Responsible",
"length": 0,
"no_copy": 0,
"options": "Role",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 0,
"options": "Open\nClose",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-11-01 14:34:53.964306",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Meeting Table",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -1,144 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "format:{####}",
"beta": 0,
"creation": "2018-10-02 16:47:59.600155",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "goal.objective",
"fieldname": "objective",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Objective",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "target",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Target",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "unit",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Unit",
"length": 0,
"no_copy": 0,
"options": "UOM",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-11-11 13:31:16.044780",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Objective",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -1,9 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class QualityObjective(Document):
pass

View File

@ -1,386 +1,106 @@
{ {
"allow_copy": 0, "autoname": "format:PRC-{procedure}",
"allow_events_in_timeline": 0, "creation": "2018-10-06 00:06:29.756804",
"allow_guest_to_view": 0, "doctype": "DocType",
"allow_import": 0, "editable_grid": 1,
"allow_rename": 0, "engine": "InnoDB",
"autoname": "format:{procedure}", "field_order": [
"beta": 0, "procedure",
"creation": "2018-10-06 00:06:29.756804", "parent_quality_procedure",
"custom": 0, "is_group",
"docstatus": 0, "sb_00",
"doctype": "DocType", "processes",
"document_type": "", "lft",
"editable_grid": 1, "rgt",
"engine": "InnoDB", "old_parent"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "fieldname": "parent_quality_procedure",
"allow_in_quick_entry": 0, "fieldtype": "Link",
"allow_on_submit": 0, "label": "Parent Procedure",
"bold": 0, "options": "Quality Procedure",
"collapsible": 0, "read_only": 1
"columns": 0, },
"fieldname": "procedure",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Procedure",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "default": "0",
"allow_in_quick_entry": 0, "fieldname": "is_group",
"allow_on_submit": 0, "fieldtype": "Check",
"bold": 0, "label": "Is Group",
"collapsible": 0, "read_only": 1
"columns": 0, },
"fieldname": "parent_quality_procedure",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Parent Procedure",
"length": 0,
"no_copy": 0,
"options": "Quality Procedure",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "lft",
"allow_in_quick_entry": 0, "fieldtype": "Int",
"allow_on_submit": 0, "hidden": 1,
"bold": 0, "label": "Lft",
"collapsible": 0, "read_only": 1
"columns": 0, },
"fieldname": "is_group",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Group",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "rgt",
"allow_in_quick_entry": 0, "fieldtype": "Int",
"allow_on_submit": 0, "hidden": 1,
"bold": 0, "label": "Rgt",
"collapsible": 0, "read_only": 1
"columns": 0, },
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "old_parent",
"allow_in_quick_entry": 0, "fieldtype": "Data",
"allow_on_submit": 0, "hidden": 1,
"bold": 0, "label": "old_parent",
"collapsible": 0, "read_only": 1
"columns": 0, },
"fieldname": "department",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Department",
"length": 0,
"no_copy": 0,
"options": "Department",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "sb_00",
"allow_in_quick_entry": 0, "fieldtype": "Section Break",
"allow_on_submit": 0, "label": "Processes"
"bold": 0, },
"collapsible": 0,
"columns": 0,
"fieldname": "procedure_steps_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Procedure Steps",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "processes",
"allow_in_quick_entry": 0, "fieldtype": "Table",
"allow_on_submit": 0, "label": "Processes",
"bold": 0, "options": "Quality Procedure Process"
"collapsible": 0, },
"columns": 0,
"fieldname": "procedure_step",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Procedure",
"length": 0,
"no_copy": 0,
"options": "Quality Procedure Table",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "procedure",
"allow_in_quick_entry": 0, "fieldtype": "Data",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Procedure",
"collapsible": 0, "reqd": 1
"columns": 0,
"fieldname": "lft",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Lft",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "rgt",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Rgt",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "old_parent",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "old_parent",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "modified": "2019-05-26 22:11:53.771428",
"hide_heading": 0, "modified_by": "Administrator",
"hide_toolbar": 0, "module": "Quality Management",
"idx": 0, "name": "Quality Procedure",
"image_view": 0, "owner": "Administrator",
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-12 14:30:19.803693",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Procedure",
"name_case": "",
"owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "create": 1,
"cancel": 0, "delete": 1,
"create": 1, "email": 1,
"delete": 1, "export": 1,
"email": 1, "print": 1,
"export": 1, "read": 1,
"if_owner": 0, "report": 1,
"import": 0, "role": "System Manager",
"permlevel": 0, "share": 1,
"print": 1, "write": 1
"read": 1, },
"report": 1, {
"role": "System Manager", "create": 1,
"set_user_permissions": 0, "delete": 1,
"share": 1, "email": 1,
"submit": 0, "export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "All",
"share": 1,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0, "sort_field": "modified",
"read_only": 0, "sort_order": "DESC",
"read_only_onload": 0, "track_changes": 1
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
} }

View File

@ -11,12 +11,11 @@ class QualityProcedure(NestedSet):
nsm_parent_field = 'parent_quality_procedure' nsm_parent_field = 'parent_quality_procedure'
def before_save(self): def before_save(self):
for data in self.procedure_step: for process in self.processes:
if data.procedure == 'Procedure' and data.procedure_name: if process.procedure:
data.step = data.procedure_name doc = frappe.get_doc("Quality Procedure", process.procedure)
doc = frappe.get_doc("Quality Procedure", data.procedure_name) if doc.parent_quality_procedure:
if(doc.parent_quality_procedure): frappe.throw(_("{0} already has a Parent Procedure {1}.".format(process.procedure, doc.parent_quality_procedure)))
frappe.throw(_("'"+ data.procedure_name +"' already has a Parent Procedure '"+ doc.parent_quality_procedure +"'"))
self.is_group = 1 self.is_group = 1
def on_update(self): def on_update(self):
@ -28,25 +27,28 @@ class QualityProcedure(NestedSet):
def on_trash(self): def on_trash(self):
if self.parent_quality_procedure: if self.parent_quality_procedure:
doc = frappe.get_doc("Quality Procedure", self.parent_quality_procedure) doc = frappe.get_doc("Quality Procedure", self.parent_quality_procedure)
for data in doc.procedure_step: for process in doc.processes:
if data.procedure_name == self.name: if process.procedure == self.name:
doc.procedure_step.remove(data) doc.processes.remove(process)
doc.save() doc.save(ignore_permissions=True)
flag_is_group = 0 flag_is_group = 0
doc.load_from_db() doc.load_from_db()
for data in doc.procedure_step:
if data.procedure == "Procedure": for process in doc.processes:
if process.procedure:
flag_is_group = 1 flag_is_group = 1
if flag_is_group == 0: if flag_is_group == 0:
doc.is_group = 0 doc.is_group = 0
doc.save() doc.save(ignore_permissions=True)
def set_parent(self): def set_parent(self):
for data in self.procedure_step: for process in self.processes:
if data.procedure == 'Procedure' and data.procedure_name: if process.procedure:
doc = frappe.get_doc("Quality Procedure", data.procedure_name) doc = frappe.get_doc("Quality Procedure", process.procedure)
doc.parent_quality_procedure = self.name doc.parent_quality_procedure = self.name
doc.save() doc.save(ignore_permissions=True)
@frappe.whitelist() @frappe.whitelist()
def get_children(doctype, parent=None, parent_quality_procedure=None, is_root=False): def get_children(doctype, parent=None, parent_quality_procedure=None, is_root=False):
@ -57,8 +59,11 @@ def get_children(doctype, parent=None, parent_quality_procedure=None, is_root=Fa
@frappe.whitelist() @frappe.whitelist()
def add_node(): def add_node():
from frappe.desk.treeview import make_tree_args from frappe.desk.treeview import make_tree_args
args = frappe.form_dict args = frappe.form_dict
args = make_tree_args(**args) args = make_tree_args(**args)
if args.parent_quality_procedure == 'All Quality Procedures': if args.parent_quality_procedure == 'All Quality Procedures':
args.parent_quality_procedure = None args.parent_quality_procedure = None
frappe.get_doc(args).insert() frappe.get_doc(args).insert()

View File

@ -1,20 +1,20 @@
from frappe import _ from frappe import _
def get_data(): def get_data():
return { return {
'fieldname': 'procedure', 'fieldname': 'procedure',
'transactions': [ 'transactions': [
{ {
'label': _('Goal'), 'label': _('Goal'),
'items': ['Quality Goal'] 'items': ['Quality Goal']
}, },
{ {
'label': _('Review'), 'label': _('Review'),
'items': ['Quality Review'] 'items': ['Quality Review']
}, },
{ {
'label': _('Action'), 'label': _('Action'),
'items': ['Quality Action'] 'items': ['Quality Action']
} }
], ],
} }

View File

@ -11,25 +11,26 @@ class TestQualityProcedure(unittest.TestCase):
test_create_procedure = create_procedure() test_create_procedure = create_procedure()
test_create_nested_procedure = create_nested_procedure() test_create_nested_procedure = create_nested_procedure()
test_get_procedure, test_get_nested_procedure = get_procedure() test_get_procedure, test_get_nested_procedure = get_procedure()
self.assertEquals(test_create_procedure, test_get_procedure.name)
self.assertEquals(test_create_nested_procedure, test_get_nested_procedure.name) self.assertEquals(test_create_procedure, test_get_procedure.get("name"))
self.assertEquals(test_get_nested_procedure.name, test_get_procedure.parent_quality_procedure) self.assertEquals(test_create_nested_procedure, test_get_nested_procedure.get("name"))
def create_procedure(): def create_procedure():
procedure = frappe.get_doc({ procedure = frappe.get_doc({
"doctype": "Quality Procedure", "doctype": "Quality Procedure",
"procedure": "_Test Quality Procedure", "procedure": "_Test Quality Procedure",
"procedure_step": [ "processes": [
{ {
"procedure": "Step", "process_description": "_Test Quality Procedure Table",
"step": "_Test Quality Procedure Table",
} }
] ]
}) })
procedure_exist = frappe.db.exists("Quality Procedure",""+ procedure.procedure +"")
procedure_exist = frappe.db.exists("Quality Procedure", "PRC-_Test Quality Procedure")
if not procedure_exist: if not procedure_exist:
procedure.insert() procedure.insert()
return procedure.procedure return procedure.name
else: else:
return procedure_exist return procedure_exist
@ -37,21 +38,22 @@ def create_nested_procedure():
nested_procedure = frappe.get_doc({ nested_procedure = frappe.get_doc({
"doctype": "Quality Procedure", "doctype": "Quality Procedure",
"procedure": "_Test Nested Quality Procedure", "procedure": "_Test Nested Quality Procedure",
"procedure_step": [ "processes": [
{ {
"procedure": "Procedure", "procedure": "PRC-_Test Quality Procedure"
"procedure_name": "_Test Quality Procedure",
} }
] ]
}) })
nested_procedure_exist = frappe.db.exists("Quality Procedure",""+ nested_procedure.procedure +"")
nested_procedure_exist = frappe.db.exists("Quality Procedure", "PRC-_Test Nested Quality Procedure")
if not nested_procedure_exist: if not nested_procedure_exist:
nested_procedure.insert() nested_procedure.insert()
return nested_procedure.procedure return nested_procedure.name
else: else:
return nested_procedure_exist return nested_procedure_exist
def get_procedure(): def get_procedure():
procedure = frappe.get_all("Quality Procedure", filters={"procedure": "_Test Quality Procedure"}, fields=["name", "parent_quality_procedure"], limit=1) procedure = frappe.get_doc("Quality Procedure", "PRC-_Test Quality Procedure")
nested_procedure = frappe.get_all("Quality Procedure", filters={"procedure": "_Test Nested Quality Procedure"}, fields=["name", "parent_quality_procedure"], limit=1) nested_procedure = frappe.get_doc("Quality Procedure", "PRC-_Test Nested Quality Procedure")
return procedure[0], nested_procedure[0] return {"name": procedure.name}, {"name": nested_procedure.name, "parent_quality_procedure": nested_procedure.parent_quality_procedure}

View File

@ -0,0 +1,36 @@
{
"creation": "2019-05-26 00:10:00.248885",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"process_description",
"procedure"
],
"fields": [
{
"fieldname": "process_description",
"fieldtype": "Text Editor",
"in_list_view": 1,
"label": "Process Description"
},
{
"description": "Link existing Quality Procedure.",
"fieldname": "procedure",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Procedure",
"options": "Quality Procedure"
}
],
"istable": 1,
"modified": "2019-05-26 22:05:49.007189",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Procedure Process",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class QualityProcedureProcess(Document):
pass

View File

@ -1,176 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-10-17 15:48:57.617831",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 0,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "procedure",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Procedure",
"length": 0,
"no_copy": 0,
"options": "Step\nProcedure",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.procedure == \"Procedure\"",
"fieldname": "procedure_name",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Procedure",
"length": 0,
"no_copy": 0,
"options": "Quality Procedure",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.procedure == \"Step\"",
"fieldname": "step",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Step",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "responsible_individual",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Responsible Individual",
"length": 0,
"no_copy": 0,
"options": "Role",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-11-01 14:26:33.558345",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Procedure Table",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -1,9 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class QualityProcedureTable(Document):
pass

View File

@ -4,69 +4,25 @@
frappe.ui.form.on('Quality Review', { frappe.ui.form.on('Quality Review', {
onload: function(frm){ onload: function(frm){
frm.set_value("date", frappe.datetime.get_today()); frm.set_value("date", frappe.datetime.get_today());
$(".grid-add-row").hide();
if(frm.doc.measurable == "Yes"){
show_target_achieved_unit(frm);
}
else{
hide_target_achieved_unit(frm);
}
frm.refresh();
}, },
goal: function(frm) { goal: function(frm) {
frm.fields_dict.values.grid.remove_all(); frappe.call({
if (frm.doc.goal){ "method": "frappe.client.get",
frappe.call({ args: {
"method": "frappe.client.get", doctype: "Quality Goal",
args: { name: frm.doc.goal
doctype: "Quality Goal", },
name: frm.doc.goal callback: function(data){
}, frm.fields_dict.reviews.grid.remove_all();
callback: function (data) { let objectives = data.message.objectives;
for (var i = 0; i < data.message.objective.length; i++ ){ for (var i in objectives) {
frm.add_child("values"); frm.add_child("reviews");
frm.fields_dict.values.get_value()[i].objective = data.message.objective[i].objective; frm.fields_dict.reviews.get_value()[i].objective = objectives[i].objective;
if(frm.doc.measurable == "Yes"){ frm.fields_dict.reviews.get_value()[i].target = objectives[i].target;
if(i < 1){ frm.fields_dict.reviews.get_value()[i].uom = objectives[i].uom;
show_target_achieved_unit(frm);
}
frm.fields_dict.values.get_value()[i].target = data.message.objective[i].target;
frm.fields_dict.values.get_value()[i].achieved = 0;
frm.fields_dict.values.get_value()[i].unit = data.message.objective[i].unit;
}
if(frm.doc.measurable == "No"){
if(i < 1){
hide_target_achieved_unit(frm);
}
frm.fields_dict.values.get_value()[i].yes_no = "No";
}
}
frm.refresh();
} }
}); frm.refresh();
} }
else{ });
frm.doc.procedure = '';
frm.doc.scope = '';
frm.doc.action = '';
frm.doc.measurable = '';
frm.refresh();
}
}, },
}); });
function show_target_achieved_unit(frm){
// shows target, achieved and unit columns as the goal can be measured in numeric values
frm.fields_dict.values.grid.docfields[1].hidden = 0;
frm.fields_dict.values.grid.docfields[2].hidden = 0;
frm.fields_dict.values.grid.docfields[3].hidden = 0;
frm.fields_dict.values.grid.docfields[4].hidden = 1;
}
function hide_target_achieved_unit(frm){
// hides target and unit columns as the goal cannot be measured in numeric values
frm.fields_dict.values.grid.docfields[1].hidden = 1;
frm.fields_dict.values.grid.docfields[2].hidden = 1;
frm.fields_dict.values.grid.docfields[3].hidden = 1;
frm.fields_dict.values.grid.docfields[4].hidden = 0;
}

View File

@ -1,424 +1,110 @@
{ {
"allow_copy": 0, "autoname": "format:REV-{#####}",
"allow_events_in_timeline": 0, "creation": "2018-10-02 11:45:16.301955",
"allow_guest_to_view": 0, "doctype": "DocType",
"allow_import": 0, "editable_grid": 1,
"allow_rename": 0, "engine": "InnoDB",
"autoname": "QMS-REV-.#####", "field_order": [
"beta": 0, "goal",
"creation": "2018-10-02 11:45:16.301955", "date",
"custom": 0, "cb_00",
"docstatus": 0, "procedure",
"doctype": "DocType", "status",
"document_type": "", "sb_00",
"editable_grid": 1, "reviews",
"engine": "InnoDB", "sb_01",
"additional_information"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "fieldname": "date",
"allow_in_quick_entry": 0, "fieldtype": "Date",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Date",
"collapsible": 0, "read_only": 1
"columns": 0, },
"fetch_from": "",
"fieldname": "goal",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Quality Goal",
"length": 0,
"no_copy": 0,
"options": "Quality Goal",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fetch_from": "goal.procedure",
"allow_in_quick_entry": 0, "fieldname": "procedure",
"allow_on_submit": 0, "fieldtype": "Link",
"bold": 0, "label": "Procedure",
"collapsible": 0, "options": "Quality Procedure",
"columns": 0, "read_only": 1
"fieldname": "date", },
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Evaluation Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "additional_information",
"allow_in_quick_entry": 0, "fieldtype": "Text",
"allow_on_submit": 0, "label": "Additional Information"
"bold": 0, },
"collapsible": 0,
"columns": 0,
"fetch_from": "goal.measurable",
"fieldname": "measurable",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Measurable Goal",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "cb_00",
"allow_in_quick_entry": 0, "fieldtype": "Column Break"
"allow_on_submit": 0, },
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_4",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "sb_00",
"allow_in_quick_entry": 0, "fieldtype": "Section Break",
"allow_on_submit": 0, "label": "Review"
"bold": 0, },
"collapsible": 0,
"columns": 0,
"fetch_from": "goal.procedure",
"fieldname": "procedure",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Procedure",
"length": 0,
"no_copy": 0,
"options": "Quality Procedure",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "collapsible": 1,
"allow_in_quick_entry": 0, "fieldname": "sb_01",
"allow_on_submit": 0, "fieldtype": "Section Break",
"bold": 0, "label": "Additional Information"
"collapsible": 0, },
"columns": 0,
"fetch_from": "goal.scope",
"fieldname": "scope",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Scope",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "reviews",
"allow_in_quick_entry": 0, "fieldtype": "Table",
"allow_on_submit": 0, "label": "Reviews",
"bold": 0, "options": "Quality Review Objective"
"collapsible": 0, },
"columns": 0,
"depends_on": "eval:doc.scope == 'Department'",
"fetch_from": "goal.department",
"fieldname": "department",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Department",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "default": "Open",
"allow_in_quick_entry": 0, "fieldname": "status",
"allow_on_submit": 0, "fieldtype": "Select",
"bold": 0, "label": "Status",
"collapsible": 0, "options": "Open\nClosed"
"columns": 0, },
"fieldname": "values_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Values",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "goal",
"allow_in_quick_entry": 0, "fieldtype": "Link",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Goal",
"collapsible": 0, "options": "Quality Goal",
"columns": 0, "reqd": 1
"fieldname": "values",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Values",
"length": 0,
"no_copy": 0,
"options": "Quality Review Table",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"columns": 0,
"fieldname": "additional_info_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Additional Information",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "additional_information",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Additional Information",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "modified": "2019-05-26 23:12:47.302189",
"hide_heading": 0, "modified_by": "Administrator",
"hide_toolbar": 0, "module": "Quality Management",
"idx": 0, "name": "Quality Review",
"image_view": 0, "owner": "Administrator",
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-12 14:25:02.383387",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Review",
"name_case": "",
"owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "create": 1,
"cancel": 0, "delete": 1,
"create": 1, "email": 1,
"delete": 1, "export": 1,
"email": 1, "print": 1,
"export": 1, "read": 1,
"if_owner": 0, "report": 1,
"import": 0, "role": "System Manager",
"permlevel": 0, "share": 1,
"print": 1, "write": 1
"read": 1, },
"report": 1, {
"role": "System Manager", "create": 1,
"set_user_permissions": 0, "delete": 1,
"share": 1, "email": 1,
"submit": 0, "export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "All",
"share": 1,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0, "sort_field": "modified",
"read_only": 0, "sort_order": "DESC",
"read_only_onload": 0, "track_changes": 1
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
} }

View File

@ -5,63 +5,50 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
import datetime
class QualityReview(Document): class QualityReview(Document):
pass pass
def review(): def review():
now = datetime.datetime.now() day = frappe.utils.getdate().day
day = now.day weekday = frappe.utils.getdate().strftime("%A")
day_name = now.strftime("%A") month = frappe.utils.getdate().strftime("%B")
month=now.strftime("%B")
for data in frappe.get_all("Quality Goal",fields=['name', 'frequency', 'date', 'weekly', 'measurable']): for goal in frappe.get_list("Quality Goal", fields=['name', 'frequency', 'date', 'weekday']):
if data.frequency == 'Daily': if goal.frequency == 'Daily':
create_review(data.name, data.measurable) create_review(goal.name)
elif data.frequency == 'Weekly': elif goal.frequency == 'Weekly' and goal.weekday == weekday:
if data.weekly == day_name: create_review(goal.name)
create_review(data.name, data.measurable)
elif data.frequency == 'Monthly': elif goal.frequency == 'Monthly' and goal.date == str(day):
if data.date == str(day): create_review(goal.name)
create_review(data.name, data.measurable)
elif data.frequency == 'Quarterly': elif goal.frequency == 'Quarterly' and goal.data == str(day) and get_quarter(month):
if (month == 'January' or month == 'April' or month == 'July' or month == 'October') and str(day) == data.date: create_review(goal.name)
create_review(data.name, data.measurable)
elif data.frequency == 'Half Yearly': def create_review(goal):
if (month == 'January' or month == 'July') and str(day) == data.date: goal = frappe.get_doc("Quality Goal", goal)
create_review(data.name, data.measurable)
elif data.frequency == 'Yearly': review = frappe.get_doc({
if month == data.yearly and str(day) == data.date:
create_review(data.name, data.measurable)
else:
pass
def create_review(name, measurable):
objectives = frappe.get_all("Quality Objective", filters={'parent': name }, fields=['objective', 'target', 'unit'])
doc = frappe.get_doc({
"doctype": "Quality Review", "doctype": "Quality Review",
"goal": name, "goal": goal.name,
"date": frappe.as_unicode(frappe.utils.nowdate()), "date": frappe.utils.getdate()
"measurable": measurable,
}) })
if measurable == 'Yes':
for objective in objectives: for objective in goal.objectives:
doc.append("values",{ review.append("reviews",
'objective': objective.objective, {
'target': objective.target, "objective": objective.objective,
'achieved': 0, "target": objective.target,
'unit': objective.unit "uom": objective.uom
}) }
)
review.insert(ignore_permissions=True)
def get_quarter(month):
if month in ["January", "April", "July", "October"]:
return True
else: else:
for objective in objectives: return False
doc.append("values",{
'objective': objective.objective,
})
doc.insert()
frappe.db.commit()

View File

@ -1,16 +0,0 @@
from frappe import _
def get_data():
return {
'fieldname': 'review',
'transactions': [
{
'label': _('Action'),
'items': ['Quality Action']
},
{
'label': _('Meeting'),
'items': ['Quality Meeting']
}
],
}

View File

@ -17,31 +17,30 @@ class TestQualityReview(unittest.TestCase):
create_goal() create_goal()
test_create_review = create_review() test_create_review = create_review()
test_get_review = get_review() test_get_review = get_review()
self.assertEquals(test_create_review.name, test_get_review.name) self.assertEquals(test_create_review, test_get_review)
def create_review(): def create_review():
review = frappe.get_doc({ review = frappe.get_doc({
"doctype": "Quality Review", "doctype": "Quality Review",
"goal": "_Test Quality Goal", "goal": "GOAL-_Test Quality Goal",
"procedure": "_Test Quality Procedure", "procedure": "PRC-_Test Quality Procedure",
"scope": "Company", "date": frappe.utils.nowdate(),
"date": ""+ frappe.utils.nowdate() +"", "reviews": [
"values": [
{ {
"objective": "_Test Quality Objective", "objective": "_Test Quality Objective",
"target": "100", "target": "100",
"achieved": "100", "uom": "_Test UOM",
"unit": "_Test UOM" "review": "Test Review"
} }
] ]
}) })
review_exist = frappe.get_list("Quality Review", filters={"goal": "_Test Quality Goal"}, limit=1) review_exist = frappe.db.exists("Quality Review", {"goal": "GOAL-_Test Quality Goal"})
if len(review_exist) == 0: if not review_exist:
review.insert() review.insert(ignore_permissions=True)
return review return review.name
else: else:
return review_exist[0] return review_exist
def get_review(): def get_review():
review = frappe.get_list("Quality Review", filters={"goal": "_Test Quality Goal"}, limit=1) review = frappe.db.exists("Quality Review", {"goal": "GOAL-_Test Quality Goal"})
return review[0] return review

View File

@ -0,0 +1,64 @@
{
"creation": "2019-05-26 15:17:44.796958",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"objective",
"cb_00",
"target",
"uom",
"sb_00",
"review"
],
"fields": [
{
"fieldname": "objective",
"fieldtype": "Text",
"in_list_view": 1,
"label": "Objective",
"read_only": 1
},
{
"fieldname": "target",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Target",
"read_only": 1
},
{
"fetch_from": "target_unit",
"fieldname": "uom",
"fieldtype": "Link",
"in_list_view": 1,
"label": "UOM",
"options": "UOM",
"read_only": 1
},
{
"fieldname": "review",
"fieldtype": "Text Editor",
"in_list_view": 1,
"label": "Review"
},
{
"fieldname": "sb_00",
"fieldtype": "Section Break",
"label": "Review"
},
{
"fieldname": "cb_00",
"fieldtype": "Column Break"
}
],
"istable": 1,
"modified": "2019-05-26 16:14:12.586128",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Review Objective",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document from frappe.model.document import Document
class QualityMeetingTable(Document): class QualityReviewObjective(Document):
pass pass

View File

@ -1,207 +0,0 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-10-09 13:03:37.666929",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "objective",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "objective",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "target",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Target",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "achieved",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Achieved",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "target_unit",
"fieldname": "unit",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Unit",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "yes_no",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Yes/No",
"length": 0,
"no_copy": 0,
"options": "No\nYes",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-11-03 11:10:53.818818",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Review Table",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
}

View File

@ -1,9 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class QualityReviewTable(Document):
pass