From 72534deea2adf49f40b36b17a37c087dfeee5ee4 Mon Sep 17 00:00:00 2001 From: Umair Sayyed Date: Fri, 15 Apr 2016 12:52:12 +0530 Subject: [PATCH] removed Is Sales Item and Is Purchase Item --- .../purchase_invoice/purchase_invoice.js | 5 +- .../purchase_invoice/purchase_invoice.py | 7 - erpnext/accounts/doctype/sales_invoice/pos.py | 5 - .../purchase_common/purchase_common.js | 3 +- .../purchase_common/purchase_common.py | 7 +- erpnext/controllers/buying_controller.py | 13 -- erpnext/controllers/selling_controller.py | 5 +- .../crm/doctype/opportunity/opportunity.js | 3 +- .../doctype/hub_settings/hub_settings.py | 2 +- erpnext/manufacturing/doctype/bom/bom.py | 7 +- .../v5_2/change_item_selects_to_checks.py | 3 +- erpnext/patches/v6_21/fix_reorder_level.py | 2 +- .../selling/doctype/quotation/quotation.py | 4 - .../doctype/sales_order/test_sales_order.py | 21 ++- erpnext/selling/sales_common.js | 3 +- erpnext/setup/setup_wizard/sample_data.py | 29 ++-- erpnext/setup/setup_wizard/setup_wizard.py | 4 +- erpnext/stock/doctype/item/item.json | 124 +++--------------- erpnext/stock/doctype/item/item.py | 11 +- erpnext/stock/doctype/item/test_records.json | 24 ---- erpnext/stock/get_item_details.py | 15 +-- erpnext/stock/reorder_item.py | 1 - .../items_to_be_requested.json | 30 ++--- .../maintenance_schedule.js | 7 - .../maintenance_visit/maintenance_visit.js | 6 - 25 files changed, 75 insertions(+), 266 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index bcb0503c99..32ad6d2820 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -166,10 +166,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 { - query: "erpnext.controllers.queries.item_query", - filters:{ - 'is_purchase_item': 1 - } + query: "erpnext.controllers.queries.item_query" } } diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 2699f44f9d..427e04098d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -45,7 +45,6 @@ class PurchaseInvoice(BuyingController): self.validate_supplier_invoice() self.validate_advance_jv("Purchase Order") - self.check_active_purchase_items() self.check_conversion_rate() self.validate_credit_to_acc() self.clear_unallocated_advances("Purchase Invoice Advance", "advances") @@ -80,12 +79,6 @@ class PurchaseInvoice(BuyingController): super(PurchaseInvoice, self).get_advances(self.credit_to, "Supplier", self.supplier, "Purchase Invoice Advance", "advances", "debit_in_account_currency", "purchase_order") - def check_active_purchase_items(self): - for d in self.get('items'): - if d.item_code: # extra condn coz item_code is not mandatory in PV - if frappe.db.get_value("Item", d.item_code, "is_purchase_item") != 1: - msgprint(_("Item {0} is not Purchase Item").format(d.item_code), raise_exception=True) - def check_conversion_rate(self): default_currency = get_company_currency(self.company) if not default_currency: diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 18faae7b2f..62a9f526e6 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -10,11 +10,6 @@ def get_items(price_list, sales_or_purchase, item=None): order_by = "" args = {"price_list": price_list} - if sales_or_purchase == "Sales": - condition = "i.is_sales_item=1" - else: - condition = "i.is_purchase_item=1" - if item: # search serial no item_code = frappe.db.sql("""select name as serial_no, item_code diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index c67a30fb69..2f1959b803 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -48,8 +48,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } } else { return{ - query: "erpnext.controllers.queries.item_query", - filters: { 'is_purchase_item': 1 } + query: "erpnext.controllers.queries.item_query" } } }); diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index be704e9fba..1c3fe1e577 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -57,7 +57,7 @@ class PurchaseCommon(BuyingController): if d.meta.get_field(x): d.set(x, f_lst[x]) - item = frappe.db.sql("""select is_stock_item, is_purchase_item, + item = frappe.db.sql("""select is_stock_item, is_sub_contracted_item, end_of_life, disabled from `tabItem` where name=%s""", d.item_code, as_dict=1)[0] @@ -68,11 +68,6 @@ class PurchaseCommon(BuyingController): if item.is_stock_item==1 and d.qty and not d.warehouse: frappe.throw(_("Warehouse is mandatory for stock Item {0} in row {1}").format(d.item_code, d.idx)) - # validate purchase item - if obj.doctype=="Material Request" and getattr(obj, "material_request_type", None)=="Purchase": - if item.is_purchase_item != 1 and item.is_sub_contracted_item != 1: - frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx)) - items.append(cstr(d.item_code)) if items and len(items) != len(set(items)) and \ diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 536112662d..6a1b205057 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -251,19 +251,6 @@ class BuyingController(StockController): return self._sub_contracted_items - @property - def purchase_items(self): - if not hasattr(self, "_purchase_items"): - self._purchase_items = [] - item_codes = list(set(item.item_code for item in - self.get("items"))) - if item_codes: - self._purchase_items = [r[0] for r in frappe.db.sql("""select name - from `tabItem` where name in (%s) and is_purchase_item='Yes'""" % \ - (", ".join((["%s"]*len(item_codes))),), item_codes)] - - return self._purchase_items - def is_item_table_empty(self): if not len(self.get("items")): frappe.throw(_("Item table can not be blank")) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index d12486d304..3c9efa10d7 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -232,11 +232,10 @@ class SellingController(StockController): 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, + item = frappe.db.sql("""select docstatus, income_account from tabItem where name = %s""", d.item_code, as_dict=True)[0] - 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 a918cf3257..884e9f4737 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -49,8 +49,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: {"is_sales_item": 1} + query: "erpnext.controllers.queries.item_query" }; }); diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.py b/erpnext/hub_node/doctype/hub_settings/hub_settings.py index 85226503e6..35f1f67114 100644 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py +++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.py @@ -24,7 +24,7 @@ class HubSettings(Document): def publish_selling_items(self): """Set `publish_in_hub`=1 for all Sales Items""" for item in frappe.get_all("Item", fields=["name"], - filters={"is_sales_item": 1, "publish_in_hub": "0"}): + filters={ "publish_in_hub": "0"}): frappe.db.set_value("Item", item.name, "publish_in_hub", 1) def register(self): diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 94990fea00..8779c49ffa 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -15,8 +15,7 @@ form_grid_templates = { class BOM(Document): def autoname(self): - names = frappe.db.sql("""select name from `tabBOM` - where item=%s""", self.item) + names = frappe.db.sql("""select name from `tabBOM` where item=%s""", self.item) if names: # name can be BOM/ITEM/001, BOM/ITEM/001-1, BOM-ITEM-001, BOM-ITEM-001-1 @@ -65,7 +64,7 @@ class BOM(Document): self.manage_default_bom() def get_item_det(self, item_code): - item = frappe.db.sql("""select name, item_name, is_fixed_asset, is_purchase_item, + item = frappe.db.sql("""select name, item_name, is_fixed_asset, docstatus, description, image, is_sub_contracted_item, stock_uom, default_bom, last_purchase_rate from `tabItem` where name=%s""", item_code, as_dict = 1) @@ -119,7 +118,7 @@ class BOM(Document): rate = 0 if arg['bom_no']: rate = self.get_bom_unitcost(arg['bom_no']) - elif arg and (arg['is_purchase_item'] == 1 or arg['is_sub_contracted_item'] == 1): + elif arg: if self.rm_cost_as_per == 'Valuation Rate': rate = self.get_valuation_rate(arg) elif self.rm_cost_as_per == 'Last Purchase Rate': 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 2665f4c227..9871b6a6d7 100644 --- a/erpnext/patches/v5_2/change_item_selects_to_checks.py +++ b/erpnext/patches/v5_2/change_item_selects_to_checks.py @@ -4,8 +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", "inspection_required", - "is_pro_applicable", "is_sub_contracted_item") + "inspection_required", "is_pro_applicable", "is_sub_contracted_item") # convert to 1 or 0 diff --git a/erpnext/patches/v6_21/fix_reorder_level.py b/erpnext/patches/v6_21/fix_reorder_level.py index 602978b161..82a35ebab1 100644 --- a/erpnext/patches/v6_21/fix_reorder_level.py +++ b/erpnext/patches/v6_21/fix_reorder_level.py @@ -15,7 +15,7 @@ def execute(): "warehouse": item.default_warehouse, "warehouse_reorder_level": item.re_order_level, "warehouse_reorder_qty": item.re_order_qty, - "material_request_type": "Purchase" if item_doc.is_purchase_item else "Transfer" + "material_request_type": "Purchase" }) try: diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 3c8add44f7..9cc7473a0d 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -28,10 +28,6 @@ class Quotation(SellingController): def validate_order_type(self): super(Quotation, self).validate_order_type() - 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: self.quotation_to = "Customer" diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index 4ba6ff063d..9d74e2a00c 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -238,9 +238,9 @@ class TestSalesOrder(unittest.TestCase): from erpnext.stock.doctype.item.test_item import make_item from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle - make_item("_Test Service Product Bundle", {"is_stock_item": 0, "is_pro_applicable": 0, "is_sales_item": 1}) - make_item("_Test Service Product Bundle Item 1", {"is_stock_item": 0, "is_pro_applicable": 0, "is_sales_item": 1}) - make_item("_Test Service Product Bundle Item 2", {"is_stock_item": 0, "is_pro_applicable": 0, "is_sales_item": 1}) + make_item("_Test Service Product Bundle", {"is_stock_item": 0, "is_pro_applicable": 0}) + make_item("_Test Service Product Bundle Item 1", {"is_stock_item": 0, "is_pro_applicable": 0}) + make_item("_Test Service Product Bundle Item 2", {"is_stock_item": 0, "is_pro_applicable": 0}) make_product_bundle("_Test Service Product Bundle", ["_Test Service Product Bundle Item 1", "_Test Service Product Bundle Item 2"]) @@ -254,9 +254,9 @@ class TestSalesOrder(unittest.TestCase): from erpnext.stock.doctype.item.test_item import make_item from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle - make_item("_Test Mix Product Bundle", {"is_stock_item": 0, "is_pro_applicable": 0, "is_sales_item": 1}) - make_item("_Test Mix Product Bundle Item 1", {"is_stock_item": 1, "is_sales_item": 1}) - make_item("_Test Mix Product Bundle Item 2", {"is_stock_item": 0, "is_pro_applicable": 0, "is_sales_item": 1}) + make_item("_Test Mix Product Bundle", {"is_stock_item": 0, "is_pro_applicable": 0}) + make_item("_Test Mix Product Bundle Item 1", {"is_stock_item": 1}) + make_item("_Test Mix Product Bundle Item 2", {"is_stock_item": 0, "is_pro_applicable": 0}) make_product_bundle("_Test Mix Product Bundle", ["_Test Mix Product Bundle Item 1", "_Test Mix Product Bundle Item 2"]) @@ -265,7 +265,7 @@ class TestSalesOrder(unittest.TestCase): def test_auto_insert_price(self): from erpnext.stock.doctype.item.test_item import make_item - make_item("_Test Item for Auto Price List", {"is_stock_item": 0, "is_pro_applicable": 0, "is_sales_item": 1}) + make_item("_Test Item for Auto Price List", {"is_stock_item": 0, "is_pro_applicable": 0}) frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 1) item_price = frappe.db.get_value("Item Price", {"price_list": "_Test Price List", @@ -299,14 +299,13 @@ class TestSalesOrder(unittest.TestCase): from erpnext.stock.doctype.item.test_item import make_item from erpnext.buying.doctype.purchase_order.purchase_order import update_status - po_item = make_item("_Test Item for Drop Shipping", {"is_stock_item": 1, "is_sales_item": 1, - "is_purchase_item": 1, "delivered_by_supplier": 1, 'default_supplier': '_Test Supplier', + po_item = make_item("_Test Item for Drop Shipping", {"is_stock_item": 1, "delivered_by_supplier": 1, + 'default_supplier': '_Test Supplier', "expense_account": "_Test Account Cost for Goods Sold - _TC", "cost_center": "_Test Cost Center - _TC" }) - dn_item = make_item("_Test Regular Item", {"is_stock_item": 1, "is_sales_item": 1, - "is_purchase_item": 1, "expense_account": "_Test Account Cost for Goods Sold - _TC", + dn_item = make_item("_Test Regular Item", {"is_stock_item": 1, "expense_account": "_Test Account Cost for Goods Sold - _TC", "cost_center": "_Test Cost Center - _TC"}) so_items = [ diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index bfefb9fa5b..607aa4124d 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -55,8 +55,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ if(this.frm.fields_dict["items"].grid.get_field('item_code')) { this.frm.set_query("item_code", "items", function() { return { - query: "erpnext.controllers.queries.item_query", - filters: {'is_sales_item': 1} + query: "erpnext.controllers.queries.item_query" } }); } diff --git a/erpnext/setup/setup_wizard/sample_data.py b/erpnext/setup/setup_wizard/sample_data.py index 63fc2e7a14..8078ebca3a 100644 --- a/erpnext/setup/setup_wizard/sample_data.py +++ b/erpnext/setup/setup_wizard/sample_data.py @@ -11,26 +11,25 @@ import random def make_sample_data(): """Create a few opportunities, quotes, material requests, issues, todos, projects to help the user get started""" + items = frappe.get_all("Item") - selling_items = frappe.get_all("Item", filters = {"is_sales_item": 1}) - buying_items = frappe.get_all("Item", filters = {"is_purchase_item": 1}) customers = frappe.get_all("Customer") warehouses = frappe.get_all("Warehouse") - if selling_items and customers: + if items and customers: for i in range(3): customer = random.choice(customers).name - make_opportunity(selling_items, customer) - make_quote(selling_items, customer) + make_opportunity(items, customer) + make_quote(items, customer) make_projects() - if buying_items and warehouses: - make_material_request(buying_items) + if items and warehouses: + make_material_request(items) frappe.db.commit() -def make_opportunity(selling_items, customer): +def make_opportunity(items, customer): b = frappe.get_doc({ "doctype": "Opportunity", "enquiry_from": "Customer", @@ -39,16 +38,16 @@ def make_opportunity(selling_items, customer): "with_items": 1 }) - add_random_children(b, "items", rows=len(selling_items), randomize = { + add_random_children(b, "items", rows=len(items), randomize = { "qty": (1, 5), - "item_code": ("Item", {"is_sales_item": 1}) + "item_code": ["Item"] }, unique="item_code") b.insert(ignore_permissions=True) b.add_comment('Comment', text="This is a dummy record") -def make_quote(selling_items, customer): +def make_quote(items, customer): qtn = frappe.get_doc({ "doctype": "Quotation", "quotation_to": "Customer", @@ -56,17 +55,17 @@ def make_quote(selling_items, customer): "order_type": "Sales" }) - add_random_children(qtn, "items", rows=len(selling_items), randomize = { + add_random_children(qtn, "items", rows=len(items), randomize = { "qty": (1, 5), - "item_code": ("Item", {"is_sales_item": 1}) + "item_code": ["Item"] }, unique="item_code") qtn.insert(ignore_permissions=True) qtn.add_comment('Comment', text="This is a dummy record") -def make_material_request(buying_items): - for i in buying_items: +def make_material_request(items): + for i in items: mr = frappe.get_doc({ "doctype": "Material Request", "material_request_type": "Purchase", diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py index 98a601902b..780fa976e0 100644 --- a/erpnext/setup/setup_wizard/setup_wizard.py +++ b/erpnext/setup/setup_wizard/setup_wizard.py @@ -46,7 +46,7 @@ def setup_complete(args=None): try: make_sample_data() frappe.clear_cache() - except FiscalYearError: + except: # clear message if frappe.message_log: frappe.message_log.pop() @@ -291,8 +291,6 @@ def create_items(args): "item_code": item, "item_name": item, "description": item, - "is_sales_item": 1 if is_sales_item else 0, - "is_purchase_item": 1 if is_purchase_item else 0, "show_in_website": 1, "is_stock_item": is_stock_item and 1 or 0, "is_pro_applicable": is_pro_applicable and 1 or 0, diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 43fccf614a..b9b556937f 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -926,35 +926,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "default": "1", - "description": "", - "fieldname": "is_purchase_item", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Is Purchase Item", - "length": 0, - "no_copy": 0, - "oldfieldname": "is_purchase_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, @@ -988,7 +959,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_purchase_item", + "depends_on": "", "description": "Average time taken by the supplier to deliver", "fieldname": "lead_time_days", "fieldtype": "Int", @@ -1016,7 +987,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_purchase_item", + "depends_on": "", "description": "", "fieldname": "buying_cost_center", "fieldtype": "Link", @@ -1045,7 +1016,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_purchase_item", + "depends_on": "", "description": "", "fieldname": "expense_account", "fieldtype": "Link", @@ -1074,7 +1045,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_purchase_item", + "depends_on": "", "fieldname": "unit_of_measure_conversion", "fieldtype": "Column Break", "hidden": 0, @@ -1100,7 +1071,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_purchase_item", + "depends_on": "", "description": "Will also apply for variants", "fieldname": "uoms", "fieldtype": "Table", @@ -1129,7 +1100,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_purchase_item", + "depends_on": "", "fieldname": "last_purchase_rate", "fieldtype": "Float", "hidden": 0, @@ -1156,7 +1127,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 1, - "depends_on": "is_purchase_item", + "depends_on": "", "fieldname": "supplier_details", "fieldtype": "Section Break", "hidden": 0, @@ -1182,7 +1153,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_purchase_item", + "depends_on": "", "fieldname": "default_supplier", "fieldtype": "Link", "hidden": 0, @@ -1233,7 +1204,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_purchase_item", + "depends_on": "", "fieldname": "manufacturer", "fieldtype": "Link", "hidden": 0, @@ -1259,7 +1230,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_purchase_item", + "depends_on": "", "fieldname": "manufacturer_part_no", "fieldtype": "Data", "hidden": 0, @@ -1284,7 +1255,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_purchase_item", + "depends_on": "", "fieldname": "column_break2", "fieldtype": "Column Break", "hidden": 0, @@ -1311,7 +1282,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_purchase_item", + "depends_on": "", "fieldname": "supplier_items", "fieldtype": "Table", "hidden": 0, @@ -1359,65 +1330,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "default": "1", - "description": "", - "fieldname": "is_sales_item", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_list_view": 0, - "label": "Is Sales Item", - "length": 0, - "no_copy": 0, - "oldfieldname": "is_sales_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": "", - "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, - "ignore_xss_filter": 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, @@ -1475,7 +1387,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_sales_item", + "depends_on": "", "fieldname": "income_account", "fieldtype": "Link", "hidden": 0, @@ -1501,7 +1413,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_sales_item", + "depends_on": "", "fieldname": "selling_cost_center", "fieldtype": "Link", "hidden": 0, @@ -1527,7 +1439,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_sales_item", + "depends_on": "", "fieldname": "column_break3", "fieldtype": "Column Break", "hidden": 0, @@ -1554,7 +1466,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "is_sales_item", + "depends_on": "", "description": "", "fieldname": "customer_items", "fieldtype": "Table", @@ -1581,7 +1493,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_sales_item", + "depends_on": "", "fieldname": "max_discount", "fieldtype": "Float", "hidden": 0, @@ -2323,7 +2235,7 @@ "issingle": 0, "istable": 0, "max_attachments": 1, - "modified": "2016-04-14 07:51:07.058298", + "modified": "2016-04-15 11:18:48.948958", "modified_by": "Administrator", "module": "Stock", "name": "Item", diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index d43f68db3a..2f92dd9d3e 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -50,12 +50,11 @@ class Item(WebsiteGenerator): self.name = self.item_code def before_insert(self): - if self.is_sales_item=="Yes": - self.publish_in_hub = 1 - if not self.description: self.description = self.item_name + self.publish_in_hub = 1 + def validate(self): super(Item, self).validate() @@ -71,7 +70,6 @@ class Item(WebsiteGenerator): self.check_item_tax() self.validate_barcode() self.cant_change() - self.validate_reorder_level() self.validate_warehouse_for_reorder() self.update_item_desc() self.synced_with_hub = 0 @@ -417,11 +415,6 @@ class Item(WebsiteGenerator): filters={"production_item": self.name, "docstatus": 1}): return True - def validate_reorder_level(self): - if len(self.get("reorder_levels", {"material_request_type": "Purchase"})): - if not (self.is_purchase_item or self.is_pro_applicable): - frappe.throw(_("""To set reorder level, item must be a Purchase Item or Manufacturing Item""")) - for d in self.get("reorder_levels"): if d.warehouse_reorder_level and not d.warehouse_reorder_qty: frappe.throw(_("Row #{0}: Please set reorder quantity").format(d.idx)) diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json index 91a7493b65..03b6198494 100644 --- a/erpnext/stock/doctype/item/test_records.json +++ b/erpnext/stock/doctype/item/test_records.json @@ -11,8 +11,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 0, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 1, "is_sub_contracted_item": 0, "item_code": "_Test Item", @@ -43,8 +41,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 0, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 1, "is_sub_contracted_item": 0, "item_code": "_Test Item 2", @@ -66,8 +62,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 0, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 1, "is_sub_contracted_item": 0, "item_code": "_Test Item Home Desktop 100", @@ -95,9 +89,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 0, - "is_purchase_item": 1, - "is_sales_item": 1, - "is_stock_item": 1, "is_sub_contracted_item": 0, "item_code": "_Test Item Home Desktop 200", "item_group": "_Test Item Group Desktops", @@ -115,8 +106,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 0, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 0, "is_sub_contracted_item": 0, "item_code": "_Test Product Bundle Item", @@ -136,8 +125,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 1, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 1, "is_sub_contracted_item": 1, "item_code": "_Test FG Item", @@ -153,8 +140,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 0, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 0, "is_sub_contracted_item": 0, "item_code": "_Test Non Stock Item", @@ -171,8 +156,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 0, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 1, "is_sub_contracted_item": 0, "item_code": "_Test Serialized Item", @@ -189,8 +172,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 0, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 1, "is_sub_contracted_item": 0, "item_code": "_Test Serialized Item With Series", @@ -211,7 +192,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 1, - "is_sales_item": 1, "is_stock_item": 1, "is_sub_contracted_item": 0, "item_code": "_Test Item Home Desktop Manufactured", @@ -231,8 +211,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 1, - "is_purchase_item": 1, - "is_sales_item": 1, "is_stock_item": 1, "is_sub_contracted_item": 1, "item_code": "_Test FG Item 2", @@ -252,8 +230,6 @@ "inspection_required": 0, "is_fixed_asset": 0, "is_pro_applicable": 1, - "is_purchase_item": 1, - "is_sales_item": 1, "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 9032c7fb83..d8c4382283 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -125,19 +125,10 @@ def validate_item_details(args, item): from erpnext.stock.doctype.item.item import validate_end_of_life validate_end_of_life(item.name, item.end_of_life, item.disabled) - if args.transaction_type=="selling": - # validate if sales item or service item - if item.is_sales_item != 1: - throw(_("Item {0} must be a Sales Item").format(item.name)) - - if cint(item.has_variants): - throw(_("Item {0} is a template, please select one of its variants").format(item.name)) - + if args.transaction_type=="selling" and cint(item.has_variants): + throw(_("Item {0} is a template, please select one of its variants").format(item.name)) + elif args.transaction_type=="buying" and args.doctype != "Material Request": - # validate if purchase item or subcontracted item - if item.is_purchase_item != 1: - throw(_("Item {0} must be a Purchase Item").format(item.name)) - if args.get("is_subcontracted") == "Yes" and item.is_sub_contracted_item != 1: throw(_("Item {0} must be a Sub-contracted Item").format(item.name)) diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index c637a12781..c87e3364c5 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -23,7 +23,6 @@ def _reorder_item(): items_to_consider = frappe.db.sql_list("""select name from `tabItem` item where is_stock_item=1 and has_variants=0 - and (is_purchase_item=1 or is_sub_contracted_item=1) and disabled=0 and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s) and (exists (select name from `tabItem Reorder` ir where ir.parent=item.name) diff --git a/erpnext/stock/report/items_to_be_requested/items_to_be_requested.json b/erpnext/stock/report/items_to_be_requested/items_to_be_requested.json index 92072a894b..d2f42d4d16 100644 --- a/erpnext/stock/report/items_to_be_requested/items_to_be_requested.json +++ b/erpnext/stock/report/items_to_be_requested/items_to_be_requested.json @@ -1,19 +1,17 @@ { - "add_total_row": 0, - "apply_user_permissions": 1, - "creation": "2013-08-20 15:08:10", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 1, - "is_standard": "Yes", - "modified": "2016-04-01 08:27:14.436178", - "modified_by": "Administrator", - "module": "Stock", - "name": "Items To Be Requested", - "owner": "Administrator", - "query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabItem.is_purchase_item = 1\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC", - "ref_doctype": "Item", - "report_name": "Items To Be Requested", + "apply_user_permissions": 1, + "creation": "2013-08-20 15:08:10", + "docstatus": 0, + "doctype": "Report", + "idx": 1, + "is_standard": "Yes", + "modified": "2014-06-03 07:18:17.128919", + "modified_by": "Administrator", + "module": "Stock", + "name": "Items To Be Requested", + "owner": "Administrator", + "query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC", + "ref_doctype": "Item", + "report_name": "Items To Be Requested", "report_type": "Query Report" } \ No newline at end of file diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js index 650429c8d9..ab660466e6 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js @@ -104,13 +104,6 @@ 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_sales_item': 1 } - } -} - cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) { if (!doc.__islocal) { return $c('runserverobj', args={'method':'generate_schedule', 'docs':doc}, diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js index 65a84c0903..b37c47b2eb 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js @@ -79,12 +79,6 @@ 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_sales_item': 1} - } -} - cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { return {query: "erpnext.controllers.queries.customer_query" } } \ No newline at end of file