Merge branch 'develop' into cost-of-poor-quality

This commit is contained in:
Marica
2021-11-25 13:29:40 +05:30
committed by GitHub
60 changed files with 631 additions and 968 deletions

View File

@@ -680,12 +680,6 @@ frappe.ui.form.on("BOM Item", "items_remove", function(frm) {
erpnext.bom.calculate_total(frm.doc);
});
frappe.ui.form.on("BOM", "with_operations", function(frm) {
if(!cint(frm.doc.with_operations)) {
frm.set_value("operations", []);
}
});
frappe.tour['BOM'] = [
{
fieldname: "item",

View File

@@ -237,6 +237,7 @@
"options": "Price List"
},
{
"depends_on": "with_operations",
"fieldname": "operations_section",
"fieldtype": "Section Break",
"hide_border": 1,
@@ -539,7 +540,7 @@
"image_field": "image",
"is_submittable": 1,
"links": [],
"modified": "2021-10-27 14:52:04.500251",
"modified": "2021-11-18 13:04:16.271975",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM",

View File

@@ -16,26 +16,15 @@
</div>
<hr style="margin: 15px -15px;">
<p>
{% if data.value %}
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="#Form/BOM/{{ data.value }}">
{% if data.value && data.value != "BOM" %}
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="/app/bom/{{ data.value }}">
{{ __("Open BOM {0}", [data.value.bold()]) }}</a>
{% endif %}
{% if data.item_code %}
<a class="btn btn-default btn-xs" href="#Form/Item/{{ data.item_code }}">
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="/app/item/{{ data.item_code }}">
{{ __("Open Item {0}", [data.item_code.bold()]) }}</a>
{% endif %}
</p>
</div>
</div>
<hr style="margin: 15px -15px;">
<p>
{% if data.value %}
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="/app/Form/BOM/{{ data.value }}">
{{ __("Open BOM {0}", [data.value.bold()]) }}</a>
{% endif %}
{% if data.item_code %}
<a class="btn btn-default btn-xs" href="/app/Form/Item/{{ data.item_code }}">
{{ __("Open Item {0}", [data.item_code.bold()]) }}</a>
{% endif %}
</p>
</div>

View File

@@ -66,6 +66,7 @@ frappe.treeview_settings["BOM"] = {
var bom = frappe.model.get_doc("BOM", node.data.value);
node.data.image = escape(bom.image) || "";
node.data.description = bom.description || "";
node.data.item_code = bom.item || "";
});
}
},

View File

@@ -23,18 +23,12 @@ frappe.ui.form.on('Job Card', {
);
},
onload: function(frm) {
if (frm.doc.scrap_items.length == 0) {
frm.fields_dict['scrap_items_section'].collapse();
}
},
refresh: function(frm) {
frappe.flags.pause_job = 0;
frappe.flags.resume_job = 0;
let has_items = frm.doc.items && frm.doc.items.length;
if (frm.doc.__onload.work_order_stopped) {
if (frm.doc.__onload.work_order_closed) {
frm.disable_save();
return;
}

View File

@@ -36,7 +36,7 @@ class JobCard(Document):
def onload(self):
excess_transfer = frappe.db.get_single_value("Manufacturing Settings", "job_card_excess_transfer")
self.set_onload("job_card_excess_transfer", excess_transfer)
self.set_onload("work_order_stopped", self.is_work_order_stopped())
self.set_onload("work_order_closed", self.is_work_order_closed())
def validate(self):
self.validate_time_logs()
@@ -549,10 +549,10 @@ class JobCard(Document):
.format(message, bold(row.operation), bold(self.operation)), OperationSequenceError)
def validate_work_order(self):
if self.is_work_order_stopped():
frappe.throw(_("You can't make any changes to Job Card since Work Order is stopped."))
if self.is_work_order_closed():
frappe.throw(_("You can't make any changes to Job Card since Work Order is closed."))
def is_work_order_stopped(self):
def is_work_order_closed(self):
if self.work_order:
status = frappe.get_value('Work Order', self.work_order)

View File

@@ -442,7 +442,7 @@ frappe.ui.form.on("Work Order", {
additional_operating_cost: function(frm) {
erpnext.work_order.calculate_cost(frm.doc);
erpnext.work_order.calculate_total_cost(frm);
}
},
});
frappe.ui.form.on("Work Order Item", {

View File

@@ -326,6 +326,7 @@
"label": "Expected Delivery Date"
},
{
"collapsible": 1,
"fieldname": "operations_section",
"fieldtype": "Section Break",
"label": "Operations",
@@ -337,7 +338,7 @@
"fieldname": "transfer_material_against",
"fieldtype": "Select",
"label": "Transfer Material Against",
"options": "\nWork Order\nJob Card"
"options": "Work Order\nJob Card"
},
{
"fieldname": "operations",
@@ -573,8 +574,7 @@
"image_field": "image",
"is_submittable": 1,
"links": [],
"migration_hash": "a18118963f4fcdb7f9d326de5f4063ba",
"modified": "2021-10-29 15:12:32.203605",
"modified": "2021-11-08 17:36:07.016300",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order",

View File

@@ -6,27 +6,27 @@
"field_order": [
"details",
"operation",
"bom",
"column_break_4",
"description",
"sequence_id",
"col_break1",
"completed_qty",
"status",
"completed_qty",
"column_break_4",
"bom",
"workstation",
"sequence_id",
"section_break_10",
"description",
"estimated_time_and_cost",
"planned_start_time",
"planned_end_time",
"column_break_10",
"time_in_mins",
"hour_rate",
"time_in_mins",
"column_break_10",
"planned_end_time",
"batch_size",
"planned_operating_cost",
"section_break_9",
"actual_start_time",
"actual_end_time",
"column_break_11",
"actual_operation_time",
"column_break_11",
"actual_end_time",
"actual_operating_cost"
],
"fields": [
@@ -42,7 +42,6 @@
"oldfieldname": "operation_no",
"oldfieldtype": "Data",
"options": "Operation",
"read_only": 1,
"reqd": 1
},
{
@@ -52,20 +51,14 @@
"label": "BOM",
"no_copy": 1,
"options": "BOM",
"print_hide": 1,
"read_only": 1
"print_hide": 1
},
{
"fieldname": "description",
"fieldtype": "Text Editor",
"label": "Operation Description",
"oldfieldname": "opn_description",
"oldfieldtype": "Text",
"read_only": 1
},
{
"fieldname": "col_break1",
"fieldtype": "Column Break"
"oldfieldtype": "Text"
},
{
"columns": 1,
@@ -74,19 +67,16 @@
"fieldtype": "Float",
"in_list_view": 1,
"label": "Completed Qty",
"no_copy": 1,
"read_only": 1
"no_copy": 1
},
{
"columns": 1,
"default": "Pending",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Status",
"no_copy": 1,
"options": "Pending\nWork in Progress\nCompleted",
"read_only": 1
"options": "Pending\nWork in Progress\nCompleted"
},
{
"fieldname": "workstation",
@@ -106,15 +96,13 @@
"fieldname": "planned_start_time",
"fieldtype": "Datetime",
"label": "Planned Start Time",
"no_copy": 1,
"read_only": 1
"no_copy": 1
},
{
"fieldname": "planned_end_time",
"fieldtype": "Datetime",
"label": "Planned End Time",
"no_copy": 1,
"read_only": 1
"no_copy": 1
},
{
"fieldname": "column_break_10",
@@ -122,7 +110,7 @@
},
{
"columns": 1,
"description": "in Minutes",
"description": "In Minutes",
"fieldname": "time_in_mins",
"fieldtype": "Float",
"in_list_view": 1,
@@ -152,6 +140,7 @@
"label": "Actual Time and Cost"
},
{
"description": "Updated via 'Time Log' (In Minutes)",
"fieldname": "actual_start_time",
"fieldtype": "Datetime",
"label": "Actual Start Time",
@@ -159,7 +148,7 @@
"read_only": 1
},
{
"description": "Updated via 'Time Log'",
"description": "Updated via 'Time Log' (In Minutes)",
"fieldname": "actual_end_time",
"fieldtype": "Datetime",
"label": "Actual End Time",
@@ -171,7 +160,7 @@
"fieldtype": "Column Break"
},
{
"description": "in Minutes\nUpdated via 'Time Log'",
"description": "Updated via 'Time Log' (In Minutes)",
"fieldname": "actual_operation_time",
"fieldtype": "Float",
"label": "Actual Operation Time",
@@ -190,25 +179,28 @@
{
"fieldname": "batch_size",
"fieldtype": "Int",
"label": "Batch Size",
"read_only": 1
"label": "Batch Size"
},
{
"fieldname": "sequence_id",
"fieldtype": "Int",
"hidden": 1,
"label": "Sequence ID",
"print_hide": 1,
"read_only": 1
"print_hide": 1
},
{
"fieldname": "column_break_4",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_10",
"fieldtype": "Section Break"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-06-24 14:36:12.835543",
"modified": "2021-11-24 04:52:54.295168",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order Operation",
@@ -217,4 +209,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
}

View File

@@ -51,7 +51,7 @@ frappe.query_reports["Work Order Summary"] = {
label: __("Status"),
fieldname: "status",
fieldtype: "Select",
options: ["", "Not Started", "In Process", "Completed", "Stopped"]
options: ["", "Not Started", "In Process", "Completed", "Stopped", "Closed"]
},
{
label: __("Sales Orders"),

View File

@@ -1,6 +1,7 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from collections import defaultdict
import frappe
from frappe import _
@@ -58,21 +59,16 @@ def get_chart_data(data, filters):
return get_chart_based_on_qty(data, filters)
def get_chart_based_on_status(data):
labels = ["Completed", "In Process", "Stopped", "Not Started"]
labels = frappe.get_meta("Work Order").get_options("status").split("\n")
if "" in labels:
labels.remove("")
status_wise_data = {
"Not Started": 0,
"In Process": 0,
"Stopped": 0,
"Completed": 0,
"Draft": 0
}
status_wise_data = defaultdict(int)
for d in data:
status_wise_data[d.status] += 1
values = [status_wise_data["Completed"], status_wise_data["In Process"],
status_wise_data["Stopped"], status_wise_data["Not Started"]]
values = [status_wise_data[label] for label in labels]
chart = {
"data": {