From 5460691c8f08d728a99f05acacde0154d9fe7300 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 24 Apr 2020 23:55:33 +0530 Subject: [PATCH 1/2] fix: make target warehouse field mandatory while saving the work order --- .../doctype/production_plan/production_plan.py | 1 + erpnext/manufacturing/doctype/work_order/work_order.js | 3 +-- erpnext/manufacturing/doctype/work_order/work_order.json | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 358a5429d9..c3f27cd3de 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -346,6 +346,7 @@ class ProductionPlan(Document): if not wo.fg_warehouse: wo.fg_warehouse = warehouse.get('fg_warehouse') try: + wo.flags.ignore_mandatory = True wo.insert() return wo.name except OverProductionError: diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index d541866f8b..43145170f7 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -313,7 +313,7 @@ frappe.ui.form.on("Work Order", { "Work in Progress": "progress-bar-warning", "Completed": "progress-bar-success" }; - + let bars = []; let message = ''; let title = ''; @@ -404,7 +404,6 @@ frappe.ui.form.on("Work Order", { }, before_submit: function(frm) { - frm.toggle_reqd(["fg_warehouse", "wip_warehouse"], true); frm.fields_dict.required_items.grid.toggle_reqd("source_warehouse", true); frm.toggle_reqd("transfer_material_against", frm.doc.operations && frm.doc.operations.length > 0); diff --git a/erpnext/manufacturing/doctype/work_order/work_order.json b/erpnext/manufacturing/doctype/work_order/work_order.json index e6990fd985..00a67a03d6 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.json +++ b/erpnext/manufacturing/doctype/work_order/work_order.json @@ -231,6 +231,7 @@ "fieldname": "wip_warehouse", "fieldtype": "Link", "label": "Work-in-Progress Warehouse", + "mandatory_depends_on": "eval:!doc.skip_transfer || doc.from_wip_warehouse", "options": "Warehouse" }, { @@ -238,7 +239,8 @@ "fieldname": "fg_warehouse", "fieldtype": "Link", "label": "Target Warehouse", - "options": "Warehouse" + "options": "Warehouse", + "reqd": 1 }, { "fieldname": "column_break_12", @@ -481,7 +483,7 @@ "image_field": "image", "is_submittable": 1, "links": [], - "modified": "2020-01-31 12:46:23.636033", + "modified": "2020-04-24 19:32:43.323054", "modified_by": "Administrator", "module": "Manufacturing", "name": "Work Order", From 7b91617303852ab7339a9a110da8a01275804415 Mon Sep 17 00:00:00 2001 From: Diksha Jadhav Date: Sat, 25 Apr 2020 00:02:32 +0530 Subject: [PATCH 2/2] feat(accounting): show actual qty for warehouse in sales invoice --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 6f78db2ccc..a6113cd2bb 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -32,6 +32,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte me.frm.script_manager.trigger("is_pos"); me.frm.refresh_fields(); } + erpnext.queries.setup_warehouse_query(this.frm); }, refresh: function(doc, dt, dn) {