Fixed merge conflict
This commit is contained in:
		
						commit
						3c29967d27
					
				| @ -5,7 +5,7 @@ import frappe | |||||||
| from erpnext.hooks import regional_overrides | from erpnext.hooks import regional_overrides | ||||||
| from frappe.utils import getdate | from frappe.utils import getdate | ||||||
| 
 | 
 | ||||||
| __version__ = '10.1.58' | __version__ = '10.1.59' | ||||||
| 
 | 
 | ||||||
| def get_default_company(user=None): | def get_default_company(user=None): | ||||||
| 	'''Get default company for user''' | 	'''Get default company for user''' | ||||||
|  | |||||||
| @ -49,8 +49,7 @@ class Employee(NestedSet): | |||||||
| 			self.validate_onboarding_process() | 			self.validate_onboarding_process() | ||||||
| 
 | 
 | ||||||
| 		if self.user_id: | 		if self.user_id: | ||||||
| 			self.validate_for_enabled_user_id() | 			self.validate_user_details() | ||||||
| 			self.validate_duplicate_user_id() |  | ||||||
| 		else: | 		else: | ||||||
| 			existing_user_id = frappe.db.get_value("Employee", self.name, "user_id") | 			existing_user_id = frappe.db.get_value("Employee", self.name, "user_id") | ||||||
| 			if existing_user_id: | 			if existing_user_id: | ||||||
| @ -60,6 +59,14 @@ class Employee(NestedSet): | |||||||
| 	def set_employee_name(self): | 	def set_employee_name(self): | ||||||
| 		self.employee_name = ' '.join(filter(lambda x: x, [self.first_name, self.middle_name, self.last_name])) | 		self.employee_name = ' '.join(filter(lambda x: x, [self.first_name, self.middle_name, self.last_name])) | ||||||
| 
 | 
 | ||||||
|  | 	def validate_user_details(self): | ||||||
|  | 		data = frappe.db.get_value('User', | ||||||
|  | 			self.user_id, ['enabled', 'user_image'], as_dict=1) | ||||||
|  | 
 | ||||||
|  | 		self.image = data.get("user_image") | ||||||
|  | 		self.validate_for_enabled_user_id(data.get("enabled", 0)) | ||||||
|  | 		self.validate_duplicate_user_id() | ||||||
|  | 
 | ||||||
| 	def update_nsm_model(self): | 	def update_nsm_model(self): | ||||||
| 		frappe.utils.nestedset.update_nsm(self) | 		frappe.utils.nestedset.update_nsm(self) | ||||||
| 
 | 
 | ||||||
| @ -143,10 +150,10 @@ class Employee(NestedSet): | |||||||
| 		if self.status == 'Left' and not self.relieving_date: | 		if self.status == 'Left' and not self.relieving_date: | ||||||
| 			throw(_("Please enter relieving date.")) | 			throw(_("Please enter relieving date.")) | ||||||
| 
 | 
 | ||||||
| 	def validate_for_enabled_user_id(self): | 	def validate_for_enabled_user_id(self, enabled): | ||||||
| 		if not self.status == 'Active': | 		if not self.status == 'Active': | ||||||
| 			return | 			return | ||||||
| 		enabled = frappe.db.get_value("User", self.user_id, "enabled") | 
 | ||||||
| 		if enabled is None: | 		if enabled is None: | ||||||
| 			frappe.throw(_("User {0} does not exist").format(self.user_id)) | 			frappe.throw(_("User {0} does not exist").format(self.user_id)) | ||||||
| 		if enabled == 0: | 		if enabled == 0: | ||||||
|  | |||||||
| @ -215,10 +215,11 @@ class ExpenseClaim(AccountsController): | |||||||
| 			self.total_advance_amount += flt(d.allocated_amount) | 			self.total_advance_amount += flt(d.allocated_amount) | ||||||
| 
 | 
 | ||||||
| 		if self.total_advance_amount: | 		if self.total_advance_amount: | ||||||
| 			if flt(self.total_advance_amount) > flt(self.total_claimed_amount): | 			precision = self.precision("total_advance_amount") | ||||||
|  | 			if flt(self.total_advance_amount, precision) > flt(self.total_claimed_amount, precision): | ||||||
| 				frappe.throw(_("Total advance amount cannot be greater than total claimed amount")) | 				frappe.throw(_("Total advance amount cannot be greater than total claimed amount")) | ||||||
| 			if self.total_sanctioned_amount \ | 			if self.total_sanctioned_amount \ | ||||||
| 					and flt(self.total_advance_amount) > flt(self.total_sanctioned_amount): | 					and flt(self.total_advance_amount, precision) > flt(self.total_sanctioned_amount, precision): | ||||||
| 				frappe.throw(_("Total advance amount cannot be greater than total sanctioned amount")) | 				frappe.throw(_("Total advance amount cannot be greater than total sanctioned amount")) | ||||||
| 
 | 
 | ||||||
| 	def validate_sanctioned_amount(self): | 	def validate_sanctioned_amount(self): | ||||||
|  | |||||||
| @ -571,3 +571,4 @@ erpnext.patches.v11_0.add_sales_stages | |||||||
| erpnext.patches.v11_0.ewaybill_fields_gst_india | erpnext.patches.v11_0.ewaybill_fields_gst_india | ||||||
| erpnext.patches.v11_0.drop_column_max_days_allowed | erpnext.patches.v11_0.drop_column_max_days_allowed | ||||||
| erpnext.patches.v11_0.change_healthcare_desktop_icons | erpnext.patches.v11_0.change_healthcare_desktop_icons | ||||||
|  | erpnext.patches.v10_0.update_user_image_in_employee | ||||||
|  | |||||||
							
								
								
									
										19
									
								
								erpnext/patches/v10_0/update_user_image_in_employee.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								erpnext/patches/v10_0/update_user_image_in_employee.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | |||||||
|  | # Copyright (c) 2017, Frappe and Contributors | ||||||
|  | # License: GNU General Public License v3. See license.txt | ||||||
|  | 
 | ||||||
|  | from __future__ import unicode_literals | ||||||
|  | import frappe | ||||||
|  | 
 | ||||||
|  | def execute(): | ||||||
|  | 	frappe.reload_doc('hr', 'doctype', 'employee') | ||||||
|  | 
 | ||||||
|  | 	frappe.db.sql(""" | ||||||
|  | 		UPDATE | ||||||
|  | 			`tabEmployee`, `tabUser` | ||||||
|  | 		SET | ||||||
|  | 			`tabEmployee`.image = `tabUser`.user_image | ||||||
|  | 		WHERE | ||||||
|  | 			`tabEmployee`.user_id = `tabUser`.name and | ||||||
|  | 			`tabEmployee`.user_id is not null and | ||||||
|  | 			`tabEmployee`.user_id != '' and `tabEmployee`.image is null | ||||||
|  | 	""") | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user