mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-02 06:29:54 +00:00
fix: fallback to Personal Email for user creation just like client-side
(cherry picked from commit 31af13a5e6)
This commit is contained in:
@@ -43,8 +43,8 @@
|
||||
"contact_details",
|
||||
"cell_number",
|
||||
"column_break_40",
|
||||
"personal_email",
|
||||
"company_email",
|
||||
"personal_email",
|
||||
"column_break4",
|
||||
"prefered_contact_email",
|
||||
"prefered_email",
|
||||
@@ -298,7 +298,7 @@
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.__islocal && !doc.user_id",
|
||||
"description": "This will create User for this employee depending on the Company Email.",
|
||||
"description": "Creates a User account for this employee using the Preferred, Company, or Personal email.",
|
||||
"fieldname": "create_user_automatically",
|
||||
"fieldtype": "Check",
|
||||
"label": "Create User Automatically",
|
||||
@@ -834,7 +834,7 @@
|
||||
"image_field": "image",
|
||||
"is_tree": 1,
|
||||
"links": [],
|
||||
"modified": "2026-03-23 14:05:42.144641",
|
||||
"modified": "2026-03-23 15:26:05.149280",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Employee",
|
||||
|
||||
@@ -161,11 +161,11 @@ class Employee(NestedSet):
|
||||
self.validate_duplicate_user_id()
|
||||
|
||||
def validate_auto_user_creation(self):
|
||||
if self.create_user_automatically and not (self.prefered_email or self.company_email):
|
||||
if self.create_user_automatically and not (
|
||||
self.prefered_email or self.company_email or self.personal_email
|
||||
):
|
||||
frappe.throw(
|
||||
_(
|
||||
"Company Email or Preferred Email is mandatory when 'Create User Automatically' is enabled"
|
||||
),
|
||||
_("Company or Personal Email is mandatory when 'Create User Automatically' is enabled"),
|
||||
frappe.MandatoryError,
|
||||
title=_("Auto User Creation Error"),
|
||||
)
|
||||
@@ -193,7 +193,7 @@ class Employee(NestedSet):
|
||||
|
||||
create_user(
|
||||
employee=self.name,
|
||||
email=self.prefered_email or self.company_email,
|
||||
email=self.prefered_email or self.company_email or self.personal_email,
|
||||
create_user_permission=self.create_user_permission,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user