diff --git a/aumms/aumms/doctype/design_analysis/design_analysis.json b/aumms/aumms/doctype/design_analysis/design_analysis.json index c86e02f8..b5bae9a1 100644 --- a/aumms/aumms/doctype/design_analysis/design_analysis.json +++ b/aumms/aumms/doctype/design_analysis/design_analysis.json @@ -17,7 +17,7 @@ "item_group", "customer_expected_weight", "purity", - "phone_no", + "mobile_no", "section_break_rgobr", "column_break_y3jbr", "section_break_qqgnh", @@ -217,14 +217,15 @@ }, { "fetch_from": "design_request.mobile_no", - "fieldname": "phone_no", + "fetch_if_empty": 1, + "fieldname": "mobile_no", "fieldtype": "Data", "label": "Phone No" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-11-09 14:49:22.769235", + "modified": "2023-11-13 12:34:20.281981", "modified_by": "Administrator", "module": "AuMMS", "name": "Design Analysis", diff --git a/aumms/aumms/doctype/smith/smith.json b/aumms/aumms/doctype/smith/smith.json index 2dec0ce7..324a1626 100644 --- a/aumms/aumms/doctype/smith/smith.json +++ b/aumms/aumms/doctype/smith/smith.json @@ -19,6 +19,7 @@ "is_head_of_smith", "head_of_smith", "hourly_rate", + "email", "section_break_9mmii", "category" ], @@ -109,11 +110,20 @@ "fieldname": "is_head_of_smith", "fieldtype": "Check", "label": "Is Head of smith" + }, + { + "fetch_from": "employee.company_email", + "fieldname": "email", + "fieldtype": "Data", + "label": "Email", + "mandatory_depends_on": "eval:doc.is_head_of_smith", + "read_only": 1, + "reqd": 1 } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-11-10 13:12:57.067492", + "modified": "2023-11-14 11:49:07.892640", "modified_by": "Administrator", "module": "AuMMS", "name": "Smith", diff --git a/aumms/aumms/doctype/smith/smith.py b/aumms/aumms/doctype/smith/smith.py index 7016d5d1..57d917d6 100644 --- a/aumms/aumms/doctype/smith/smith.py +++ b/aumms/aumms/doctype/smith/smith.py @@ -11,6 +11,9 @@ class Smith(Document): def before_insert(self): self.create_smith_warehouse() + + def validate(self): + create_user_for_smith(self) def create_smith_warehouse(self): """ @@ -85,3 +88,13 @@ def smith_reference_filter_query(doctype, txt, searchfield, start, page_len, fil tabSmith ) '''.format(tab_of_doctype = f'tab{doctype}', doctype = doctype.lower())) + +def create_user_for_smith(doc): + if doc.email: + user = frappe.new_doc('User') + user.email = doc.email + user.first_name = doc.smith_name + user.append('roles', {'role': 'Head of Smith'}) + user.save(ignore_permissions = True) + frappe.msgprint('User created for this smith', alert=True, indicator='green') +