[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:
@@ -161,7 +161,7 @@ class SellingController(StockController):
|
|||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
if d.qty is None:
|
if d.qty is None:
|
||||||
frappe.throw(_("Row {0}: Qty is mandatory").format(d.idx))
|
frappe.throw(_("Row {0}: Qty is mandatory").format(d.idx))
|
||||||
|
|
||||||
if self.has_product_bundle(d.item_code):
|
if self.has_product_bundle(d.item_code):
|
||||||
for p in self.get("packed_items"):
|
for p in self.get("packed_items"):
|
||||||
if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
|
if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
|
||||||
@@ -199,17 +199,17 @@ class SellingController(StockController):
|
|||||||
where so_detail = %s and docstatus = 1
|
where so_detail = %s and docstatus = 1
|
||||||
and against_sales_order = %s
|
and against_sales_order = %s
|
||||||
and parent != %s""", (so_detail, so, current_docname))
|
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
|
from `tabSales Invoice Item` si_item, `tabSales Invoice` si
|
||||||
where si_item.parent = si.name and si.update_stock = 1
|
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_item.sales_order = %s
|
||||||
and si.name != %s""", (so_detail, so, current_docname))
|
and si.name != %s""", (so_detail, so, current_docname))
|
||||||
|
|
||||||
total_delivered_qty = (flt(delivered_via_dn[0][0]) if delivered_via_dn else 0) \
|
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)
|
+ (flt(delivered_via_si[0][0]) if delivered_via_si else 0)
|
||||||
|
|
||||||
return total_delivered_qty
|
return total_delivered_qty
|
||||||
|
|
||||||
def get_so_qty_and_warehouse(self, so_detail):
|
def get_so_qty_and_warehouse(self, so_detail):
|
||||||
@@ -230,10 +230,10 @@ def check_active_sales_items(obj):
|
|||||||
for d in obj.get("items"):
|
for d in obj.get("items"):
|
||||||
if d.item_code:
|
if d.item_code:
|
||||||
item = frappe.db.sql("""select docstatus, is_sales_item,
|
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]
|
d.item_code, as_dict=True)[0]
|
||||||
if item.is_sales_item == 0 and item.is_service_item == 0:
|
if item.is_sales_item == 0:
|
||||||
frappe.throw(_("Item {0} must be Sales or Service Item in {1}").format(d.item_code, d.idx))
|
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:
|
if getattr(d, "income_account", None) and not item.income_account:
|
||||||
frappe.db.set_value("Item", d.item_code, "income_account",
|
frappe.db.set_value("Item", d.item_code, "income_account",
|
||||||
d.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() {
|
this.frm.set_query("item_code", "items", function() {
|
||||||
return {
|
return {
|
||||||
query: "erpnext.controllers.queries.item_query",
|
query: "erpnext.controllers.queries.item_query",
|
||||||
filters: me.frm.doc.enquiry_type === "Maintenance" ?
|
filters: {"is_sales_item": 1}
|
||||||
{"is_service_item": 1} : {"is_sales_item":1}
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import frappe
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
fields = ("is_stock_item", "is_asset_item", "has_batch_no", "has_serial_no",
|
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")
|
"is_pro_applicable", "is_sub_contracted_item")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,14 +28,9 @@ class Quotation(SellingController):
|
|||||||
def validate_order_type(self):
|
def validate_order_type(self):
|
||||||
super(Quotation, self).validate_order_type()
|
super(Quotation, self).validate_order_type()
|
||||||
|
|
||||||
if self.order_type in ['Maintenance', 'Service']:
|
for d in self.get('items'):
|
||||||
for d in self.get('items'):
|
if not frappe.db.get_value("Item", d.item_code, "is_sales_item"):
|
||||||
if not frappe.db.get_value("Item", d.item_code, "is_service_item"):
|
frappe.throw(_("Item {0} must be Sales Item").format(d.item_code))
|
||||||
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))
|
|
||||||
|
|
||||||
def validate_quotation_to(self):
|
def validate_quotation_to(self):
|
||||||
if self.customer:
|
if self.customer:
|
||||||
|
|||||||
@@ -56,9 +56,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
this.frm.set_query("item_code", "items", function() {
|
this.frm.set_query("item_code", "items", function() {
|
||||||
return {
|
return {
|
||||||
query: "erpnext.controllers.queries.item_query",
|
query: "erpnext.controllers.queries.item_query",
|
||||||
filters: (me.frm.doc.order_type === "Maintenance" ?
|
filters: {'is_sales_item': 1}
|
||||||
{'is_service_item': 1}:
|
|
||||||
{'is_sales_item': 1 })
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -289,7 +287,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
}
|
}
|
||||||
refresh_field('product_bundle_help');
|
refresh_field('product_bundle_help');
|
||||||
},
|
},
|
||||||
|
|
||||||
make_payment_request: function() {
|
make_payment_request: function() {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method:"erpnext.accounts.doctype.payment_request.payment_request.make_payment_request",
|
method:"erpnext.accounts.doctype.payment_request.payment_request.make_payment_request",
|
||||||
|
|||||||
@@ -1463,35 +1463,6 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 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,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@@ -2338,7 +2309,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 1,
|
"max_attachments": 1,
|
||||||
"modified": "2016-01-17 11:14:10.169713",
|
"modified": "2016-01-26 05:31:58.950718",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Item",
|
"name": "Item",
|
||||||
@@ -2358,7 +2329,6 @@
|
|||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"restrict": 0,
|
|
||||||
"role": "Material Master Manager",
|
"role": "Material Master Manager",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 1,
|
"share": 1,
|
||||||
@@ -2379,7 +2349,6 @@
|
|||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"restrict": 0,
|
|
||||||
"role": "Material Manager",
|
"role": "Material Manager",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 0,
|
"share": 0,
|
||||||
@@ -2400,7 +2369,6 @@
|
|||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"restrict": 0,
|
|
||||||
"role": "Material User",
|
"role": "Material User",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 0,
|
"share": 0,
|
||||||
@@ -2421,7 +2389,6 @@
|
|||||||
"print": 0,
|
"print": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 0,
|
"report": 0,
|
||||||
"restrict": 0,
|
|
||||||
"role": "Sales User",
|
"role": "Sales User",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 0,
|
"share": 0,
|
||||||
@@ -2442,7 +2409,6 @@
|
|||||||
"print": 0,
|
"print": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 0,
|
"report": 0,
|
||||||
"restrict": 0,
|
|
||||||
"role": "Purchase User",
|
"role": "Purchase User",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 0,
|
"share": 0,
|
||||||
@@ -2463,7 +2429,6 @@
|
|||||||
"print": 0,
|
"print": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 0,
|
"report": 0,
|
||||||
"restrict": 0,
|
|
||||||
"role": "Maintenance User",
|
"role": "Maintenance User",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 0,
|
"share": 0,
|
||||||
@@ -2484,7 +2449,6 @@
|
|||||||
"print": 0,
|
"print": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 0,
|
"report": 0,
|
||||||
"restrict": 0,
|
|
||||||
"role": "Accounts User",
|
"role": "Accounts User",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 0,
|
"share": 0,
|
||||||
@@ -2505,7 +2469,6 @@
|
|||||||
"print": 0,
|
"print": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 0,
|
"report": 0,
|
||||||
"restrict": 0,
|
|
||||||
"role": "Manufacturing User",
|
"role": "Manufacturing User",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 0,
|
"share": 0,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
"is_pro_applicable": 0,
|
"is_pro_applicable": 0,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Item",
|
"item_code": "_Test Item",
|
||||||
@@ -46,7 +45,6 @@
|
|||||||
"is_pro_applicable": 0,
|
"is_pro_applicable": 0,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Item 2",
|
"item_code": "_Test Item 2",
|
||||||
@@ -70,7 +68,6 @@
|
|||||||
"is_pro_applicable": 0,
|
"is_pro_applicable": 0,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Item Home Desktop 100",
|
"item_code": "_Test Item Home Desktop 100",
|
||||||
@@ -100,7 +97,6 @@
|
|||||||
"is_pro_applicable": 0,
|
"is_pro_applicable": 0,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Item Home Desktop 200",
|
"item_code": "_Test Item Home Desktop 200",
|
||||||
@@ -121,7 +117,6 @@
|
|||||||
"is_pro_applicable": 0,
|
"is_pro_applicable": 0,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 0,
|
"is_stock_item": 0,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Product Bundle Item",
|
"item_code": "_Test Product Bundle Item",
|
||||||
@@ -143,7 +138,6 @@
|
|||||||
"is_pro_applicable": 1,
|
"is_pro_applicable": 1,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 1,
|
"is_sub_contracted_item": 1,
|
||||||
"item_code": "_Test FG Item",
|
"item_code": "_Test FG Item",
|
||||||
@@ -161,7 +155,6 @@
|
|||||||
"is_pro_applicable": 0,
|
"is_pro_applicable": 0,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 0,
|
"is_stock_item": 0,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Non Stock Item",
|
"item_code": "_Test Non Stock Item",
|
||||||
@@ -180,7 +173,6 @@
|
|||||||
"is_pro_applicable": 0,
|
"is_pro_applicable": 0,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Serialized Item",
|
"item_code": "_Test Serialized Item",
|
||||||
@@ -199,7 +191,6 @@
|
|||||||
"is_pro_applicable": 0,
|
"is_pro_applicable": 0,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Serialized Item With Series",
|
"item_code": "_Test Serialized Item With Series",
|
||||||
@@ -221,7 +212,6 @@
|
|||||||
"is_asset_item": 0,
|
"is_asset_item": 0,
|
||||||
"is_pro_applicable": 1,
|
"is_pro_applicable": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 0,
|
"is_sub_contracted_item": 0,
|
||||||
"item_code": "_Test Item Home Desktop Manufactured",
|
"item_code": "_Test Item Home Desktop Manufactured",
|
||||||
@@ -243,7 +233,6 @@
|
|||||||
"is_pro_applicable": 1,
|
"is_pro_applicable": 1,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 1,
|
"is_sub_contracted_item": 1,
|
||||||
"item_code": "_Test FG Item 2",
|
"item_code": "_Test FG Item 2",
|
||||||
@@ -265,7 +254,6 @@
|
|||||||
"is_pro_applicable": 1,
|
"is_pro_applicable": 1,
|
||||||
"is_purchase_item": 1,
|
"is_purchase_item": 1,
|
||||||
"is_sales_item": 1,
|
"is_sales_item": 1,
|
||||||
"is_service_item": 0,
|
|
||||||
"is_stock_item": 1,
|
"is_stock_item": 1,
|
||||||
"is_sub_contracted_item": 1,
|
"is_sub_contracted_item": 1,
|
||||||
"item_code": "_Test Variant Item",
|
"item_code": "_Test Variant Item",
|
||||||
|
|||||||
@@ -111,11 +111,7 @@ def validate_item_details(args, item):
|
|||||||
|
|
||||||
if args.transaction_type=="selling":
|
if args.transaction_type=="selling":
|
||||||
# validate if sales item or service item
|
# validate if sales item or service item
|
||||||
if args.get("order_type") == "Maintenance":
|
if item.is_sales_item != 1:
|
||||||
if item.is_service_item != 1:
|
|
||||||
throw(_("Item {0} must be a Service Item.").format(item.name))
|
|
||||||
|
|
||||||
elif item.is_sales_item != 1:
|
|
||||||
throw(_("Item {0} must be a Sales Item").format(item.name))
|
throw(_("Item {0} must be a Sales Item").format(item.name))
|
||||||
|
|
||||||
if cint(item.has_variants):
|
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) {
|
cur_frm.fields_dict['items'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
|
||||||
return {
|
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) {
|
cur_frm.fields_dict['purposes'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
|
||||||
return{
|
return{
|
||||||
filters:{ 'is_service_item': 1}
|
filters:{ 'is_sales_item': 1}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user