validate warehouses for manufacture/repack only if bom is used
This commit is contained in:
		
							parent
							
								
									2353b90e7a
								
							
						
					
					
						commit
						d566a10f55
					
				| @ -71,7 +71,9 @@ class DocType(TransactionBase): | |||||||
| 		source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return"] | 		source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return"] | ||||||
| 		target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return"] | 		target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return"] | ||||||
| 		 | 		 | ||||||
| 		fg_qty = 0 | 		validate_for_manufacture_repack = any([d.bom_no for d in self.doclist.get( | ||||||
|  | 			{"parentfield": "mtn_details"})]) | ||||||
|  | 
 | ||||||
| 		for d in getlist(self.doclist, 'mtn_details'): | 		for d in getlist(self.doclist, 'mtn_details'): | ||||||
| 			if not d.s_warehouse and not d.t_warehouse: | 			if not d.s_warehouse and not d.t_warehouse: | ||||||
| 				d.s_warehouse = self.doc.from_warehouse | 				d.s_warehouse = self.doc.from_warehouse | ||||||
| @ -97,6 +99,7 @@ class DocType(TransactionBase): | |||||||
| 					d.s_warehouse = None | 					d.s_warehouse = None | ||||||
| 
 | 
 | ||||||
| 			if self.doc.purpose == "Manufacture/Repack": | 			if self.doc.purpose == "Manufacture/Repack": | ||||||
|  | 				if validate_for_manufacture_repack: | ||||||
| 					if d.bom_no: | 					if d.bom_no: | ||||||
| 						d.s_warehouse = None | 						d.s_warehouse = None | ||||||
| 						 | 						 | ||||||
| @ -115,8 +118,9 @@ class DocType(TransactionBase): | |||||||
| 							msgprint(_("Row # ") + "%s: " % cint(d.idx) | 							msgprint(_("Row # ") + "%s: " % cint(d.idx) | ||||||
| 								+ _("Source Warehouse") + _(" is mandatory"), raise_exception=1) | 								+ _("Source Warehouse") + _(" is mandatory"), raise_exception=1) | ||||||
| 			 | 			 | ||||||
| 			if d.s_warehouse == d.t_warehouse: | 			if cstr(d.s_warehouse) == cstr(d.t_warehouse): | ||||||
| 				msgprint(_("Source and Target Warehouse cannot be same"), raise_exception=1) | 				msgprint(_("Source and Target Warehouse cannot be same"),  | ||||||
|  | 					raise_exception=1) | ||||||
| 				 | 				 | ||||||
| 
 | 
 | ||||||
| 				 | 				 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user