[Fix] Added check to validate selling price against valuation rate
This commit is contained in:
		
							parent
							
								
									1cfe2d7b45
								
							
						
					
					
						commit
						edcba51c8b
					
				| @ -164,14 +164,15 @@ class SellingController(StockController): | |||||||
| 
 | 
 | ||||||
| 	def validate_selling_price(self): | 	def validate_selling_price(self): | ||||||
| 		selling_settings = frappe.get_single("Selling Settings") | 		selling_settings = frappe.get_single("Selling Settings") | ||||||
| 		if not selling_settings.validate_selling_price_purchase_rate: | 		if not selling_settings.validate_selling_price: | ||||||
| 			return | 			return | ||||||
| 
 | 
 | ||||||
| 		for it in self.get("items"): | 		for it in self.get("items"): | ||||||
| 			item = frappe.get_doc("Item", it.name) | 			item = frappe.get_doc("Item", it.name) | ||||||
| 
 | 
 | ||||||
| 			if flt(it.base_rate) < flt(item.last_purchase_rate): | 			if flt(it.base_rate) < flt(item.last_purchase_rate) or flt(it.base_rate) < flt(item.valuation_rate): | ||||||
| 				frappe.throw(_("Selling price for item {0} is lower than its Purchase rate. Selling price should be atleast {1}").format(it.item_name, item.last_purchase_rate)) | 				frappe.throw(_("""Selling price for item {0} is lower than its Purchase rate or Valuation rate. | ||||||
|  | 				Selling price should be atleast {1}""").format(it.item_name, item.last_purchase_rate)) | ||||||
| 
 | 
 | ||||||
| 	def get_item_list(self): | 	def get_item_list(self): | ||||||
| 		il = [] | 		il = [] | ||||||
|  | |||||||
| @ -328,14 +328,14 @@ | |||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "columns": 0,  |    "columns": 0,  | ||||||
|    "fieldname": "validate_selling_price_purchase_rate",  |    "fieldname": "validate_selling_price",  | ||||||
|    "fieldtype": "Check",  |    "fieldtype": "Check",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
|    "ignore_user_permissions": 0,  |    "ignore_user_permissions": 0,  | ||||||
|    "ignore_xss_filter": 0,  |    "ignore_xss_filter": 0,  | ||||||
|    "in_filter": 0,  |    "in_filter": 0,  | ||||||
|    "in_list_view": 0,  |    "in_list_view": 0,  | ||||||
|    "label": "Validate Selling Price for Item against Purchase Rate",  |    "label": "Validate Selling Price for Item against Purchase Rate or Valuation Rate",  | ||||||
|    "length": 0,  |    "length": 0,  | ||||||
|    "no_copy": 0,  |    "no_copy": 0,  | ||||||
|    "permlevel": 0,  |    "permlevel": 0,  | ||||||
| @ -361,7 +361,7 @@ | |||||||
|  "issingle": 1,  |  "issingle": 1,  | ||||||
|  "istable": 0,  |  "istable": 0,  | ||||||
|  "max_attachments": 0,  |  "max_attachments": 0,  | ||||||
|  "modified": "2016-10-19 18:32:19.667032",  |  "modified": "2016-10-20 08:17:45.621151",  | ||||||
|  "modified_by": "Administrator",  |  "modified_by": "Administrator",  | ||||||
|  "module": "Selling",  |  "module": "Selling",  | ||||||
|  "name": "Selling Settings",  |  "name": "Selling Settings",  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user