fix: company in quality inspection
(cherry picked from commit 397cd79e1e)
This commit is contained in:
committed by
Mergify
parent
9e353e218b
commit
c0cf1fed00
@@ -4,12 +4,26 @@
|
|||||||
cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
|
cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
|
||||||
|
|
||||||
frappe.ui.form.on("Quality Inspection", {
|
frappe.ui.form.on("Quality Inspection", {
|
||||||
|
onload(frm) {
|
||||||
|
frm.trigger("set_default_company");
|
||||||
|
},
|
||||||
|
|
||||||
|
set_default_company(frm) {
|
||||||
|
if (!frm.doc.company) {
|
||||||
|
frm.set_value("company", frappe.defaults.get_default("company"));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
setup: function (frm) {
|
setup: function (frm) {
|
||||||
frm.set_query("reference_name", function () {
|
frm.set_query("reference_name", function (doc) {
|
||||||
|
let filters = { docstatus: ["!=", 2] };
|
||||||
|
|
||||||
|
if (doc.company) {
|
||||||
|
filters["company"] = doc.company;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: filters,
|
||||||
docstatus: ["!=", 2],
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"naming_series",
|
"naming_series",
|
||||||
|
"company",
|
||||||
"report_date",
|
"report_date",
|
||||||
"status",
|
"status",
|
||||||
"manual_inspection",
|
"child_row_reference",
|
||||||
"column_break_4",
|
"column_break_4",
|
||||||
"inspection_type",
|
"inspection_type",
|
||||||
"reference_type",
|
"reference_type",
|
||||||
"reference_name",
|
"reference_name",
|
||||||
"child_row_reference",
|
|
||||||
"section_break_7",
|
"section_break_7",
|
||||||
"item_code",
|
"item_code",
|
||||||
"item_serial_no",
|
"item_serial_no",
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
"bom_no",
|
"bom_no",
|
||||||
"specification_details",
|
"specification_details",
|
||||||
"quality_inspection_template",
|
"quality_inspection_template",
|
||||||
|
"manual_inspection",
|
||||||
"readings",
|
"readings",
|
||||||
"section_break_14",
|
"section_break_14",
|
||||||
"inspected_by",
|
"inspected_by",
|
||||||
@@ -248,6 +249,12 @@
|
|||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "company",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Company",
|
||||||
|
"options": "Company"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-search",
|
"icon": "fa fa-search",
|
||||||
@@ -255,7 +262,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-12-30 19:08:16.611192",
|
"modified": "2025-01-16 17:00:48.774532",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Quality Inspection",
|
"name": "Quality Inspection",
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class QualityInspection(Document):
|
|||||||
batch_no: DF.Link | None
|
batch_no: DF.Link | None
|
||||||
bom_no: DF.Link | None
|
bom_no: DF.Link | None
|
||||||
child_row_reference: DF.Data | None
|
child_row_reference: DF.Data | None
|
||||||
|
company: DF.Link | None
|
||||||
description: DF.SmallText | None
|
description: DF.SmallText | None
|
||||||
inspected_by: DF.Link
|
inspected_by: DF.Link
|
||||||
inspection_type: DF.Literal["", "Incoming", "Outgoing", "In Process"]
|
inspection_type: DF.Literal["", "Incoming", "Outgoing", "In Process"]
|
||||||
@@ -76,6 +77,13 @@ class QualityInspection(Document):
|
|||||||
|
|
||||||
self.validate_inspection_required()
|
self.validate_inspection_required()
|
||||||
self.set_child_row_reference()
|
self.set_child_row_reference()
|
||||||
|
self.set_company()
|
||||||
|
|
||||||
|
def set_company(self):
|
||||||
|
if self.reference_type and self.reference_name:
|
||||||
|
company = frappe.get_cached_value(self.reference_type, self.reference_name, "company")
|
||||||
|
if company != self.company:
|
||||||
|
self.company = company
|
||||||
|
|
||||||
def set_child_row_reference(self):
|
def set_child_row_reference(self):
|
||||||
if self.child_row_reference:
|
if self.child_row_reference:
|
||||||
|
|||||||
Reference in New Issue
Block a user