Update opening stock on creation if item, only if it is non-serialized and does maintain batch
This commit is contained in:
		
							parent
							
								
									6889d294ae
								
							
						
					
					
						commit
						767cf99435
					
				| @ -11,6 +11,7 @@ | |||||||
|  "docstatus": 0,  |  "docstatus": 0,  | ||||||
|  "doctype": "DocType",  |  "doctype": "DocType",  | ||||||
|  "document_type": "Setup",  |  "document_type": "Setup",  | ||||||
|  |  "editable_grid": 1,  | ||||||
|  "fields": [ |  "fields": [ | ||||||
|   { |   { | ||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
| @ -305,7 +306,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 1,  |    "bold": 1,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "eval:(doc.__islocal&&doc.is_stock_item)",  |    "depends_on": "eval:(doc.__islocal&&doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)",  | ||||||
|    "fieldname": "opening_stock",  |    "fieldname": "opening_stock",  | ||||||
|    "fieldtype": "Int",  |    "fieldtype": "Int",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -331,7 +332,7 @@ | |||||||
|    "allow_on_submit": 0,  |    "allow_on_submit": 0,  | ||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 0,  |    "collapsible": 0,  | ||||||
|    "depends_on": "eval:(doc.__islocal && doc.is_stock_item && doc.opening_stock)",  |    "depends_on": "eval:(doc.__islocal && doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no && doc.opening_stock)",  | ||||||
|    "fieldname": "valuation_rate",  |    "fieldname": "valuation_rate",  | ||||||
|    "fieldtype": "Currency",  |    "fieldtype": "Currency",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
| @ -2307,7 +2308,7 @@ | |||||||
|  "issingle": 0,  |  "issingle": 0,  | ||||||
|  "istable": 0,  |  "istable": 0,  | ||||||
|  "max_attachments": 1,  |  "max_attachments": 1,  | ||||||
|  "modified": "2016-07-06 17:00:45.561349",  |  "modified": "2016-07-21 18:44:10.230372",  | ||||||
|  "modified_by": "Administrator",  |  "modified_by": "Administrator",  | ||||||
|  "module": "Stock",  |  "module": "Stock",  | ||||||
|  "name": "Item",  |  "name": "Item",  | ||||||
|  | |||||||
| @ -118,6 +118,9 @@ class Item(WebsiteGenerator): | |||||||
| 
 | 
 | ||||||
| 	def set_opening_stock(self): | 	def set_opening_stock(self): | ||||||
| 		'''set opening stock''' | 		'''set opening stock''' | ||||||
|  | 		if not self.is_stock_item or self.has_serial_no or self.has_batch_no: | ||||||
|  | 			return | ||||||
|  | 		 | ||||||
| 		if not self.valuation_rate: | 		if not self.valuation_rate: | ||||||
| 			frappe.throw(_("Valuation Rate is mandatory if Opening Stock entered")) | 			frappe.throw(_("Valuation Rate is mandatory if Opening Stock entered")) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user