[cleanup] quality inspection fixes #3061

This commit is contained in:
Rushabh Mehta
2015-04-14 17:53:36 +05:30
parent 5e7f8fd156
commit 3ee1f11771
4 changed files with 137 additions and 101 deletions

View File

@@ -4,21 +4,6 @@
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
{
"fieldname": "qa_inspection",
"fieldtype": "Section Break",
"label": "QA Inspection",
"no_copy": 0,
"oldfieldtype": "Section Break",
"permlevel": 0
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"width": "50%"
},
{ {
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
@@ -29,18 +14,7 @@
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "inspection_type", "default": "Today",
"fieldtype": "Select",
"in_filter": 1,
"in_list_view": 1,
"label": "Inspection Type",
"oldfieldname": "inspection_type",
"oldfieldtype": "Select",
"options": "\nIncoming\nOutgoing\nIn Process",
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "report_date", "fieldname": "report_date",
"fieldtype": "Date", "fieldtype": "Date",
"in_filter": 1, "in_filter": 1,
@@ -53,67 +27,22 @@
"search_index": 1 "search_index": 1
}, },
{ {
"fieldname": "item_code", "fieldname": "column_break_4",
"fieldtype": "Link", "fieldtype": "Column Break",
"hidden": 0, "permlevel": 0,
"precision": ""
},
{
"fieldname": "inspection_type",
"fieldtype": "Select",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Item Code", "label": "Inspection Type",
"oldfieldname": "item_code", "oldfieldname": "inspection_type",
"oldfieldtype": "Link", "oldfieldtype": "Select",
"options": "Item", "options": "\nIncoming\nOutgoing\nIn Process",
"permlevel": 0, "permlevel": 0,
"reqd": 1, "reqd": 1
"search_index": 1
},
{
"fieldname": "sample_size",
"fieldtype": "Float",
"in_filter": 0,
"label": "Sample Size",
"oldfieldname": "sample_size",
"oldfieldtype": "Currency",
"permlevel": 0,
"reqd": 1,
"search_index": 0
},
{
"fieldname": "description",
"fieldtype": "Small Text",
"in_filter": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"permlevel": 0,
"search_index": 0,
"width": "300px"
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"width": "50%"
},
{
"fieldname": "item_serial_no",
"fieldtype": "Link",
"hidden": 0,
"label": "Item Serial No",
"oldfieldname": "item_serial_no",
"oldfieldtype": "Link",
"options": "Serial No",
"permlevel": 0,
"print_hide": 0
},
{
"fieldname": "batch_no",
"fieldtype": "Link",
"label": "Batch No",
"oldfieldname": "batch_no",
"oldfieldtype": "Link",
"options": "Batch",
"permlevel": 0
}, },
{ {
"fieldname": "purchase_receipt_no", "fieldname": "purchase_receipt_no",
@@ -141,14 +70,105 @@
"search_index": 1 "search_index": 1
}, },
{ {
"fieldname": "section_break_7",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
"options": "Item",
"permlevel": 0,
"reqd": 1,
"search_index": 1
},
{
"fieldname": "item_serial_no",
"fieldtype": "Link",
"hidden": 0,
"label": "Item Serial No",
"oldfieldname": "item_serial_no",
"oldfieldtype": "Link",
"options": "Serial No",
"permlevel": 0,
"print_hide": 0
},
{
"fieldname": "batch_no",
"fieldtype": "Link",
"label": "Batch No",
"oldfieldname": "batch_no",
"oldfieldtype": "Link",
"options": "Batch",
"permlevel": 0
},
{
"fieldname": "sample_size",
"fieldtype": "Float",
"in_filter": 0,
"label": "Sample Size",
"oldfieldname": "sample_size",
"oldfieldtype": "Currency",
"permlevel": 0,
"reqd": 1,
"search_index": 0
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"width": "50%"
},
{
"fieldname": "description",
"fieldtype": "Small Text",
"in_filter": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"permlevel": 0,
"search_index": 0,
"width": "300px"
},
{
"fieldname": "section_break_14",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
{
"default": "user",
"fieldname": "inspected_by", "fieldname": "inspected_by",
"fieldtype": "Data", "fieldtype": "Link",
"label": "Inspected By", "label": "Inspected By",
"oldfieldname": "inspected_by", "oldfieldname": "inspected_by",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "User",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{
"fieldname": "verified_by",
"fieldtype": "Data",
"label": "Verified By",
"oldfieldname": "verified_by",
"oldfieldtype": "Data",
"permlevel": 0
},
{
"fieldname": "column_break_17",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{ {
"fieldname": "remarks", "fieldname": "remarks",
"fieldtype": "Text", "fieldtype": "Text",
@@ -158,14 +178,6 @@
"oldfieldtype": "Text", "oldfieldtype": "Text",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "verified_by",
"fieldtype": "Data",
"label": "Verified By",
"oldfieldname": "verified_by",
"oldfieldtype": "Data",
"permlevel": 0
},
{ {
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "fieldtype": "Link",
@@ -207,7 +219,7 @@
"icon": "icon-search", "icon": "icon-search",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-02-20 05:09:09.998457", "modified": "2015-04-14 07:37:07.331291",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Quality Inspection", "name": "Quality Inspection",

View File

@@ -4,6 +4,27 @@
{% include 'buying/doctype/purchase_common/purchase_common.js' %}; {% include 'buying/doctype/purchase_common/purchase_common.js' %};
frappe.provide("erpnext.stock"); frappe.provide("erpnext.stock");
frappe.ui.form.on("Purchase Receipt", {
onload: function(frm) {
// default values for quotation no
var qa_no = frappe.meta.get_docfield("Purchase Receipt Item", "qa_no");
qa_no.get_route_options_for_new_doc = function(field) {
if(frm.is_new()) return;
var doc = field.doc;
return {
"inspection_type": "Incoming",
"purchase_receipt_no": frm.doc.name,
"item_code": doc.item_code,
"description": doc.description,
"item_serial_no": doc.serial_no ? doc.serial_no.split("\n")[0] : null,
"batch_no": doc.batch_no
}
}
}
});
erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
refresh: function() { refresh: function() {
this._super(); this._super();
@@ -91,6 +112,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
}); });
// for backward compatibility: combine new and previous states // for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm})); $.extend(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm}));

View File

@@ -199,6 +199,8 @@ class PurchaseReceipt(BuyingController):
ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No' ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No'
if ins_reqd == 'Yes' and not d.qa_no: if ins_reqd == 'Yes' and not d.qa_no:
frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code)) frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code))
if self.docstatus==1:
raise frappe.ValidationError
# Check for Stopped status # Check for Stopped status
def check_for_stopped_status(self, pc_obj): def check_for_stopped_status(self, pc_obj):