[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.
This commit is contained in:
@@ -230,10 +230,10 @@ def check_active_sales_items(obj):
|
||||
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)
|
||||
|
||||
@@ -52,8 +52,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
||||
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}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import frappe
|
||||
|
||||
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")
|
||||
|
||||
|
||||
|
||||
@@ -28,11 +28,6 @@ class Quotation(SellingController):
|
||||
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))
|
||||
|
||||
@@ -56,9 +56,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
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}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1463,35 +1463,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"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,
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -111,11 +111,7 @@ def validate_item_details(args, item):
|
||||
|
||||
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):
|
||||
|
||||
@@ -107,7 +107,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
|
||||
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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
|
||||
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}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user