fix in import error due to indentation issues in item_grou[
This commit is contained in:
		
							parent
							
								
									232d725fd7
								
							
						
					
					
						commit
						68fb2c9b19
					
				| @ -8,11 +8,11 @@ | |||||||
| #  | #  | ||||||
| # This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | ||||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the | ||||||
| # GNU General Public License for more details. | # GNU General Public License for more details. | ||||||
| #  | #  | ||||||
| # You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||||
| # along with this program.  If not, see <http://www.gnu.org/licenses/>. | # along with this program.	If not, see <http://www.gnu.org/licenses/>. | ||||||
| 
 | 
 | ||||||
| # Please edit this list and import only required elements | # Please edit this list and import only required elements | ||||||
| import webnotes | import webnotes | ||||||
| @ -34,33 +34,33 @@ convert_to_lists = webnotes.conn.convert_to_lists | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class DocType: | class DocType: | ||||||
|   def __init__(self,d,dl): | 	def __init__(self,d,dl): | ||||||
|     self.doc, self.doclist = d,dl | 		self.doc, self.doclist = d,dl | ||||||
|     self.nsm_parent_field = 'parent_item_group'; | 		self.nsm_parent_field = 'parent_item_group'; | ||||||
| 
 | 
 | ||||||
|   # update Node Set Model | 	# update Node Set Model | ||||||
|   def update_nsm_model(self): | 	def update_nsm_model(self): | ||||||
|     import webnotes | 		import webnotes | ||||||
|     import webnotes.utils.nestedset | 		import webnotes.utils.nestedset | ||||||
|     webnotes.utils.nestedset.update_nsm(self) | 		webnotes.utils.nestedset.update_nsm(self) | ||||||
| 
 | 
 | ||||||
|   # ON UPDATE | 	# ON UPDATE | ||||||
|   #-------------------------------------- | 	#-------------------------------------- | ||||||
|   def on_update(self): | 	def on_update(self): | ||||||
|     # update nsm | 		# update nsm | ||||||
|     self.update_nsm_model()    | 		self.update_nsm_model()	  | ||||||
| 
 | 
 | ||||||
|   def validate(self):  | 	def validate(self):  | ||||||
|     if self.doc.lft and self.doc.rgt: | 		if self.doc.lft and self.doc.rgt: | ||||||
|       res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name)) | 			res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name)) | ||||||
|       if not res: | 			if not res: | ||||||
|         msgprint("Please enter proper parent item group.")  | 				msgprint("Please enter proper parent item group.")  | ||||||
|         raise Exception | 				raise Exception | ||||||
|      | 		 | ||||||
|     r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name)) | 		r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name)) | ||||||
|     if r: | 		if r: | ||||||
|       msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name)) | 			msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name)) | ||||||
|       raise Exception | 			raise Exception | ||||||
| 	 | 	 | ||||||
| 	def on_trash(self): | 	def on_trash(self): | ||||||
| 		ig = sql("select name from `tabItem` where ifnull(item_group, '') = %s", self.doc.name) | 		ig = sql("select name from `tabItem` where ifnull(item_group, '') = %s", self.doc.name) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user