[cleanup] Removed 'Is Service Item' checkbox and filters
'Is Service Item' checkbox only worked for filtering Items in Maintenance Schedule and Maintenance Visit, and validating that Items in a Maintenance type Order were of type 'Service'. However, it doesn't fit an actual use case where any Sales Item could be given for Maintenance, making the checkbox an unnecessary addition.
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 895f146..f340f91 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -161,7 +161,7 @@
for d in self.get("items"):
if d.qty is None:
frappe.throw(_("Row {0}: Qty is mandatory").format(d.idx))
-
+
if self.has_product_bundle(d.item_code):
for p in self.get("packed_items"):
if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
@@ -199,17 +199,17 @@
where so_detail = %s and docstatus = 1
and against_sales_order = %s
and parent != %s""", (so_detail, so, current_docname))
-
- delivered_via_si = frappe.db.sql("""select sum(si_item.qty)
+
+ delivered_via_si = frappe.db.sql("""select sum(si_item.qty)
from `tabSales Invoice Item` si_item, `tabSales Invoice` si
where si_item.parent = si.name and si.update_stock = 1
- and si_item.so_detail = %s and si.docstatus = 1
+ and si_item.so_detail = %s and si.docstatus = 1
and si_item.sales_order = %s
and si.name != %s""", (so_detail, so, current_docname))
-
+
total_delivered_qty = (flt(delivered_via_dn[0][0]) if delivered_via_dn else 0) \
+ (flt(delivered_via_si[0][0]) if delivered_via_si else 0)
-
+
return total_delivered_qty
def get_so_qty_and_warehouse(self, so_detail):
@@ -230,10 +230,10 @@
for d in obj.get("items"):
if d.item_code:
item = frappe.db.sql("""select docstatus, is_sales_item,
- is_service_item, income_account from tabItem where name = %s""",
+ income_account from tabItem where name = %s""",
d.item_code, as_dict=True)[0]
- if item.is_sales_item == 0 and item.is_service_item == 0:
- frappe.throw(_("Item {0} must be Sales or Service Item in {1}").format(d.item_code, d.idx))
+ if item.is_sales_item == 0:
+ frappe.throw(_("Item {0} must be a Sales Item in {1}").format(d.item_code, d.idx))
if getattr(d, "income_account", None) and not item.income_account:
frappe.db.set_value("Item", d.item_code, "income_account",
d.income_account)
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index af4e387..b274216 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -52,8 +52,7 @@
this.frm.set_query("item_code", "items", function() {
return {
query: "erpnext.controllers.queries.item_query",
- filters: me.frm.doc.enquiry_type === "Maintenance" ?
- {"is_service_item": 1} : {"is_sales_item":1}
+ filters: {"is_sales_item": 1}
};
});
diff --git a/erpnext/patches/v5_2/change_item_selects_to_checks.py b/erpnext/patches/v5_2/change_item_selects_to_checks.py
index 25d596b..2665f4c 100644
--- a/erpnext/patches/v5_2/change_item_selects_to_checks.py
+++ b/erpnext/patches/v5_2/change_item_selects_to_checks.py
@@ -4,7 +4,7 @@
def execute():
fields = ("is_stock_item", "is_asset_item", "has_batch_no", "has_serial_no",
- "is_purchase_item", "is_sales_item", "is_service_item", "inspection_required",
+ "is_purchase_item", "is_sales_item", "inspection_required",
"is_pro_applicable", "is_sub_contracted_item")
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 43dd675..3c8add4 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -28,14 +28,9 @@
def validate_order_type(self):
super(Quotation, self).validate_order_type()
- if self.order_type in ['Maintenance', 'Service']:
- for d in self.get('items'):
- if not frappe.db.get_value("Item", d.item_code, "is_service_item"):
- frappe.throw(_("Item {0} must be Service Item").format(d.item_code))
- else:
- for d in self.get('items'):
- if not frappe.db.get_value("Item", d.item_code, "is_sales_item"):
- frappe.throw(_("Item {0} must be Sales Item").format(d.item_code))
+ for d in self.get('items'):
+ if not frappe.db.get_value("Item", d.item_code, "is_sales_item"):
+ frappe.throw(_("Item {0} must be Sales Item").format(d.item_code))
def validate_quotation_to(self):
if self.customer:
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 7f17bd3..850e229 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -56,9 +56,7 @@
this.frm.set_query("item_code", "items", function() {
return {
query: "erpnext.controllers.queries.item_query",
- filters: (me.frm.doc.order_type === "Maintenance" ?
- {'is_service_item': 1}:
- {'is_sales_item': 1 })
+ filters: {'is_sales_item': 1}
}
});
}
@@ -289,7 +287,7 @@
}
refresh_field('product_bundle_help');
},
-
+
make_payment_request: function() {
frappe.call({
method:"erpnext.accounts.doctype.payment_request.payment_request.make_payment_request",
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index b7d866d..79789b0 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -1467,35 +1467,6 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "default": "",
- "depends_on": "eval:doc.is_sales_item",
- "description": "Allow in Sales Order of type \"Service\"",
- "fieldname": "is_service_item",
- "fieldtype": "Check",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "in_filter": 1,
- "in_list_view": 0,
- "label": "Is Service Item",
- "length": 0,
- "no_copy": 0,
- "oldfieldname": "is_service_item",
- "oldfieldtype": "Select",
- "options": "",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
"default": "0",
"description": "Publish Item to hub.erpnext.com",
"fieldname": "publish_in_hub",
@@ -2338,7 +2309,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
- "modified": "2016-01-17 11:14:10.169713",
+ "modified": "2016-01-26 05:31:58.950718",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
@@ -2358,7 +2329,6 @@
"print": 1,
"read": 1,
"report": 1,
- "restrict": 0,
"role": "Material Master Manager",
"set_user_permissions": 0,
"share": 1,
@@ -2379,7 +2349,6 @@
"print": 1,
"read": 1,
"report": 1,
- "restrict": 0,
"role": "Material Manager",
"set_user_permissions": 0,
"share": 0,
@@ -2400,7 +2369,6 @@
"print": 1,
"read": 1,
"report": 1,
- "restrict": 0,
"role": "Material User",
"set_user_permissions": 0,
"share": 0,
@@ -2421,7 +2389,6 @@
"print": 0,
"read": 1,
"report": 0,
- "restrict": 0,
"role": "Sales User",
"set_user_permissions": 0,
"share": 0,
@@ -2442,7 +2409,6 @@
"print": 0,
"read": 1,
"report": 0,
- "restrict": 0,
"role": "Purchase User",
"set_user_permissions": 0,
"share": 0,
@@ -2463,7 +2429,6 @@
"print": 0,
"read": 1,
"report": 0,
- "restrict": 0,
"role": "Maintenance User",
"set_user_permissions": 0,
"share": 0,
@@ -2484,7 +2449,6 @@
"print": 0,
"read": 1,
"report": 0,
- "restrict": 0,
"role": "Accounts User",
"set_user_permissions": 0,
"share": 0,
@@ -2505,7 +2469,6 @@
"print": 0,
"read": 1,
"report": 0,
- "restrict": 0,
"role": "Manufacturing User",
"set_user_permissions": 0,
"share": 0,
diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json
index f12c7cc..ca40d45 100644
--- a/erpnext/stock/doctype/item/test_records.json
+++ b/erpnext/stock/doctype/item/test_records.json
@@ -13,7 +13,6 @@
"is_pro_applicable": 0,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 0,
"item_code": "_Test Item",
@@ -46,7 +45,6 @@
"is_pro_applicable": 0,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 0,
"item_code": "_Test Item 2",
@@ -70,7 +68,6 @@
"is_pro_applicable": 0,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 0,
"item_code": "_Test Item Home Desktop 100",
@@ -100,7 +97,6 @@
"is_pro_applicable": 0,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 0,
"item_code": "_Test Item Home Desktop 200",
@@ -121,7 +117,6 @@
"is_pro_applicable": 0,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 0,
"is_sub_contracted_item": 0,
"item_code": "_Test Product Bundle Item",
@@ -143,7 +138,6 @@
"is_pro_applicable": 1,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 1,
"item_code": "_Test FG Item",
@@ -161,7 +155,6 @@
"is_pro_applicable": 0,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 0,
"is_sub_contracted_item": 0,
"item_code": "_Test Non Stock Item",
@@ -180,7 +173,6 @@
"is_pro_applicable": 0,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 0,
"item_code": "_Test Serialized Item",
@@ -199,7 +191,6 @@
"is_pro_applicable": 0,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 0,
"item_code": "_Test Serialized Item With Series",
@@ -221,7 +212,6 @@
"is_asset_item": 0,
"is_pro_applicable": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 0,
"item_code": "_Test Item Home Desktop Manufactured",
@@ -243,7 +233,6 @@
"is_pro_applicable": 1,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 1,
"item_code": "_Test FG Item 2",
@@ -265,7 +254,6 @@
"is_pro_applicable": 1,
"is_purchase_item": 1,
"is_sales_item": 1,
- "is_service_item": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 1,
"item_code": "_Test Variant Item",
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 1c0acce..5548350 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -111,11 +111,7 @@
if args.transaction_type=="selling":
# validate if sales item or service item
- if args.get("order_type") == "Maintenance":
- if item.is_service_item != 1:
- throw(_("Item {0} must be a Service Item.").format(item.name))
-
- elif item.is_sales_item != 1:
+ if item.is_sales_item != 1:
throw(_("Item {0} must be a Sales Item").format(item.name))
if cint(item.has_variants):
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
index 91b1f67..650429c 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
@@ -107,7 +107,7 @@
cur_frm.fields_dict['items'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
return {
- filters:{ 'is_service_item': 1 }
+ filters:{ 'is_sales_item': 1 }
}
}
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
index 52141a8..51ba62a 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
@@ -81,7 +81,7 @@
cur_frm.fields_dict['purposes'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
return{
- filters:{ 'is_service_item': 1}
+ filters:{ 'is_sales_item': 1}
}
}