removed Is Sales Item and Is Purchase Item
This commit is contained in:
		
							parent
							
								
									c65726bf07
								
							
						
					
					
						commit
						72534deea2
					
				| @ -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) { | cur_frm.fields_dict['items'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { | ||||||
| 	return { | 	return { | ||||||
| 		query: "erpnext.controllers.queries.item_query", | 		query: "erpnext.controllers.queries.item_query" | ||||||
| 		filters:{ |  | ||||||
| 			'is_purchase_item': 1 |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -45,7 +45,6 @@ class PurchaseInvoice(BuyingController): | |||||||
| 			self.validate_supplier_invoice() | 			self.validate_supplier_invoice() | ||||||
| 			self.validate_advance_jv("Purchase Order") | 			self.validate_advance_jv("Purchase Order") | ||||||
| 
 | 
 | ||||||
| 		self.check_active_purchase_items() |  | ||||||
| 		self.check_conversion_rate() | 		self.check_conversion_rate() | ||||||
| 		self.validate_credit_to_acc() | 		self.validate_credit_to_acc() | ||||||
| 		self.clear_unallocated_advances("Purchase Invoice Advance", "advances") | 		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, | 			super(PurchaseInvoice, self).get_advances(self.credit_to, "Supplier", self.supplier, | ||||||
| 				"Purchase Invoice Advance", "advances", "debit_in_account_currency", "purchase_order") | 				"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): | 	def check_conversion_rate(self): | ||||||
| 		default_currency = get_company_currency(self.company) | 		default_currency = get_company_currency(self.company) | ||||||
| 		if not default_currency: | 		if not default_currency: | ||||||
|  | |||||||
| @ -10,11 +10,6 @@ def get_items(price_list, sales_or_purchase, item=None): | |||||||
| 	order_by = "" | 	order_by = "" | ||||||
| 	args = {"price_list": price_list} | 	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: | 	if item: | ||||||
| 		# search serial no | 		# search serial no | ||||||
| 		item_code = frappe.db.sql("""select name as serial_no, item_code | 		item_code = frappe.db.sql("""select name as serial_no, item_code | ||||||
|  | |||||||
| @ -48,8 +48,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ | |||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				return{ | 				return{ | ||||||
| 					query: "erpnext.controllers.queries.item_query", | 					query: "erpnext.controllers.queries.item_query" | ||||||
| 					filters: { 'is_purchase_item': 1 } |  | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
|  | |||||||
| @ -57,7 +57,7 @@ class PurchaseCommon(BuyingController): | |||||||
| 				if d.meta.get_field(x): | 				if d.meta.get_field(x): | ||||||
| 					d.set(x, f_lst[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""", | 				is_sub_contracted_item, end_of_life, disabled from `tabItem` where name=%s""", | ||||||
| 				d.item_code, as_dict=1)[0] | 				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: | 			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)) | 				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)) | 			items.append(cstr(d.item_code)) | ||||||
| 
 | 
 | ||||||
| 		if items and len(items) != len(set(items)) and \ | 		if items and len(items) != len(set(items)) and \ | ||||||
|  | |||||||
| @ -251,19 +251,6 @@ class BuyingController(StockController): | |||||||
| 
 | 
 | ||||||
| 		return self._sub_contracted_items | 		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): | 	def is_item_table_empty(self): | ||||||
| 		if not len(self.get("items")): | 		if not len(self.get("items")): | ||||||
| 			frappe.throw(_("Item table can not be blank")) | 			frappe.throw(_("Item table can not be blank")) | ||||||
|  | |||||||
| @ -232,11 +232,10 @@ class SellingController(StockController): | |||||||
| def check_active_sales_items(obj): | 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, | ||||||
| 				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: |                  | ||||||
| 				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) | ||||||
|  | |||||||
| @ -49,8 +49,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: {"is_sales_item": 1} |  | ||||||
| 			}; | 			}; | ||||||
| 		}); | 		}); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ class HubSettings(Document): | |||||||
| 	def publish_selling_items(self): | 	def publish_selling_items(self): | ||||||
| 		"""Set `publish_in_hub`=1 for all Sales Items""" | 		"""Set `publish_in_hub`=1 for all Sales Items""" | ||||||
| 		for item in frappe.get_all("Item", fields=["name"], | 		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) | 			frappe.db.set_value("Item", item.name, "publish_in_hub", 1) | ||||||
| 
 | 
 | ||||||
| 	def register(self): | 	def register(self): | ||||||
|  | |||||||
| @ -15,8 +15,7 @@ form_grid_templates = { | |||||||
| 
 | 
 | ||||||
| class BOM(Document): | class BOM(Document): | ||||||
| 	def autoname(self): | 	def autoname(self): | ||||||
| 		names = frappe.db.sql("""select name from `tabBOM` | 		names = frappe.db.sql("""select name from `tabBOM` where item=%s""", self.item) | ||||||
| 			where item=%s""", self.item) |  | ||||||
| 
 | 
 | ||||||
| 		if names: | 		if names: | ||||||
| 			# name can be BOM/ITEM/001, BOM/ITEM/001-1, BOM-ITEM-001, BOM-ITEM-001-1 | 			# 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() | 		self.manage_default_bom() | ||||||
| 
 | 
 | ||||||
| 	def get_item_det(self, item_code): | 	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, | 			docstatus, description, image, is_sub_contracted_item, stock_uom, default_bom, | ||||||
| 			last_purchase_rate | 			last_purchase_rate | ||||||
| 			from `tabItem` where name=%s""", item_code, as_dict = 1) | 			from `tabItem` where name=%s""", item_code, as_dict = 1) | ||||||
| @ -119,7 +118,7 @@ class BOM(Document): | |||||||
| 		rate = 0 | 		rate = 0 | ||||||
| 		if arg['bom_no']: | 		if arg['bom_no']: | ||||||
| 			rate = self.get_bom_unitcost(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': | 			if self.rm_cost_as_per == 'Valuation Rate': | ||||||
| 				rate = self.get_valuation_rate(arg) | 				rate = self.get_valuation_rate(arg) | ||||||
| 			elif self.rm_cost_as_per == 'Last Purchase Rate': | 			elif self.rm_cost_as_per == 'Last Purchase Rate': | ||||||
|  | |||||||
| @ -4,8 +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", "inspection_required", | 		"inspection_required", "is_pro_applicable", "is_sub_contracted_item") | ||||||
| 		"is_pro_applicable", "is_sub_contracted_item") |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	# convert to 1 or 0 | 	# convert to 1 or 0 | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ def execute(): | |||||||
| 				"warehouse": item.default_warehouse, | 				"warehouse": item.default_warehouse, | ||||||
| 				"warehouse_reorder_level": item.re_order_level, | 				"warehouse_reorder_level": item.re_order_level, | ||||||
| 				"warehouse_reorder_qty": item.re_order_qty, | 				"warehouse_reorder_qty": item.re_order_qty, | ||||||
| 				"material_request_type": "Purchase" if item_doc.is_purchase_item else "Transfer" | 				"material_request_type": "Purchase" | ||||||
| 			}) | 			}) | ||||||
| 
 | 
 | ||||||
| 			try: | 			try: | ||||||
|  | |||||||
| @ -28,10 +28,6 @@ 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() | ||||||
| 
 | 
 | ||||||
| 		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: | ||||||
| 			self.quotation_to = "Customer" | 			self.quotation_to = "Customer" | ||||||
|  | |||||||
| @ -238,9 +238,9 @@ class TestSalesOrder(unittest.TestCase): | |||||||
| 		from erpnext.stock.doctype.item.test_item import make_item | 		from erpnext.stock.doctype.item.test_item import make_item | ||||||
| 		from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle | 		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", {"is_stock_item": 0, "is_pro_applicable": 0}) | ||||||
| 		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 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, "is_sales_item": 1}) | 		make_item("_Test Service Product Bundle Item 2", {"is_stock_item": 0, "is_pro_applicable": 0}) | ||||||
| 
 | 
 | ||||||
| 		make_product_bundle("_Test Service Product Bundle", | 		make_product_bundle("_Test Service Product Bundle", | ||||||
| 			["_Test Service Product Bundle Item 1", "_Test Service Product Bundle Item 2"]) | 			["_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.stock.doctype.item.test_item import make_item | ||||||
| 		from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle | 		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", {"is_stock_item": 0, "is_pro_applicable": 0}) | ||||||
| 		make_item("_Test Mix Product Bundle Item 1", {"is_stock_item": 1, "is_sales_item": 1}) | 		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, "is_sales_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", | 		make_product_bundle("_Test Mix Product Bundle", | ||||||
| 			["_Test Mix Product Bundle Item 1", "_Test Mix Product Bundle Item 2"]) | 			["_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): | 	def test_auto_insert_price(self): | ||||||
| 		from erpnext.stock.doctype.item.test_item import make_item | 		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) | 		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", | 		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.stock.doctype.item.test_item import make_item | ||||||
| 		from erpnext.buying.doctype.purchase_order.purchase_order import update_status | 		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, | 		po_item = make_item("_Test Item for Drop Shipping", {"is_stock_item": 1, "delivered_by_supplier": 1,  | ||||||
| 			"is_purchase_item": 1, "delivered_by_supplier": 1, 'default_supplier': '_Test Supplier', |         'default_supplier': '_Test Supplier', | ||||||
| 		    "expense_account": "_Test Account Cost for Goods Sold - _TC", | 		    "expense_account": "_Test Account Cost for Goods Sold - _TC", | ||||||
| 		    "cost_center": "_Test Cost Center - _TC" | 		    "cost_center": "_Test Cost Center - _TC" | ||||||
| 			}) | 			}) | ||||||
| 
 | 
 | ||||||
| 		dn_item = make_item("_Test Regular Item", {"is_stock_item": 1, "is_sales_item": 1, | 		dn_item = make_item("_Test Regular Item", {"is_stock_item": 1, "expense_account": "_Test Account Cost for Goods Sold - _TC", | ||||||
| 			"is_purchase_item": 1, "expense_account": "_Test Account Cost for Goods Sold - _TC", |  | ||||||
|   		  	"cost_center": "_Test Cost Center - _TC"}) |   		  	"cost_center": "_Test Cost Center - _TC"}) | ||||||
| 
 | 
 | ||||||
| 		so_items = [ | 		so_items = [ | ||||||
|  | |||||||
| @ -55,8 +55,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ | |||||||
| 		if(this.frm.fields_dict["items"].grid.get_field('item_code')) { | 		if(this.frm.fields_dict["items"].grid.get_field('item_code')) { | ||||||
| 			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: {'is_sales_item': 1} |  | ||||||
| 				} | 				} | ||||||
| 			}); | 			}); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -11,26 +11,25 @@ import random | |||||||
| def make_sample_data(): | def make_sample_data(): | ||||||
| 	"""Create a few opportunities, quotes, material requests, issues, todos, projects | 	"""Create a few opportunities, quotes, material requests, issues, todos, projects | ||||||
| 	to help the user get started""" | 	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") | 	customers = frappe.get_all("Customer") | ||||||
| 	warehouses = frappe.get_all("Warehouse") | 	warehouses = frappe.get_all("Warehouse") | ||||||
| 
 | 
 | ||||||
| 	if selling_items and customers: | 	if items and customers: | ||||||
| 		for i in range(3): | 		for i in range(3): | ||||||
| 			customer = random.choice(customers).name | 			customer = random.choice(customers).name | ||||||
| 			make_opportunity(selling_items, customer) | 			make_opportunity(items, customer) | ||||||
| 			make_quote(selling_items, customer) | 			make_quote(items, customer) | ||||||
| 
 | 
 | ||||||
| 	make_projects() | 	make_projects() | ||||||
| 
 | 
 | ||||||
| 	if buying_items and warehouses: | 	if items and warehouses: | ||||||
| 		make_material_request(buying_items) | 		make_material_request(items) | ||||||
| 
 | 
 | ||||||
| 	frappe.db.commit() | 	frappe.db.commit() | ||||||
| 
 | 
 | ||||||
| def make_opportunity(selling_items, customer): | def make_opportunity(items, customer): | ||||||
| 	b = frappe.get_doc({ | 	b = frappe.get_doc({ | ||||||
| 		"doctype": "Opportunity", | 		"doctype": "Opportunity", | ||||||
| 		"enquiry_from": "Customer", | 		"enquiry_from": "Customer", | ||||||
| @ -39,16 +38,16 @@ def make_opportunity(selling_items, customer): | |||||||
| 		"with_items": 1 | 		"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), | 		"qty": (1, 5), | ||||||
| 		"item_code": ("Item", {"is_sales_item": 1}) | 		"item_code": ["Item"] | ||||||
| 	}, unique="item_code") | 	}, unique="item_code") | ||||||
| 
 | 
 | ||||||
| 	b.insert(ignore_permissions=True) | 	b.insert(ignore_permissions=True) | ||||||
| 
 | 
 | ||||||
| 	b.add_comment('Comment', text="This is a dummy record") | 	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({ | 	qtn = frappe.get_doc({ | ||||||
| 		"doctype": "Quotation", | 		"doctype": "Quotation", | ||||||
| 		"quotation_to": "Customer", | 		"quotation_to": "Customer", | ||||||
| @ -56,17 +55,17 @@ def make_quote(selling_items, customer): | |||||||
| 		"order_type": "Sales" | 		"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), | 		"qty": (1, 5), | ||||||
| 		"item_code": ("Item", {"is_sales_item": 1}) | 		"item_code": ["Item"] | ||||||
| 	}, unique="item_code") | 	}, unique="item_code") | ||||||
| 
 | 
 | ||||||
| 	qtn.insert(ignore_permissions=True) | 	qtn.insert(ignore_permissions=True) | ||||||
| 
 | 
 | ||||||
| 	qtn.add_comment('Comment', text="This is a dummy record") | 	qtn.add_comment('Comment', text="This is a dummy record") | ||||||
| 
 | 
 | ||||||
| def make_material_request(buying_items): | def make_material_request(items): | ||||||
| 	for i in buying_items: | 	for i in items: | ||||||
| 		mr = frappe.get_doc({ | 		mr = frappe.get_doc({ | ||||||
| 			"doctype": "Material Request", | 			"doctype": "Material Request", | ||||||
| 			"material_request_type": "Purchase", | 			"material_request_type": "Purchase", | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ def setup_complete(args=None): | |||||||
| 		try: | 		try: | ||||||
| 			make_sample_data() | 			make_sample_data() | ||||||
| 			frappe.clear_cache() | 			frappe.clear_cache() | ||||||
| 		except FiscalYearError: | 		except: | ||||||
| 			# clear message | 			# clear message | ||||||
| 			if frappe.message_log: | 			if frappe.message_log: | ||||||
| 				frappe.message_log.pop() | 				frappe.message_log.pop() | ||||||
| @ -291,8 +291,6 @@ def create_items(args): | |||||||
| 					"item_code": item, | 					"item_code": item, | ||||||
| 					"item_name": item, | 					"item_name": item, | ||||||
| 					"description": 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, | 					"show_in_website": 1, | ||||||
| 					"is_stock_item": is_stock_item and 1 or 0, | 					"is_stock_item": is_stock_item and 1 or 0, | ||||||
| 					"is_pro_applicable": is_pro_applicable and 1 or 0, | 					"is_pro_applicable": is_pro_applicable and 1 or 0, | ||||||
|  | |||||||
| @ -926,35 +926,6 @@ | |||||||
|    "set_only_once": 0,  |    "set_only_once": 0,  | ||||||
|    "unique": 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,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
| @ -988,7 +959,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "description": "Average time taken by the supplier to deliver",  |    "description": "Average time taken by the supplier to deliver",  | ||||||
|    "fieldname": "lead_time_days",  |    "fieldname": "lead_time_days",  | ||||||
|    "fieldtype": "Int",  |    "fieldtype": "Int",  | ||||||
| @ -1016,7 +987,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "description": "",  |    "description": "",  | ||||||
|    "fieldname": "buying_cost_center",  |    "fieldname": "buying_cost_center",  | ||||||
|    "fieldtype": "Link",  |    "fieldtype": "Link",  | ||||||
| @ -1045,7 +1016,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "description": "",  |    "description": "",  | ||||||
|    "fieldname": "expense_account",  |    "fieldname": "expense_account",  | ||||||
|    "fieldtype": "Link",  |    "fieldtype": "Link",  | ||||||
| @ -1074,7 +1045,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "unit_of_measure_conversion",  |    "fieldname": "unit_of_measure_conversion",  | ||||||
|    "fieldtype": "Column Break",  |    "fieldtype": "Column Break",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1100,7 +1071,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "description": "Will also apply for variants",  |    "description": "Will also apply for variants",  | ||||||
|    "fieldname": "uoms",  |    "fieldname": "uoms",  | ||||||
|    "fieldtype": "Table",  |    "fieldtype": "Table",  | ||||||
| @ -1129,7 +1100,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "last_purchase_rate",  |    "fieldname": "last_purchase_rate",  | ||||||
|    "fieldtype": "Float",  |    "fieldtype": "Float",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1156,7 +1127,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 1,  |    "collapsible": 1,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "supplier_details",  |    "fieldname": "supplier_details",  | ||||||
|    "fieldtype": "Section Break",  |    "fieldtype": "Section Break",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1182,7 +1153,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "eval:doc.is_purchase_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "default_supplier",  |    "fieldname": "default_supplier",  | ||||||
|    "fieldtype": "Link",  |    "fieldtype": "Link",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1233,7 +1204,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "eval:doc.is_purchase_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "manufacturer",  |    "fieldname": "manufacturer",  | ||||||
|    "fieldtype": "Link",  |    "fieldtype": "Link",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1259,7 +1230,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "eval:doc.is_purchase_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "manufacturer_part_no",  |    "fieldname": "manufacturer_part_no",  | ||||||
|    "fieldtype": "Data",  |    "fieldtype": "Data",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1284,7 +1255,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "column_break2",  |    "fieldname": "column_break2",  | ||||||
|    "fieldtype": "Column Break",  |    "fieldtype": "Column Break",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1311,7 +1282,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_purchase_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "supplier_items",  |    "fieldname": "supplier_items",  | ||||||
|    "fieldtype": "Table",  |    "fieldtype": "Table",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1359,65 +1330,6 @@ | |||||||
|    "set_only_once": 0,  |    "set_only_once": 0,  | ||||||
|    "unique": 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,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
| @ -1475,7 +1387,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_sales_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "income_account",  |    "fieldname": "income_account",  | ||||||
|    "fieldtype": "Link",  |    "fieldtype": "Link",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1501,7 +1413,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_sales_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "selling_cost_center",  |    "fieldname": "selling_cost_center",  | ||||||
|    "fieldtype": "Link",  |    "fieldtype": "Link",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1527,7 +1439,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_sales_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "column_break3",  |    "fieldname": "column_break3",  | ||||||
|    "fieldtype": "Column Break",  |    "fieldtype": "Column Break",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -1554,7 +1466,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "is_sales_item",  |    "depends_on": "",  | ||||||
|    "description": "",  |    "description": "",  | ||||||
|    "fieldname": "customer_items",  |    "fieldname": "customer_items",  | ||||||
|    "fieldtype": "Table",  |    "fieldtype": "Table",  | ||||||
| @ -1581,7 +1493,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "eval:doc.is_sales_item",  |    "depends_on": "",  | ||||||
|    "fieldname": "max_discount",  |    "fieldname": "max_discount",  | ||||||
|    "fieldtype": "Float",  |    "fieldtype": "Float",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -2323,7 +2235,7 @@ | |||||||
|  "issingle": 0,  |  "issingle": 0,  | ||||||
|  "istable": 0,  |  "istable": 0,  | ||||||
|  "max_attachments": 1,  |  "max_attachments": 1,  | ||||||
|  "modified": "2016-04-14 07:51:07.058298",  |  "modified": "2016-04-15 11:18:48.948958",  | ||||||
|  "modified_by": "Administrator",  |  "modified_by": "Administrator",  | ||||||
|  "module": "Stock",  |  "module": "Stock",  | ||||||
|  "name": "Item",  |  "name": "Item",  | ||||||
|  | |||||||
| @ -50,12 +50,11 @@ class Item(WebsiteGenerator): | |||||||
| 		self.name = self.item_code | 		self.name = self.item_code | ||||||
| 
 | 
 | ||||||
| 	def before_insert(self): | 	def before_insert(self): | ||||||
| 		if self.is_sales_item=="Yes": |  | ||||||
| 			self.publish_in_hub = 1 |  | ||||||
| 
 |  | ||||||
| 		if not self.description: | 		if not self.description: | ||||||
| 			self.description = self.item_name | 			self.description = self.item_name | ||||||
| 
 | 
 | ||||||
|  | 		self.publish_in_hub = 1 | ||||||
|  |          | ||||||
| 	def validate(self): | 	def validate(self): | ||||||
| 		super(Item, self).validate() | 		super(Item, self).validate() | ||||||
| 
 | 
 | ||||||
| @ -71,7 +70,6 @@ class Item(WebsiteGenerator): | |||||||
| 		self.check_item_tax() | 		self.check_item_tax() | ||||||
| 		self.validate_barcode() | 		self.validate_barcode() | ||||||
| 		self.cant_change() | 		self.cant_change() | ||||||
| 		self.validate_reorder_level() |  | ||||||
| 		self.validate_warehouse_for_reorder() | 		self.validate_warehouse_for_reorder() | ||||||
| 		self.update_item_desc() | 		self.update_item_desc() | ||||||
| 		self.synced_with_hub = 0 | 		self.synced_with_hub = 0 | ||||||
| @ -417,11 +415,6 @@ class Item(WebsiteGenerator): | |||||||
| 					filters={"production_item": self.name, "docstatus": 1}): | 					filters={"production_item": self.name, "docstatus": 1}): | ||||||
| 				return True | 				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"): | 		for d in self.get("reorder_levels"): | ||||||
| 			if d.warehouse_reorder_level and not d.warehouse_reorder_qty: | 			if d.warehouse_reorder_level and not d.warehouse_reorder_qty: | ||||||
| 				frappe.throw(_("Row #{0}: Please set reorder quantity").format(d.idx)) | 				frappe.throw(_("Row #{0}: Please set reorder quantity").format(d.idx)) | ||||||
|  | |||||||
| @ -11,8 +11,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 0, |   "is_pro_applicable": 0, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -43,8 +41,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 0, |   "is_pro_applicable": 0, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -66,8 +62,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 0, |   "is_pro_applicable": 0, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -95,9 +89,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 0, |   "is_pro_applicable": 0, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_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", | ||||||
|   "item_group": "_Test Item Group Desktops", |   "item_group": "_Test Item Group Desktops", | ||||||
| @ -115,8 +106,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 0, |   "is_pro_applicable": 0, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -136,8 +125,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 1, |   "is_pro_applicable": 1, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -153,8 +140,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 0, |   "is_pro_applicable": 0, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -171,8 +156,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 0, |   "is_pro_applicable": 0, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -189,8 +172,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 0, |   "is_pro_applicable": 0, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -211,7 +192,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 1, |   "is_pro_applicable": 1, | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -231,8 +211,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 1, |   "is_pro_applicable": 1, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
| @ -252,8 +230,6 @@ | |||||||
|   "inspection_required": 0, |   "inspection_required": 0, | ||||||
|   "is_fixed_asset": 0, |   "is_fixed_asset": 0, | ||||||
|   "is_pro_applicable": 1, |   "is_pro_applicable": 1, | ||||||
|   "is_purchase_item": 1, |  | ||||||
|   "is_sales_item": 1, |  | ||||||
|   "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", | ||||||
|  | |||||||
| @ -125,19 +125,10 @@ def validate_item_details(args, item): | |||||||
| 	from erpnext.stock.doctype.item.item import validate_end_of_life | 	from erpnext.stock.doctype.item.item import validate_end_of_life | ||||||
| 	validate_end_of_life(item.name, item.end_of_life, item.disabled) | 	validate_end_of_life(item.name, item.end_of_life, item.disabled) | ||||||
| 
 | 
 | ||||||
| 	if args.transaction_type=="selling": | 	if args.transaction_type=="selling" and cint(item.has_variants): | ||||||
| 		# 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)) | 		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": | 	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: | 		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)) | 			throw(_("Item {0} must be a Sub-contracted Item").format(item.name)) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -23,7 +23,6 @@ def _reorder_item(): | |||||||
| 
 | 
 | ||||||
| 	items_to_consider = frappe.db.sql_list("""select name from `tabItem` item | 	items_to_consider = frappe.db.sql_list("""select name from `tabItem` item | ||||||
| 		where is_stock_item=1 and has_variants=0 | 		where is_stock_item=1 and has_variants=0 | ||||||
| 			and (is_purchase_item=1 or is_sub_contracted_item=1) |  | ||||||
| 			and disabled=0 | 			and disabled=0 | ||||||
| 			and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s) | 			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) | 			and (exists (select name from `tabItem Reorder` ir where ir.parent=item.name) | ||||||
|  | |||||||
| @ -1,18 +1,16 @@ | |||||||
| { | { | ||||||
|  "add_total_row": 0,  |  | ||||||
|  "apply_user_permissions": 1, |  "apply_user_permissions": 1, | ||||||
|  "creation": "2013-08-20 15:08:10", |  "creation": "2013-08-20 15:08:10", | ||||||
|  "disabled": 0,  |  | ||||||
|  "docstatus": 0, |  "docstatus": 0, | ||||||
|  "doctype": "Report", |  "doctype": "Report", | ||||||
|  "idx": 1, |  "idx": 1, | ||||||
|  "is_standard": "Yes", |  "is_standard": "Yes", | ||||||
|  "modified": "2016-04-01 08:27:14.436178",  |  "modified": "2014-06-03 07:18:17.128919", | ||||||
|  "modified_by": "Administrator", |  "modified_by": "Administrator", | ||||||
|  "module": "Stock", |  "module": "Stock", | ||||||
|  "name": "Items To Be Requested", |  "name": "Items To Be Requested", | ||||||
|  "owner": "Administrator", |  "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",  |  "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", |  "ref_doctype": "Item", | ||||||
|  "report_name": "Items To Be Requested", |  "report_name": "Items To Be Requested", | ||||||
|  "report_type": "Query Report" |  "report_type": "Query Report" | ||||||
|  | |||||||
| @ -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) { | cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) { | ||||||
| 	if (!doc.__islocal) { | 	if (!doc.__islocal) { | ||||||
| 		return $c('runserverobj', args={'method':'generate_schedule', 'docs':doc}, | 		return $c('runserverobj', args={'method':'generate_schedule', 'docs':doc}, | ||||||
|  | |||||||
| @ -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) { | cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { | ||||||
| 	return {query: "erpnext.controllers.queries.customer_query" } | 	return {query: "erpnext.controllers.queries.customer_query" } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user